Skip to content

feat(adapters): the OpenAI-compatible client takes a reasoning effort - #112

Merged
DaXu999 merged 2 commits into
mainfrom
feat/reasoning-effort
Nov 8, 2026
Merged

DaXu999 merged 2 commits into
mainfrom
feat/reasoning-effort

Conversation

@DaXu999

@DaXu999 DaXu999 commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

What

  • OpenAiCompatibleModelClient takes a reasoningEffort option. It is sent as OpenAI's reasoning_effort field only when set, and recorded in 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.
  • The output ceiling is sent as max_completion_tokens, the current name of the legacy max_tokens.

Why

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". 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_tokens 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: a ceiling of 32,001 was refused as 128,004, and a ceiling of 499 let the model write 2,000. max_completion_tokens 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.

Base

Off main. Until 2026-11-08 this branch also carried #110 merged into it, with fix/claude-code-max-turns stacked on top; those now go in as their own PRs.

Checks

pnpm check is green on the branch: format, typecheck, vitest 1136/1136, test:release 7/7, docs:api:check and conformance:check.

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.
@DaXu999
DaXu999 merged commit 1f8a97a into main Nov 8, 2026
2 checks passed
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.

1 participant