Sozdai LogoDocs
Integrations/Claude Code

Claude Code Integration

Claude Code is Anthropic's official CLI coding agent. Sozdai exposes an Anthropic-compatible Messages API, so you can point Claude Code at Sozdai and use real Claude models at lower cost — no code changes needed.

#How it works

Claude Code talks to the Anthropic Messages API. Setting three environment variables — base URL, auth token, and an empty API key — points every request at the Sozdai API, which serves it and bills your Sozdai balance.

Why ANTHROPIC_API_KEY must be empty

If ANTHROPIC_API_KEY is set, Claude Code sends requests straight to Anthropic and ignores your base URL. Always set it to an empty string.

#Prerequisites

1

Install Node.js 18+

Claude Code needs Node.js 18 or newer.

2

Install Claude Code

bash
npm install -g @anthropic-ai/claude-code
3

Get a Sozdai API key

Create an API key on the API Keys page in your console. It starts with sk-corr- and is used as ANTHROPIC_AUTH_TOKEN below.

#Setup by operating system

Pick your OS and follow the steps. Replace sk-corr-... with your real API key.

1

Open your shell profile

macOS uses zsh by default. Open ~/.zshrc in an editor:

bash
nano ~/.zshrc
2

Add the configuration

bash
# ~/.zshrc
export ANTHROPIC_BASE_URL="https://api.sozdai.ai"
export ANTHROPIC_AUTH_TOKEN="sk-corr-..."
export ANTHROPIC_API_KEY=""
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-8"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
3

Reload the profile

Apply it without reopening the terminal:

bash
source ~/.zshrc

#Model mapping

Claude Code has three model roles. Map each to a Sozdai model name via these variables (already included in the setup above):

RoleEnvironment variableSozdai model
Main (Opus)ANTHROPIC_DEFAULT_OPUS_MODELclaude-opus-4-8
Default (Sonnet)ANTHROPIC_DEFAULT_SONNET_MODELclaude-sonnet-4-6
Background (Haiku)ANTHROPIC_DEFAULT_HAIKU_MODELclaude-haiku-4-5

These are required

Claude Code's built-in model IDs may not exist on Sozdai. Without these overrides, requests fail with model_not_found. See the Models page for the full list of available names.

#Cheaper models (DeepSeek / Kimi)

You don't have to use Claude. DeepSeek and Kimi cost a small fraction of Claude's price and work fully inside Claude Code — including tool calls (file edits, running commands) and extended thinking. Just point the overrides at them:

Change these lines in your ~/.zshrc or ~/.bashrc, then reload:

bash
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="kimi-k2.6"

Mix and match

Set each role independently — e.g. DeepSeek for the main model and Kimi for the fast background role, or keep Opus on real Claude and only make Sonnet/Haiku cheaper. Compare prices on the Models page.

Which models work with Claude Code

Claude, DeepSeek and Kimi are fully supported. Gemini is not yet compatible with Claude Code — use it through the standard /v1/chat/completions endpoint instead.

#Verify

Start Claude Code and run /status. Confirm the API Base URL points at Sozdai and the auth token is set. Then just code as usual.

bash
claude
# then, inside Claude Code:
/status

#Troubleshooting

SymptomFix
Requests still go to AnthropicANTHROPIC_API_KEY is not empty — set it to "" and restart the terminal.
model_not_foundSet the ANTHROPIC_DEFAULT_*_MODEL variables to Sozdai model names.
401 invalid api keyANTHROPIC_AUTH_TOKEN is wrong or not an sk-corr- key.
402 insufficient balanceTop up your Sozdai balance on the Billing page.