Connect your tools

Claude Code

Point Claude Code at the Kontinent AI Messages endpoint with two environment variables, choose a Claude model and make sure that the connection works.

Or let your agent do it

Paste the prompt into your coding agent. The agent writes the configuration and tests it.

Claude Code sends Anthropic Messages requests. Kontinent AI serves that format at https://api.kontinentai.com/v1/messages, so Claude Code needs only a new base URL and a new key.

Before you start, make sure that you have:

  • Claude Code, installed.
  • A Kontinent AI key. See Quickstart.
  • Balance from a top-up or a redemption code. The starter balance does not accept prompts of this size.

1. Set the variables

Put these lines in your shell profile, for example ~/.zshrc or ~/.bashrc:

export ANTHROPIC_BASE_URL="https://api.kontinentai.com"
export ANTHROPIC_AUTH_TOKEN="sk-kont-..."
export ANTHROPIC_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"

Do not add /v1 to ANTHROPIC_BASE_URL. Claude Code adds /v1/messages to the base URL.

VariableWhat it does
ANTHROPIC_BASE_URLSends the requests of Claude Code to Kontinent AI
ANTHROPIC_AUTH_TOKENYour Kontinent AI key. Claude Code sends it in the Authorization: Bearer header
ANTHROPIC_MODELThe model for the session. You can change it with the /model command
ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODELThe models that the opus and sonnet names select
ANTHROPIC_DEFAULT_HAIKU_MODELThe model for background tasks, for example session titles. Set it to a model that we serve

2. Make sure that the connection works

Send one small request with curl:

curl -sS -w '\n%{http_code}\n' -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-haiku-4-5-20251001", "max_tokens": 16, "messages": [{"role": "user", "content": "Say OK."}]}'

A response that starts with {"id":"msg_ and ends with 200 shows that the key and the URL are correct. A 401 shows that we did not accept the key.

Then do these steps:

  1. Start Claude Code from the same shell: claude.
  2. Type /status.
  3. Make sure that Anthropic base URL shows https://api.kontinentai.com.
  4. Send a short prompt. Claude Code shows the answer.

Use a settings file

The variables in your shell apply only to programs that you start from that shell. To apply them everywhere that Claude Code runs, put them in the env block of ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.kontinentai.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-kont-...",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001"
  }
}

Models

You can use these Claude models with Claude Code. This list comes from our model catalogue:

  • claude-opus-5-5
  • claude-opus-5
  • claude-sonnet-5-5
  • claude-sonnet-5
  • claude-haiku-4-5-20251001
  • claude-fable-5-1
  • glm-5.3
  • deepseek-v4.1-flash

To show these models in the /model list, set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1. Claude Code then reads our GET /v1/models endpoint when it starts.

Costs and limits

  • Claude Code streams its responses. A streamed Messages response does not include our kontinent cost block. We record the cost of each request, and the dashboard shows it.
  • Each request counts toward the limit of 60 requests a minute for each key. This includes the count_tokens requests that Claude Code sends. We do not charge for count_tokens.
  • A request that fails before the answer starts does not cost money. See Reliability.

Problems

ProblemWhat to do
401Make sure that the key starts with sk-kont- and that you did not revoke it
402Your balance is too low. Top up on the balance page
403 with STARTER_BALANCE_ONLYYour account has only the starter balance. Top up on the balance page
400 that names context_management or says Extra inputs are not permittedSet CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. This stops the test features of Claude Code
404 that names a modelSet the model variables above to models from the list on this page
429Too many requests. Wait for the time in the Retry-After header

The Claude Code documentation for gateways is at code.claude.com.