Overview
Quickstart
TokSpan is OpenAI-compatible — change the base URL to access 200+ models instantly. Claude Code / Anthropic-native, Gemini, and the OpenAI Responses API are also supported, see below.
Create an API Key
Generate your sk- key on the Dashboard's API Keys page.
Change Your Base URL
Point your SDK's base URL at one of the URLs below and call with your key.
Update/Add Model ID
Go to Model Plaza to get the model ID, then update it.
API Base URLs
TokSpan speaks multiple API protocols. Pick the one your SDK already uses — all formats accept the same API key and reach all 200+ models.
https://api.tokspan.com/v1The OpenAI SDK already includes /v1 and appends /chat/completions automatically.
https://api.tokspan.comUse the host root — Claude Code and the Anthropic SDK append /v1/messages themselves.
https://api.tokspan.com/v1betaThe Google SDK uses the native v1beta protocol (generateContent).
https://api.tokspan.com/v1Reuses the OpenAI-compatible base URL and calls /v1/responses.
OpenAI Compatible
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.tokspan.com/v1", # ← OpenAI-compatible base URL
)
response = client.chat.completions.create(
model="MODEL_NAME", # Replace MODEL_NAME with any model from the catalog
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)Anthropic Native
from anthropic import Anthropic
client = Anthropic(
api_key="sk-your-api-key",
base_url="https://api.tokspan.com", # ← Native Anthropic base URL (host root; SDK appends /v1/messages)
)
response = client.messages.create(
model="MODEL_NAME", # Replace MODEL_NAME with any Claude model from the catalog
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.content[0].text)Gemini Compatible
from google import genai
client = genai.Client(
api_key="sk-your-api-key",
http_options=genai.types.HttpOptions(
base_url="https://api.tokspan.com/v1beta", # ← Gemini base URL
),
)
response = client.models.generate_content(
model="MODEL_NAME", # Replace MODEL_NAME with any Gemini model from the catalog
contents="Hello!",
)
print(response.text)Responses API
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.tokspan.com/v1", # ← Same base URL as OpenAI-compatible
)
response = client.responses.create(
model="MODEL_NAME", # Replace MODEL_NAME with any model from the catalog
input="Hello!",
)
print(response.output_text)Using the TokSpan API
No SDK needed — send requests straight to the OpenAI-compatible endpoint with plain HTTP:
All requests use the same format: POST https://api.tokspan.com/v1/chat/completions with your API key in the Authorization header.
import requests
def chat(prompt: str, model: str = "MODEL_NAME"): # Replace MODEL_NAME with any model from the catalog
response = requests.post(
"https://api.tokspan.com/v1/chat/completions",
headers={
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
},
json={
"model": model,
"messages": [{"role": "user", "content": prompt}],
},
)
return response.json()["choices"][0]["message"]["content"]
print(chat("Hello! What models are available?"))const chat = async (prompt: string, model = 'MODEL_NAME') => { // Replace MODEL_NAME with any model from the catalog
const res = await fetch('https://api.tokspan.com/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-your-api-key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model,
messages: [{ role: 'user', content: prompt }],
}),
});
const data = await res.json();
return data.choices[0].message.content;
};curl -X POST "https://api.tokspan.com/v1/chat/completions" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_NAME",
"messages": [{"role": "user", "content": "Hello!"}]
}'Cross-Format Conversion
TokSpan automatically converts between different API formats behind the scenes. You always send requests in the OpenAI Chat Completions format — TokSpan handles translation to the upstream provider's native format:
- OpenAI → Claude Messages API — System prompts, multi-turn conversation, and tool definitions are automatically remapped
- OpenAI → Gemini API — Content parts, safety settings, and generation config are translated transparently
- Claude → OpenAI format — Claude's native responses are normalized to the standard Chat Completions response structure
This means you can use the OpenAI Python/Node SDK, LangChain, or any OpenAI-compatible library to call any model — regardless of its native API format.
Key Scoping & Permissions
Each API key can be scoped to specific permissions:
- Models: Restrict which models the key can access
- Spending cap: Set a hard quota limit — the key is automatically disabled once its quota is exhausted
- IP whitelisting: Only allow requests from specific IP ranges
What's Next?
- Browse the full model catalog — 200+ models across 50+ providers
- Learn about automatic failover for production resilience
- Explore SDK integrations for Python, JavaScript, and more
- Read the Chat Completions API reference for all parameters