Skip to main content
Two providers with their own request surfaces. Both work through the same Toolken gateway URL; the difference is in how the SDK connects.

Anthropic

Anthropic’s SDK talks to /v1/messages, not /v1/chat/completions. The gateway supports the native Anthropic Messages API at that path. Set the base URL to https://gateway.toolken.ai (no /v1 suffix). The Anthropic SDK appends /v1/messages automatically.

Two keys for Anthropic

The Anthropic SDK injects x-api-key from its api_key parameter. Toolken reads X-Toolken-Key separately and forwards x-api-key unchanged.
The Anthropic SDK also injects an Authorization: Bearer header in some versions. Toolken forwards it unchanged alongside x-api-key.

Provider detection for Anthropic

Any request to /v1/messages routes to Anthropic automatically. A model name starting with claude- also triggers auto-detection to Anthropic. You do not need X-Toolken-Provider for Anthropic unless you are sending to a path other than /v1/messages (for example, /v1/models). Setting the header selects the provider but does not bypass path validation: Anthropic only supports /v1/messages and /v1/models.

Gemini

Gemini has its own native API format, but you do not need to use it here. The gateway accepts a standard OpenAI-compatible request at /v1/chat/completions, translates it to Gemini’s format, and maps the response back. You use the OpenAI SDK pointed at the Toolken gateway. Your Gemini API key goes in Authorization: Bearer (the OpenAI SDK convention). The gateway forwards it to Google as x-goog-api-key.

How translation works

The gateway rewrites the OpenAI-compatible request to Gemini’s generateContent format before forwarding, and maps the response back to an OpenAI-compatible shape. You get a standard chat.completions response. The translation happens transparently.

Provider detection for Gemini

Model names starting with gemini- are auto-detected. No X-Toolken-Provider header needed.
There is no separate Gemini-native endpoint on the Toolken gateway. Use /v1/chat/completions with a gemini- model name.

Next

Providers Overview

All 13 providers and the BYOK model.

Choose a Provider

Detection order and when to use X-Toolken-Provider.