Connect Claude Code with Zeldoc.ai
Claude Code is Anthropic's terminal-based coding agent.
It talks to models over the Anthropic Messages API, and Zeldoc.ai serves that API at
/v1/messages. That means you can point Claude Code at Zeldoc.ai the same way you would
point it at an LLM gateway, and use ZDev or any other model from your Zeldoc.ai model list.
Prerequisites
- Claude Code installed on your machine
- A Zeldoc.ai API key — see Generate an API key
Configure Claude Code
Claude Code reads three environment variables to route requests to Zeldoc.ai:
| Variable | Value | Purpose |
|---|---|---|
ANTHROPIC_BASE_URL | https://api.zeldoc.ai | Where to send requests |
ANTHROPIC_AUTH_TOKEN | Your Zeldoc.ai API key | Sent as Authorization: Bearer |
ANTHROPIC_MODEL | zdev[1m] | Which model to use |
/v1 in the base URLClaude Code appends /v1/messages to the base URL itself. Use https://api.zeldoc.ai,
not https://api.zeldoc.ai/v1 — otherwise requests go to /v1/v1/messages and fail.
zdev[1m]?Claude Code doesn't know the ZDev model, so it assumes a 200k-token context window and
compacts your conversation early. Appending [1m] tells Claude Code the model has a 1M
context window; the suffix is stripped before the request is sent to Zeldoc.ai. You can
also set CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000 instead of using the suffix.
Try it from the shell
For a first test, export the variables in a terminal and start Claude Code from the same shell:
export ANTHROPIC_BASE_URL=https://api.zeldoc.ai
export ANTHROPIC_AUTH_TOKEN=your-api-key
export ANTHROPIC_MODEL="zdev[1m]"
claude
Shell exports only apply to that terminal session. Once it works, move the configuration to a settings file so it applies everywhere Claude Code runs.
Persist it in a settings file
Add an env block to ~/.claude/settings.json (on Windows,
%USERPROFILE%\.claude\settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.zeldoc.ai",
"ANTHROPIC_AUTH_TOKEN": "your-api-key",
"ANTHROPIC_MODEL": "zdev[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "zdev",
"CLAUDE_CODE_SUBAGENT_MODEL": "zdev[1m]"
}
}
The two extra variables keep everything on Zeldoc.ai:
ANTHROPIC_DEFAULT_HAIKU_MODEL— Claude Code uses itshaikualias for background work such as generating session titles. Pointing the alias at ZDev keeps those requests on the same model instead of trying to resolve a Claude model name.CLAUDE_CODE_SUBAGENT_MODEL— Subagents spawned by Claude Code use this model.
Put the env block in your user settings (~/.claude/settings.json) or in a project's
.claude/settings.local.json. Don't put your API key in a project's .claude/settings.json
— that file is committed and shared with everyone who clones the repository.
Use other Zeldoc.ai models
Nothing in this setup is specific to ZDev. Any model ID from your Zeldoc.ai model list
works, including the models served through the router — see
list your available models. Switch models by changing
ANTHROPIC_MODEL, or per session:
claude --model zdev-2
Inside a session, /model <model-id> switches as well. Model IDs that Claude Code doesn't
recognise trigger a one-line warning at startup about missing model metadata. That
warning is expected and harmless.
Verify the connection
Start Claude Code and run /status. The Status tab should show:
- a base URL line pointing at
https://api.zeldoc.ai - an Auth token line naming
ANTHROPIC_AUTH_TOKEN
Then send any prompt. A normal reply confirms Zeldoc.ai is serving your requests. If the
request fails with 401, double-check the API key; if it fails with a 404, check that
the base URL has no /v1 suffix.
Things to know
- Your claude.ai subscription is not used while
ANTHROPIC_AUTH_TOKENis set. All requests go to Zeldoc.ai and count against your Zeldoc.ai key. Unset the variable (or remove theenvblock) to return to your claude.ai login. - Some claude.ai features are unavailable with a gateway credential active, including Remote Control, voice dictation, and claude.ai connectors. Claude Code prints a notice about this at startup.
- The Claude Code desktop app reads gateway settings from its own third-party
inference configuration, not from
settings.json. The setup above applies to the CLI and the IDE extensions launched from a shell with these variables set. - Anthropic does not officially support non-Claude models through a gateway. ZDev works well with Claude Code in our testing, but model-specific features such as extended thinking depend on the model you choose.