Setting Up Claude Code¶
What to Use¶
For Claude Code, the primary Nexus endpoint is:
POST /v1/messages
Token counting is also supported:
POST /v1/messages/count_tokens
Environment Variables¶
The simplest option:
export ANTHROPIC_BASE_URL="https://api.nexus-hub.ru"
export ANTHROPIC_AUTH_TOKEN="your_nexus_key"
After that, Claude Code will send requests through Nexus.
Pick the model only from the GET /v1/models response for your key.
Direct HTTP Call¶
For Claude-compatible integrations, you can also call the API directly:
curl https://api.nexus-hub.ru/v1/messages \
-H "x-api-key: YOUR_NEXUS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-6","max_tokens":128,"messages":[{"role":"user","content":"ping"}]}'
Authorization: Bearer <key> and api-key: <key> are also supported.
Recommended Model¶
A good default option:
claude-sonnet-4-6
If your key has access to other Claude models, they will appear in GET /v1/models.
What to Check If It Does Not Work¶
- There are no old
ANTHROPIC_*variables in the environment. - The key was copied without extra spaces.
- The model appears in
GET /v1/models. - The base URL is
https://api.nexus-hub.ru, without/v1.