Tool guides / Anthropic SDK

DocsTool guidesAnthropic SDK

Anthropic SDK

The official Anthropic libraries for Python and TypeScript. Set the base URL to https://intl.acctoken.com, without /v1.

Root URLhttps://intl.acctoken.com+ /v1https://intl.acctoken.com/v1Full paththe whole endpoint, e.g. https://intl.acctoken.com/v1/chat/completions

On this page
  1. Connection details
  2. Set it up
  3. Check it works
  4. Common problems

Before you start

  • An ACCTOKEN API key. Create one on API Keys in the console.
  • Python with pip install anthropic, or Node.js with npm install @anthropic-ai/sdk.

01Connection details

CONNECTION RECORDANTHROPIC SDK
Format
Anthropic Messages
Base URL
https://intl.acctoken.comno /v1
API key
YOUR_API_KEYapi_key sends x-api-key
Model
claude-sonnet-5
Environment
ANTHROPIC_BASE_URLANTHROPIC_API_KEY
LIVE CHECKCommands run on the live APIEvery command on this page is run against intl.acctoken.com before it is published.ACCTOKEN DOCS DESK

02Set it up

Set the base URL without /v1. The SDK adds /v1/messages itself.

from anthropic import Anthropic client = Anthropic( base_url="https://intl.acctoken.com", api_key="YOUR_API_KEY",) msg = client.messages.create( model="claude-sonnet-5", max_tokens=1024, messages=[{"role": "user", "content": "Say hello in one word."}],)print("".join(block.text for block in msg.content if block.type == "text"))
Install with pip install anthropic.

Good to know

  • max_tokens is required on every request.
  • api_key is sent as x-api-key. To send a Bearer token instead, pass auth_token (Python) or authToken (TypeScript).
  • Prompt caching works on Claude models: cache_control blocks are passed through unchanged.
  • The Messages format also works with the DeepSeek, Qwen, GLM, Kimi, MiniMax and MiMo models. GPT and Gemini models do not accept it.

03Check it works

With the two environment variables set, run:

python -c "import anthropic; print(anthropic.Anthropic().messages.create(model='claude-sonnet-5', max_tokens=16, messages=[{'role': 'user', 'content': 'Reply with exactly: OK'}]).content[0].text)"
Expected outputOK

Common problems

404

Invalid URL (POST /v1/v1/messages)

Remove /v1 from the base URL.

401

Invalid token

Check the key you pass as api_key, or ANTHROPIC_API_KEY.

404

No available channel for model … (distributor)

Use a model ID from the Models page.

Something else? Look up the exact message in Errors.