You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 433c1fd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(ai): take Claude thinking off support from Anthropic's models.dev entry (#12489)
Fixes#12429.
## Problem
Claude Opus 5.5 and Sonnet 5.5 reject `thinking: {type: "disabled"}` on
every host. pi's catalog only marked "off" unsupported through
hand-written per-provider lists (`claude55ThinkingLevels()`,
`DISABLED_THINKING_MODELS`, a Fable substring rule). Hosts the lists
missed still offered "off", and `anthropic-messages` sent `disabled`:
```
pi -p --provider github-copilot --model claude-sonnet-5.5 --thinking off "hi"
400 ... To turn thinking off on this model, send "thinking": {"type": "between_tools"} instead of {"type": "disabled"} ...
```
Affected: GitHub Copilot (Sonnet 5.5), Cloudflare AI Gateway and Vercel
AI Gateway (Opus 5.5, Sonnet 5.5).
models.dev already records this. On Anthropic's own entries,
`capabilities.reasoning.toggle` is set on every Claude model that can
turn thinking off and is absent on Opus 5.5, Sonnet 5.5, and Fable 5.x.
Hosts such as Copilot, OpenCode, and Cloudflare list no toggle on any
Claude model, so the host entry cannot decide it.
## Fix
One Claude family rule (`catalog/families/anthropic.ts`) marks `off:
null` when Anthropic's own models.dev entry for the model has no
thinking toggle. Every host uses it. The model is found through
models.dev's `canonical_id` (newly normalized in
`sources/models-dev.ts`). For hosts not built from models.dev
(OpenRouter, Vercel, Radius), it falls back to the host's spelling of
Anthropic's id: dotted, `anthropic/`-prefixed, or with a
`-batch`/`-fast` suffix.
It replaces `DISABLED_THINKING_MODELS` and the `off` part of
`claude55ThinkingLevels()` (now `CLAUDE_55_THINKING_LEVELS`). The Fable
`off: null` rule moves onto the authored `claude-fable-5-2` (used only
when models.dev does not list it). New Claude models get the right "off"
once models.dev lists them for Anthropic.
`between_tools` is not used. Live on Copilot it is accepted only by
Sonnet 5.5; Opus 5.5, Haiku 5.5, Sonnet 5, and Haiku 4.5 reject it.
## Catalog diff (`npm run diff:model-catalog` against main)
Only additions of `"off": null`, on Opus 5.5 and Sonnet 5.5:
- `github-copilot/claude-sonnet-5.5`
- `cloudflare-ai-gateway/claude-{opus,sonnet}-5-5`
- `vercel-ai-gateway/anthropic/claude-{opus,sonnet}-5.5` and their
`-batch`/`-fast` variants
- `amazon-bedrock/*claude-{opus,sonnet}-5-5`. Bedrock never sent
`disabled`; "off" there sent no thinking field and silently used the
model's default. Now it is clamped like everywhere else.
Anthropic, OpenRouter, OpenCode, and Radius are unchanged, so the rule
matches the lists it replaces. The change is catalog-only and works with
released clients.
## Testing
- `test/claude-model-generation.test.ts` generates the catalog from
mocked models.dev data: Copilot entries follow Anthropic's toggle, a
Bedrock id resolves only through `canonical_id`, and the authored Fable
5.2 keeps `off` unsupported without models.dev data. Each case fails
without the code it covers.
- `test/github-copilot-anthropic.test.ts`: Copilot Sonnet 5.5 does not
offer "off".
- Live on Copilot with `--thinking off`: Sonnet 5.5 and Opus 5.5 now
succeed at the lowest offered level (1.6.0 returns 400). Haiku 5.5 and
Sonnet 5 still run with thinking off.
Copy file name to clipboardExpand all lines: packages/ai/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@
37
37
- Fixed the model catalog still listing `gpt-5-chat-latest` for `openai` and `azure` after OpenAI shut it down on July 23, 2026 ([#12202](https://github.com/earendil-works/pi/issues/12202))
38
38
- Fixed `openai-completions` dropping OpenRouter's `native_finish_reason`, the upstream provider's own finish reason. `rawStopReason` now records it next to `finish_reason`, e.g. `stop.MALFORMED_RESPONSE`, and error messages include it, e.g. `Provider finish_reason: error (native_finish_reason: MALFORMED_FUNCTION_CALL)`. Stop reasons are unchanged ([#11931](https://github.com/earendil-works/pi/issues/11931))
39
39
- Fixed GitHub Copilot listing classifier models the account cannot use, such as `microsoft-decision-1` on accounts whose plan does not include it, where every call failed with HTTP 400. After OAuth login or the next token refresh, only the decision models in the account's Copilot model catalog are listed ([#12395](https://github.com/earendil-works/pi/issues/12395))
40
+
- Fixed HTTP 400 with thinking `off` on Claude Sonnet 5.5 through GitHub Copilot, and on Claude Opus 5.5 and Sonnet 5.5 through Cloudflare AI Gateway and Vercel AI Gateway, which reject `thinking: {type: "disabled"}`. The catalog now takes whether a Claude model can turn thinking off from the thinking toggle on Anthropic's own models.dev entry, for every host that serves it, and selecting `off` on those models uses the lowest supported level ([#12429](https://github.com/earendil-works/pi/issues/12429))
0 commit comments