How to use GPT-5.2 Codex in Zed
Zed is a fast, Rust-built editor with native AI features baked into the editing surface. GPT-5.2 Codex is a strong model for code generation, refactoring, and multi-file edits. This guide shows how to wire the two together using a single OpenAI-compatible endpoint, so you can prompt, edit inline, and run agentic tasks without juggling provider accounts.
Why route through an OpenAI-compatible endpoint
Zed speaks the OpenAI API format. That means any gateway exposing /v1/chat/completions works as a custom provider. AnyModel gives you one base_url and one API key that reaches GPT-5.2 Codex alongside Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. Switching models is just changing the model id in your config — nothing else moves.
You also start free: 1,000,000 tokens on signup, and a total of 6,000,000 if you link Telegram. No credit card. After that it's pay-per-token with no subscription and no minimums.
Step 1: Get your API key
Create an account, then copy your key from the dashboard. Hold onto it — you'll paste it into Zed's settings next.
If you also use a terminal coding agent like Codex CLI or Claude Code, the one-line installer handles them directly:
bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>
Zed itself is not covered by that installer, so for the editor you'll do a quick manual setup below.
Step 2: Add AnyModel as a custom provider in Zed
Open Zed's settings (Cmd/Ctrl + , opens settings.json) and add an OpenAI-compatible provider. Zed lets you define custom endpoints under the language model settings:
{
"language_models": {
"openai": {
"api_url": "https://anymodel.org/v1",
"available_models": [
{
"name": "gpt-5.2-codex",
"display_name": "GPT-5.2 Codex",
"max_tokens": 200000
}
]
}
}
}
Then set the API key. In Zed, open the Assistant panel, choose the OpenAI provider, and paste your AnyModel key when prompted. Zed stores it securely rather than in plain settings.json. Because the api_url points at AnyModel, your "OpenAI" provider now resolves GPT-5.2 Codex through the gateway.
Tip: confirm the exact model id on the models page. Use that string verbatim in
name— the gateway routes by id.
Step 3: Verify the connection
Before trusting it inside the editor, a quick curl confirms the key and model resolve:
curl https://anymodel.org/v1/chat/completions \
-H "Authorization: Bearer $ANYMODEL_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.2-codex","messages":[{"role":"user","content":"Reply with OK"}]}'
A clean JSON response means Zed will work too.
Step 4: Use it while coding
With the provider live, you get the full Zed AI surface backed by GPT-5.2 Codex:
| Feature | How to trigger | Good for |
|---|---|---|
| Inline assist | Select code, Ctrl + Enter |
Targeted edits, fixing a function |
| Assistant panel | Open the AI panel | Multi-file reasoning, planning |
| Slash commands | / in the panel |
Pulling in file or symbol context |
Because every model lives behind the same key, you can keep GPT-5.2 Codex for implementation work and switch the model id to a different model for a second opinion. If you want to compare strengths and pricing before committing, the compare page lays them side by side.
A note on privacy
Standard requests are processed normally. If you'd rather your prompts and responses not be stored on our side, enable Ghost Mode — opt-in zero-retention keys that keep only a token counter. Be honest with yourself about the limits: the model provider still receives your prompt, so this isn't absolute privacy, just no retention on the gateway.
Troubleshooting
- 401 / unauthorized: the key didn't save in Zed. Re-enter it in the Assistant settings, not raw JSON.
- Model not found: the
namedoesn't match a real id. Recheck it on /models. - Empty completions: confirm
api_urlends in/v1with no trailing slash issues.
For more setup walkthroughs across editors and CLIs, browse the blog.
Start building
One key, every model, GPT-5.2 Codex in Zed in about five minutes. Create your free account and start with a million tokens — no card required.
AnyModel