How to use Claude Sonnet 4.6 in Zed
Zed is one of the fastest code editors around, and its built-in assistant panel makes pair-programming with a large language model feel native. If you want Claude Sonnet 4.6 — Anthropic's strong, well-balanced coding model — driving that panel, this guide walks you through the full setup using a single OpenAI-compatible endpoint.
Why route Claude through an OpenAI-compatible endpoint
Zed speaks several provider dialects, including an OpenAI-compatible mode. That mode is the easiest path when you want one API key to reach many models instead of juggling separate Anthropic, Google, and OpenAI accounts.
With AnyModel, the base URL https://anymodel.org/v1 exposes Claude, GPT, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok behind a single key. Switching from Claude Sonnet 4.6 to another model later means changing one string — the model id — and nothing else. Browse the full list on the models page if you want to compare options.
Step 1: Get your API key
Sign up and grab a key first. You start with 1,000,000 free tokens, and linking Telegram brings the total to 6,000,000 — no credit card required. After that it's pay-per-token, with no subscription and no minimums.
Keep the key handy; you'll paste it into Zed's settings in a moment.
Step 2: Configure Zed
Zed is configured through a JSON settings file. Open it with the command palette (cmd-shift-p / ctrl-shift-p) and run zed: open settings, or edit ~/.config/zed/settings.json directly.
Add an OpenAI-compatible provider that points at AnyModel:
{
"language_models": {
"openai": {
"api_url": "https://anymodel.org/v1",
"available_models": [
{
"name": "claude-sonnet-4-6",
"display_name": "Claude Sonnet 4.6",
"max_tokens": 200000
}
]
}
}
}
The name field is the model id sent on every request — this is the one value you change to swap models. The api_url overrides Zed's default OpenAI host so requests go to AnyModel instead.
Note: the AnyModel one-line installer only supports the codex, claude, opencode, and hermes CLIs. Zed is not one of them, so the manual setup above is the correct approach.
Step 3: Add the key and reload
In the assistant panel, open the provider configuration and paste your AnyModel API key for the OpenAI provider. Alternatively, set it as an environment variable before launching Zed:
export OPENAI_API_KEY="<YOUR_API_KEY>"
Reload the window (workspace: reload from the command palette) so Zed picks up the new provider. Open the assistant panel, select Claude Sonnet 4.6 from the model dropdown, and send a test prompt.
Step 4: Use it for real work
Once connected, Claude Sonnet 4.6 works across Zed's AI features:
| Feature | What it does |
|---|---|
| Assistant panel | Chat about code, paste errors, plan refactors |
| Inline assist | Edit a selection in place with ctrl-enter |
| Slash commands | Pull files, terminal output, or diagnostics into context |
Sonnet 4.6 is a good default for day-to-day coding: quick enough for inline edits, capable enough for multi-file reasoning. For heavier architecture work you can flip to a larger model by editing that one model id.
Picking the right model
Not sure whether Sonnet 4.6 is the best fit for your workload or budget? The compare page lays out models side by side so you can weigh capability against per-token cost before committing.
A note on privacy
By default, requests pass through normally. If you'd rather not have prompts and responses stored on our side, enable Ghost Mode — opt-in, zero-retention keys that keep only a token counter. Be clear-eyed about what that means: the model provider still receives your prompt to generate a response, so this isn't absolute privacy — it's about what AnyModel retains.
Troubleshooting quick hits
- 401 errors: the key didn't load. Re-paste it in the provider config or check your environment variable.
- Model not found: confirm the
nameis exactlyclaude-sonnet-4-6and thatapi_urlends in/v1. - No response in the panel: reload the window so Zed re-reads
settings.json.
For more setup guides across editors and CLIs, see the blog.
Get started
One key, one endpoint, every major model — including Claude Sonnet 4.6 right inside Zed. Create your free account, grab your key, and start coding in a couple of minutes.
AnyModel