Connect your tools

Anthropic SDK

Set the base URL and the key in the Anthropic Python or Node SDK, and send Messages requests to Claude models through Kontinent AI.

Or let your agent do it

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

The Anthropic SDKs send Messages requests. Kontinent AI serves that format at https://api.kontinentai.com/v1/messages. Change two settings: the base URL and the key.

1. Install the SDK

pip install anthropic
npm install @anthropic-ai/sdk

2. Set the base URL and the key

Use https://api.kontinentai.com as the base URL, with no /v1. The SDK adds /v1/messages.

import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["KONTINENT_API_KEY"],
    base_url="https://api.kontinentai.com",
)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.KONTINENT_API_KEY,
  baseURL: "https://api.kontinentai.com",
});

The SDK sends the key in the x-api-key header. Our API accepts it there.

The SDKs also read two environment variables. If you set them, you can call Anthropic() with no arguments:

export ANTHROPIC_BASE_URL="https://api.kontinentai.com"
export ANTHROPIC_API_KEY="$KONTINENT_API_KEY"

3. Send a message

message = client.messages.create(
    model="claude-haiku-4-5-20251001",
    max_tokens=256,
    messages=[{"role": "user", "content": "Name three long rivers."}],
)
print(message.content[0].text)
print(message.model_extra["kontinent"])
const message = await client.messages.create({
  model: "claude-haiku-4-5-20251001",
  max_tokens: 256,
  messages: [{ role: "user", content: "Name three long rivers." }],
});
console.log(message.content[0].text);
console.log(message.kontinent);

If the program prints an answer and a kontinent block with cost_usd, the connection works.

Models

These models work on /v1/messages. 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

What we send to the model

We send your request body to the model as you wrote it. We change only the model field, and on the starter balance, the max_tokens field. We also send the anthropic-version and anthropic-beta headers.

  • Prompt cache. cache_control markers go to the model. A cache read costs the cached input price, and a cache write costs the cache write price. See Prompt cache.
  • Token counts. client.messages.count_tokens() works. We do not charge for it. If the model cannot count the tokens, we send an estimate, and the response has the header x-kontinent-estimated: true.
  • Streams. client.messages.stream() works. A streamed response does not include our kontinent block. We record the cost of each request, and the dashboard shows it.