Quickstart
From zero to first LLM response in under 2 minutes — choose your path.
Pick the path that matches how you're using tokenroute.
A. From a Python or Node app (OpenAI SDK)
You already have OpenAI SDK code? Change two lines:
from openai import OpenAI
client = OpenAI(
base_url="https://api.tokenroute.io/v1",
api_key="sk-tr-...", # from `tokenroute keys create`
)
resp = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.tokenroute.io/v1",
apiKey: "sk-tr-...",
});
const r = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);curl https://api.tokenroute.io/v1/chat/completions \
-H "Authorization: Bearer sk-tr-..." \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello"}]
}'B. From the CLI (recommended for first-time setup)
# install (any of these)
pipx install tokenroute # pinned global install
uvx tokenroute # one-shot, no install
npx tokenroute@latest # via the npm thin wrapper (Phase B)
# log in once
tokenroute login # opens browser for OAuth device-flow
# create your first key
tokenroute keys create --name myapp
# write OPENAI_API_KEY + BASE_URL into your project
tokenroute env >> .env
# verify it works
tokenroute testC. From an AI agent (Claude Code, Codex, etc.)
If you're an agent reading this on behalf of a user, hop to For AI agents for the copy-paste sequence.
D. From Claude Code or Cursor (MCP)
MCP support is in development (Phase B). Once live, one line wires tokenroute into Claude Code:
claude mcp add tokenroute https://mcp.tokenroute.io/mcpWhat you get back
The model field is namespaced provider/model-id. tokenroute supports OpenAI, Anthropic, Google, DeepSeek, Mistral out of the box — full list at tokenroute models or GET /v1/models.
Topping up
New accounts start at $0. Get a Stripe Checkout link via:
tokenroute topup --amount 5Or, POST /api/v1/topup returns { checkout_url } for programmatic flows. Agents must not auto-pay — hand the URL to the user.