# NousResearch/hermes-agent · Auxiliary client max_tokens handling in _build_call_kwargs across providers

## Open now

- 2 issues, 2 PRs open on GitHub.
- #50132: \[Bug\]: _build_call_kwargs silently drops max_tokens for OpenAI-compatible endpoints, causing runaway compression summaries on local backends
- #53677: Auxiliary vision fails with LiteLLM proxy + Bedrock: max_tokens omitted causes HTTP 400
- PR #53681: fix(auxiliary): pass max_tokens explicitly for LiteLLM/Bedrock proxies
- PR #56957: \[codex\] Keep OpenRouter auxiliary token caps

Most members concern auxiliary LLM calls (title generation, compression, vision) where max_tokens is dropped, inflated, or not passed explicitly, with reported effects on OpenRouter (402 errors), LiteLLM/Bedrock proxies (HTTP 400), and local backends. The members are a mix of issue reports and proposed fixes, and the specific provider scenarios differ.

## TL;DR

- 16 member(s): 2 open issue(s), 2 closed issue(s), 2 open PR(s), 1 merged PR(s), 9 PR(s) closed without merging.
- A fix was merged to main in PR #99725. Verify it addresses your case.
- **Recommended:** read PR #99725 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `unresolved`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.12`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Open related issues

- #50132: \[Bug\]: _build_call_kwargs silently drops max_tokens for OpenAI-compatible endpoints, causing runaway compression summaries on local backends
- #53677: Auxiliary vision fails with LiteLLM proxy + Bedrock: max_tokens omitted causes HTTP 400

## Closed / duplicate issues

- #41035: aux: _build_call_kwargs strips max_tokens for OpenRouter — free tier gets HTTP 402, falls back to text-only model
- #56901: Auxiliary title generation falls back to OpenRouter with inflated max_tokens (65536) when user's main provider is a custom endpoint

## Prior & competing PRs

- **#56934: fix(auxiliary): preserve max_tokens for OpenRouter to prevent 402**. closed without merge · fix tier `suggested`
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#41055`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#99725: fix(compression): OpenRouter fallback survives credit-limited 402s by clamping to the affordable budget (salvage #41055)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `agent/auxiliary_client.py`, `tests/agent/test_aux_affordable_402_retry.py`, `tests/agent/test_auxiliary_openrouter_max_tokens.py`
- **#41055: fix(auxiliary): preserve max_tokens for OpenRouter to prevent free-tier 402**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `13c3958df5`, `#99725`, `#49785`, `#41035`
- **#41063: fix(openrouter): include max_tokens + fix credential pool fallback (#41035)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `c56b39c11e814ee571e391fc46384b0e7888a490`, `#53906`, `#23495`, `#41035`
- **#50139: fix(auxiliary): preserve explicit max_tokens caps (#50132)**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`; refs `#50139`, `#50132`
- **#50147: fix(auxiliary): preserve explicit caps for compatible routes**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#50132`
- **#50158: fix(agent): pass max_tokens unconditionally in _build_call_kwargs**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#50139`, `#50132`, `#50147`
- **#53681: fix(auxiliary): pass max_tokens explicitly for LiteLLM/Bedrock proxies**. open
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - files: `agent/auxiliary_client.py`
- **#56957: \[codex\] Keep OpenRouter auxiliary token caps**. open
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41055`, `#56960`
  - files: `agent/auxiliary_client.py`, `tests/agent/test_auxiliary_client.py`
- **#56960: fix(auxiliary): preserve OpenRouter max_tokens for title generation**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41055`, `#56934`, `#56957`
- **#57382: fix(auxiliary): cap OpenRouter max tokens**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41055`, `#56901`
- **#58053: fix(auxiliary): preserve OpenRouter max tokens**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#41055`

## Fix status

- Merged to main in PR #99725 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-31`.
- Subsystem: `agent`
- Kind: `bug` (from the open issues' GitHub type labels).
