Repository navigation
feat(adapters): the OpenAI-compatible client takes a reasoning effort - #112
Merged
Merged
Conversation
A vendor may refuse function tools on a chat completion of a model that reasons by default unless the request sets reasoning_effort to "none". The client now takes a reasoningEffort option, sends it as OpenAI's reasoning_effort field only when set, and records it on the turn's settings beside thinking, so the turn's record says how the model ran. REASONING_EFFORTS names the values a host may pass.
…_completion_tokens The client sent the output ceiling as `max_tokens`, the legacy name of OpenAI's `max_completion_tokens`. The two mean the same to OpenAI, to OpenRouter and to the gateways met so far, but a gateway may treat the legacy one as a visible-output ask and scale it up for a reasoning model before the vendor's own limit: one sends four times the figure, with a floor, so a ceiling of 32,001 was refused as 128,004 and a ceiling of 499 let the model write 2,000. The current field passes through such a gateway as given. Measured on 2026-10-28 against that gateway with both fields, on a reasoning model and a plain one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
OpenAiCompatibleModelClienttakes areasoningEffortoption. It is sent as OpenAI'sreasoning_effortfield only when set, and recorded in the turn'ssettingsbesidethinking, so the turn's record says how the model ran.REASONING_EFFORTSnames the values a host may pass.max_completion_tokens, the current name of the legacymax_tokens.Why
A vendor may refuse function tools on a chat completion of a model that reasons by default unless the request sets
reasoning_effortto"none". A host running such a model through the client had no field to say so.OpenAI, OpenRouter and the gateways met so far read both ceiling fields alike, but a gateway may treat
max_tokensas a visible-output ask and scale it up for a reasoning model before the vendor's own limit. One sends four times the figure, with a floor: a ceiling of 32,001 was refused as 128,004, and a ceiling of 499 let the model write 2,000.max_completion_tokenspasses through such a gateway as given. Measured on 2026-10-28 against that gateway with both fields, on a reasoning model and a plain one.Base
Off
main. Until 2026-11-08 this branch also carried #110 merged into it, withfix/claude-code-max-turnsstacked on top; those now go in as their own PRs.Checks
pnpm checkis green on the branch: format, typecheck, vitest 1136/1136, test:release 7/7,docs:api:checkandconformance:check.