Skip to content

refactor: route max_completion_tokens on provider, drop per-model flag (#30) - #56

Merged
mrwadams merged 3 commits into
mainfrom
fix/30-drop-completion-tokens-flag
Jul 16, 2026
Merged

refactor: route max_completion_tokens on provider, drop per-model flag (#30)#56
mrwadams merged 3 commits into
mainfrom
fix/30-drop-completion-tokens-flag

Conversation

@mrwadams

Copy link
Copy Markdown
Owner

Closes #30.

What

Every current and future OpenAI chat model uses max_completion_tokens (the deprecated max_tokens is gone across all OpenAI chat completions), so the per-model uses_max_completion_tokens flag duplicated a fact already captured by the provider key — and was one more thing to remember on every new OpenAI model.

  • Remove uses_max_completion_tokens from ModelInfo and from the four gpt-5.x entries in core/models.py.
  • Remove the model_uses_completion_tokens helper.
  • In core/llm.py:_build_litellm_kwargs, branch on config.provider == "OpenAI API" for both the max_completion_tokens kwarg and the temperature omission (the whole OpenAI family is the reasoning family).

Behaviour

No change. The wrapper builds identical LiteLLM kwargs for every current model — OpenAI still gets max_completion_tokens + no temperature, Anthropic its max_tokens default, Google its safety settings, Custom its forced OpenAI routing. The Custom path is untouched.

Tests

  • tests/test_models.py: dropped the two flag-invariant tests + helper import.
  • tests/test_llm.py: renamed the three OpenAI cases to assert provider-based routing.
  • Full suite: 130 passed.

🤖 Generated with Claude Code

mrwadams and others added 3 commits July 15, 2026 09:37
#30)

Every current and future OpenAI chat model uses max_completion_tokens, so
the per-model uses_max_completion_tokens flag duplicated a fact already
captured by the provider key. Remove the field, the four gpt-5.x entries
that set it, and the model_uses_completion_tokens helper; branch on
config.provider == "OpenAI API" in _build_litellm_kwargs for both the
max_completion_tokens kwarg and the temperature omission.

No behaviour change: the wrapper builds identical kwargs for every current
model. Tests updated to key the routing assertions off provider.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mrwadams
mrwadams merged commit 4842f57 into main Jul 16, 2026
6 checks passed
@mrwadams
mrwadams deleted the fix/30-drop-completion-tokens-flag branch July 16, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop uses_max_completion_tokens flag; route on provider instead

1 participant