Skip to content

Call Claude through native API and increase effort - #245

Merged
danielchalmers merged 1 commit into
mainfrom
c/thinking-effort-mudblazor-069b32
Nov 16, 2026
Merged

danielchalmers merged 1 commit into
mainfrom
c/thinking-effort-mudblazor-069b32

Conversation

@danielchalmers

Copy link
Copy Markdown
Owner

Why

Claude models have been running at Anthropic's default effort, which is medium for Haiku 5.5.
AutoTriage sends reasoning_effort: high on 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

  • Requests to api.anthropic.com now go to Claude's own Messages API (/v1/messages), with x-api-key and anthropic-version: 2026-10-21. Every other host still gets Chat Completions.
  • Triage calls send output_config.effort: "xhigh" and enforce the reply schema through output_config.format.
  • max_tokens is 64,000, which Anthropic recommends as the minimum at xhigh so a reply isn't cut off partway through its reasoning.
  • A Claude model that rejects effort, as Haiku 4.5 does, has it left off for the rest of the run, the same way a rejected reasoning_effort already is.
  • A refused or cut-off Claude reply fails only the item. Cached input and thinking tokens are read into the usage stats where the reply reports them.
  • The startup log reads reasoning: xhigh for Claude.
  • The schema note is still appended to Claude's prompt. It was the workaround that made Claude reason longer at medium effort, and removing it is a separate change to measure.
  • No new input and no new dependency.

Verification

  • npm run typecheck, npm run typecheck:test and npm test pass (349 tests), and dist/ is rebuilt.
  • New tests cover the request shape, the text call, dropping a rejected effort, reading text blocks and usage, refusals, a cut-off reply, an empty reply and an overload.
  • No live call was made locally. This pull request's dry run is the first request against the real API.

Residual risk

  • The wording of Anthropic's error for a model that doesn't support effort is a guess. If it doesn't contain "effort", such a model fails each item with a warning instead of retrying without it.
  • Cost at xhigh is unmeasured. In October, high used about 1,100 output tokens per item against about 700 at medium.
  • xhigh was chosen without an eval on the MudBlazor set.
  • danielchalmers/Nuntia copies src/llm/ and tests/llm/, so it needs the paired change.

…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.
@github-actions github-actions Bot added the enhancement New feature or request label Nov 16, 2026
@danielchalmers
danielchalmers requested a balanced review from Copilot November 16, 2026 02:07
@danielchalmers danielchalmers changed the title Call Claude through its Messages API at xhigh effort, so Haiku gets more time to think Call Claude through native API and increase effort Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@danielchalmers
danielchalmers merged commit 5cf8c6e into main Nov 16, 2026
6 checks passed
@danielchalmers
danielchalmers deleted the c/thinking-effort-mudblazor-069b32 branch November 16, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants