Authentication & Base URL
This page is the single source of truth for Base URLs and authentication across the site; other pages only reference it.
The mental model
One API Key covers every vendor. Integrating with any SDK usually means changing just two things: base_url and api_key.
Only two details really need care — whether the Base URL includes /v1, and which auth header to use.
Base URL
Two official domains, both pointing at the same service:
| Domain | Status |
|---|---|
https://api.smartwan.com | Currently available; all examples use this |
https://api.tokenroute.com | The permanent domain, not yet enabled; once live both serve in parallel, with no need to change your API Key |
Endpoint paths
A complete request URL consists of the gateway domain and an endpoint path.
| Protocol | Endpoint path |
|---|---|
| OpenAI-compatible | /v1/chat/completions, /v1/models |
| Anthropic Messages | /v1/messages |
| Google Gemini | /v1beta/models/{model}:generateContent |
| Responses API | /v1/responses |
| Image generation / editing | /v1/images/generations, /v1/images/edits |
Set Base URL for your client
Clients append paths differently: not every SDK takes /v1 in its Base URL. With curl, use the complete request URL.
| Verified client | Base URL | Configuration |
|---|---|---|
| OpenAI Python SDK 3.17.0 | https://api.smartwan.com/v1 | api_key; Chat Completions tested |
| Anthropic Python SDK 1.7.0 | https://api.smartwan.com | api_key; the SDK appends /v1/messages |
| Google GenAI Python SDK 2.24.0 | https://api.smartwan.com | Set api_version="v1beta" |
| Codex CLI 0.155.1 | https://api.smartwan.com/v1 | wire_api="responses"; env_key is an environment variable name |
| Claude Code 2.1.278 | https://api.smartwan.com | ANTHROPIC_AUTH_TOKEN |
Each configuration completed a minimal live call with a test key on 2026-09-22. Verify other versions, clients and models separately.
Adding /v1 to Anthropic's Base URL produces /v1/v1/messages. When Google GenAI explicitly uses v1beta, do not also add /v1beta to the Base URL. OpenAI Python does not automatically add /v1 to a root URL.
Authentication
Use the same TokenRoute API Key in these headers:
| Protocol | Header |
|---|---|
| OpenAI-compatible / Responses | Authorization: Bearer sk-your-token |
| Anthropic Messages | x-api-key: sk-your-token, or Authorization: Bearer sk-your-token |
| Google Gemini | x-goog-api-key: sk-your-token |
Both Messages options succeeded with the same minimal claude-haiku-4-5 request. Anthropic Python's api_key sends x-api-key; Claude Code's ANTHROPIC_AUTH_TOKEN sends Bearer. Select one configuration method for your client.
Keep anthropic-version: 2023-06-01 in Anthropic requests, as in the examples and verified SDK. Diagnose authentication failures using the response, key status and permissions, rather than the header name alone.
Choose a protocol
Minimal Chat Completions calls succeeded with GPT, Claude, Gemini, DeepSeek, GLM, Kimi and MiniMax text models. Representative Claude, DeepSeek, GLM, Kimi and MiniMax models passed Messages calls. Representative GPT models passed Responses calls, and Gemini models passed native calls.
Success on one endpoint does not establish support for other endpoints or advanced parameters. See Vendor differences for the tested scope.
Next steps
- First Call — minimal requests and successful responses
- Models — model names, endpoints and billing guidance