# Allow configuring adaptive thinking for Anthropic available_models \(\#57207\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d0a977e6513a7f456c5d451a0ed538c5f2b70784)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d0a977e6513a7f456c5d451a0ed538c5f2b70784

Requested commit: d0a977e6513a7f456c5d451a0ed538c5f2b70784

Commit: d0a977e6513a7f456c5d451a0ed538c5f2b70784

Tree: 9ce26dfdad4ab1839f6577cde3412c892d706c97

Author: zerx-lab

Committer: GitHub

## Message

````
Allow configuring adaptive thinking for Anthropic available_models (#57207)

Split off from #57105 per @maxdeviant's review.

`language_model_core::ModelMode` previously had only `Default` and
`Thinking` variants. As a result, `available_model_to_anthropic_model`
in the Anthropic provider had a dead branch for `AdaptiveThinking` that
was never reachable from settings, and users manually configuring Claude
models via `available_models` could only toggle extended thinking on/off
— they could not opt into adaptive thinking and its
low/medium/high/xhigh/max effort selector. This matters most for users
on third-party Anthropic-compatible proxies, where the `/v1/models`
endpoint may not report a `capabilities` block, leaving
`available_models` as the only path to enable adaptive thinking.

Add an `Adaptive` variant to `ModelMode` and map it to
`AnthropicModelMode::AdaptiveThinking` in the Anthropic provider's
settings conversion. Users can now write:

```json
{
  "language_models": {
    "anthropic": {
      "available_models": [
        {
          "name": "claude-opus-4-7",
          "display_name": "Claude Opus 4.7",
          "max_tokens": 1000000,
          "max_output_tokens": 128000,
          "mode": { "type": "adaptive" }
        }
      ]
    }
  }
}
```

and get the full adaptive-thinking UX in the agent panel.

### Impact on other providers

`ModelMode` is re-exported by Google (`GoogleModelMode`) and OpenRouter.
Both already use non-exhaustive `matches!` checks for `Thinking`, so the
new variant naturally falls through to "no thinking" without compile
breakage. Bedrock defines its own local `ModelMode` enum and is
unaffected. `cargo check --workspace --all-targets` passes.

### Tests

Three new tests in `crates/language_models/src/provider/anthropic.rs`
covering Adaptive / Thinking / Default settings → model mapping:

- `cargo test -p language_models --lib provider::anthropic::`: 3/3
passing.
- `./script/clippy --package language_models --package
language_model_core`: clean.

Release Notes:

- agent: Added support for `"mode": { "type": "adaptive" }` for custom
anthropic to enable adaptive thinking

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
````

## Parents

- [b51f967d8bf80230531615cebdd6e26aefa0ed3e](https://git.cafe/gitcafe/zed/commit/b51f967d8bf80230531615cebdd6e26aefa0ed3e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d0a977e6513a7f456c5d451a0ed538c5f2b70784?format=markdown)
