Skip to main content
token-hub

Quickstart

Go from zero to your first token-hub API call in under five minutes. Sign up, create a key, send a cURL request, and switch models by editing one string.

token-hub is an OpenAI-compatible LLM gateway. One API key, one endpoint, every major model. This guide gets you from sign-up to a live response.

Step 1 — Sign up

Open tokenhub.sandboxclaw.com/register and create an account with email or Google. No phone number. No ICP filing. No US card required.

Verify your email via the link we send you. That unlocks the dashboard.

Step 2 — Top up and create a key

From the dashboard, go to /topup. Pick a preset ($5, $10, $50, $100) or enter a custom amount. Switch currency to CNY if you prefer yuan — Stripe settles the conversion.

Then visit /keys and click New Key. Copy the full sk-th_... value shown. We hash the key server-side and cannot show it again — if you lose it, revoke and reissue.

Step 3 — Send your first request

The base URL is https://api.sandboxclaw.com/v1. Every endpoint matches the OpenAI shape, so a plain cURL call works:

curl https://api.sandboxclaw.com/v1/chat/completions \
  -H "Authorization: Bearer sk-th_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "messages": [{"role": "user", "content": "Give me one fact about octopuses."}]
  }'

You get back an OpenAI-shaped response:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "model": "claude-3-5-sonnet-20241022",
  "choices": [
    { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }
  ],
  "usage": { "prompt_tokens": 14, "completion_tokens": 22, "total_tokens": 36 }
}

The usage block drives billing. Token counts come from the upstream provider and are passed through unchanged.

Step 4 — Switch models

Switching models is one string change. The same key routes to Claude, GPT, Gemini, DeepSeek, Qwen, Kimi, or GLM:

# GPT-4o
-d '{"model": "gpt-4o", "messages": [...]}'

# DeepSeek V3 (cheap, strong at code)
-d '{"model": "deepseek-chat", "messages": [...]}'

# Gemini 2.0 Flash (1M context)
-d '{"model": "gemini-2.0-flash", "messages": [...]}'

The same thing works with the OpenAI Python SDK — just override base_url:

from openai import OpenAI

client = OpenAI(
    api_key="sk-th_...",
    base_url="https://api.sandboxclaw.com/v1",
)

resp = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Write a SQL for active users last 30 days."}],
)
print(resp.choices[0].message.content)

For streaming, set "stream": true. The response is an text/event-stream of OpenAI-compatible delta chunks terminated by data: [DONE].

  • FAQ — policies, data handling, refunds, rate limits.
  • Troubleshooting — common errors and how to fix them.
  • Scenarios — end-to-end examples for RAG, chat apps, and batch classification.