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.

1

Register & Log In

Sign up with your email at our signup page.

2

Create an API Key

Generate your sk- key on the Dashboard's API Keys page.

3

Change Your Base URL

Point your SDK's base URL at one of the URLs below and call with your key.

4

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.

OpenAI Compatible
https://api.tokspan.com/v1

The OpenAI SDK already includes /v1 and appends /chat/completions automatically.

Anthropic Native
https://api.tokspan.com

Use the host root — Claude Code and the Anthropic SDK append /v1/messages themselves.

Gemini Compatible
https://api.tokspan.com/v1beta

The Google SDK uses the native v1beta protocol (generateContent).

Responses API
https://api.tokspan.com/v1

Reuses the OpenAI-compatible base URL and calls /v1/responses.

OpenAI Compatible

python
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

python
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

python
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

python
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)
One key, every format. All four formats use the same TokSpan API key. Your balance and usage are shared — just call the model name you want.

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.

python
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?"))
typescript
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;
};
shell
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
Security note: Never expose your API key in client-side code. Use environment variables or a secure backend proxy. All requests to TokSpan are encrypted with TLS 1.3.

What's Next?