feat(kosong): add effortParam opt-in for anthropic output_config.effort - #2486
feat(kosong): add effortParam opt-in for anthropic output_config.effort#2486kevingatera wants to merge 12 commits into
Conversation
kosong's anthropic adapter only emits output_config.effort for model names it recognizes (opus-4-5 / adaptive). Third-party Anthropic-compatible endpoints (e.g. z.ai GLM over /api/anthropic) honor effort on the enabled thinking path but are not name-recognized, so /thinking levels silently no-op there. Add a per-alias effortParam flag plumbed through the model alias schema, provider-manager, and the oauth managed/merge types; when set, the enabled-thinking path emits output_config.effort alongside budget_tokens.
…onfig.effort The v2 engine silently accepted but dropped effortParam. Plumb it through the same path as adaptiveThinking: the models config section schema, KIMI_MODEL_EFFORT_PARAM in the env overlay, the catalog provider-options allowlist, ProtocolProviderOptions, and the Anthropic base, where the opt-in escapes the budget-path gate so output_config.effort reaches the wire for non-name-recognized Anthropic-compatible endpoints.
🦋 Changeset detectedLatest commit: 0fc1f7a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d336c2d0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /** | ||
| * Opt-in: declare that this model's endpoint honors Anthropic | ||
| * `output_config.effort` on the *enabled* thinking path. The provider only | ||
| * emits `output_config.effort` for model names it recognizes (adaptive | ||
| * profiles); third-party Anthropic-compatible endpoints that honor effort |
There was a problem hiding this comment.
Move the effortParam explanation into the module header
This property-level JSDoc introduces a non-header comment in agent-core-v2; move any necessary responsibility context into the top-of-file module header and let the interface name and type express the field itself. The scoped convention requires comments to live solely in that header rather than beside declarations.
AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L17-L20
Useful? React with 👍 / 👎.
| * this so `/thinking` effort levels take effect. budget_tokens is still | ||
| * sent (required by Anthropic's enabled-thinking contract; ignored by z.ai). | ||
| */ | ||
| effortParam?: boolean | undefined; |
There was a problem hiding this comment.
Remove explicit undefined from optional effortParam declarations
Declare this as effortParam?: boolean rather than redundantly adding | undefined, and make the same correction to the newly added declarations in packages/kosong/src/providers/anthropic.ts and packages/oauth/src/managed-kimi-code.ts. Optional properties already represent absence, and the repository explicitly prohibits the expanded form.
AGENTS.md reference: AGENTS.md:L55-L57
Useful? React with 👍 / 👎.
| ...(maxOutputSize !== undefined ? { maxOutputSize } : {}), | ||
| ...(reasoningKey !== undefined ? { reasoningKey } : {}), | ||
| ...(adaptiveThinking !== undefined ? { adaptiveThinking } : {}), | ||
| ...(effortParam !== undefined ? { effortParam } : {}), |
There was a problem hiding this comment.
Pass effortParam directly instead of conditionally spreading it
Forward effortParam directly as an optional property instead of conditionally spreading a one-field object; the analogous new spread in provider-manager.ts should be changed as well. Directly passing undefined is the repository-required representation for absent optional values and avoids duplicating property-presence logic.
AGENTS.md reference: AGENTS.md:L52-L54
Useful? React with 👍 / 👎.
Related Issue
Resolve #2479
Problem
Some Anthropic-compatible providers require the
output_config.effortwire field, but kimi-code never emits it unless the model is recognized as supporting it. Users routing such providers through the Anthropic transport have no way to opt in.What changed
effort_paramopt-in (model config field andKIMI_MODEL_EFFORT_PARAMenv var, mirroringadaptive_thinking/KIMI_MODEL_ADAPTIVE_THINKING) that, when enabled, makes the Anthropic provider emitoutput_config.effort.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.