Repository navigation
Call Claude through native API and increase effort - #245
Merged
Merged
Conversation
…ore time to think Claude's Chat Completions layer ignores reasoning_effort, which left Haiku at its default medium effort. Requests to api.anthropic.com now go to /v1/messages with output_config.effort set to xhigh and the reply schema enforced there. A Claude model that rejects effort has it left off for the rest of the run.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to the live provider protocol and action-authorization effort need human review to confirm production-schema compatibility and assess xhigh cost and decision quality without live-call or policy-evaluation validation.
No open issues 🎉
What changed in this PR
Updates AutoTriage’s model client to call Claude through Anthropic’s native Messages API, enabling xhigh effort for triage while preserving Chat Completions for other hosts.
Changes:
- Adds Claude-specific authentication, structured output, and a 64,000-token output limit.
- Handles rejected effort settings, refusals, truncated replies, and Claude usage reporting.
- Expands mocked client tests and updates documentation and comments for the native API path.
| File | Description |
|---|---|
tests/llm/chat.test.ts |
Tests native Claude requests, effort fallback, reply parsing, usage, and failures. |
src/stats.ts |
Clarifies the comment about missing reasoning-token counts; no behavior change. |
src/llm/endpoint.ts |
Updates the endpoint interface comment to include the Messages API. |
src/llm/chat.ts |
Implements Claude’s native transport, effort settings, response handling, and usage parsing. |
AGENTS.md |
Documents host-based protocol selection and Claude’s effort setting. |
Review effort: Balanced
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.
Why
Claude models have been running at Anthropic's default effort, which is
mediumfor Haiku 5.5.AutoTriage sends
reasoning_effort: highon every triage call, but Claude was reached through Anthropic's Chat Completions layer, and its docs list that parameter as ignored.MudBlazor's policy is long, and wrong actions there are frequent enough that Haiku should get more time to think.
What
api.anthropic.comnow go to Claude's own Messages API (/v1/messages), withx-api-keyandanthropic-version: 2026-10-21. Every other host still gets Chat Completions.output_config.effort: "xhigh"and enforce the reply schema throughoutput_config.format.max_tokensis 64,000, which Anthropic recommends as the minimum atxhighso a reply isn't cut off partway through its reasoning.effort, as Haiku 4.5 does, has it left off for the rest of the run, the same way a rejectedreasoning_effortalready is.reasoning: xhighfor Claude.Verification
npm run typecheck,npm run typecheck:testandnpm testpass (349 tests), anddist/is rebuilt.effort, reading text blocks and usage, refusals, a cut-off reply, an empty reply and an overload.Residual risk
effortis a guess. If it doesn't contain "effort", such a model fails each item with a warning instead of retrying without it.xhighis unmeasured. In October,highused about 1,100 output tokens per item against about 700 at medium.xhighwas chosen without an eval on the MudBlazor set.src/llm/andtests/llm/, so it needs the paired change.