Skip to main content
The Anthropic SDK connects to Claude’s native Messages API. Set the base URL to https://gateway.toolken.ai (no /v1 suffix — the SDK appends /v1/messages itself) and add X-Toolken-Key as a default header.
The base URL for the Anthropic SDK is https://gateway.toolken.ai with no /v1 at the end. The SDK appends /v1/messages automatically. Adding /v1 yourself will cause routing errors.
1

Get your keys

You need two keys:Toolken forwards your Anthropic key verbatim and never stores it.
2

Configure the client

X-Toolken-Metadata-Agent takes any string. Use one value per agent or workflow you want to track separately in the dashboard. Any X-Toolken-Metadata-* header becomes a groupable dimension automatically.
3

Attribute by customer (optional)

Add X-Toolken-Metadata-Customer-Id to track spend per end-user or organization:
4

See your cost

Within seconds your request appears in the dashboard, grouped by agent and customer. The response body is identical to calling Anthropic directly — Toolken is a transparent proxy.

Streaming

The Anthropic SDK’s streaming API works without any changes:

How the two keys travel

The Anthropic SDK injects your key as x-api-key. Toolken reads X-Toolken-Key separately and forwards x-api-key unchanged.

Provider detection

Any request to /v1/messages routes to Anthropic automatically. A model name starting with claude- also triggers auto-detection. You do not need an X-Toolken-Provider header.

Next

Custom Properties

All attribution headers and how metadata keys become dashboard dimensions.

OpenAI SDK

Use OpenAI and OpenAI-compatible models through Toolken.

Gemini SDK

Use Gemini models through Toolken via the OpenAI-compatible path.

Anthropic and Gemini

Provider routing details for Anthropic and Gemini.