Setup guide
Use the OpenAI SDK with a custom base URL
Yes. OpenAI SDK works with Token Supply. Keep the OpenAI SDK, curl, or any OpenAI-compatible client. Change the API key and base URL. The model must belong to the plan on that key.
Application code or a terminal
Create account Calculate savings
Key, URL, request
Create an OpenAI-plan key
Copy ts_live_... once from API Keys.
Set base_url
Use https://api.token-supply.com/v1. The path includes /v1.
Pick a model
Put a model from that plan in the model field. Set reasoning_effort on GPT-5 family calls.
Check Usage
Send a short request, then confirm the debit on the dashboard.
Who this is for
Services that already construct an OpenAI client and can set base_url.
OpenAI SDK
Use an OpenAI-compatible key. GPT-5 and GPT-6 calls should set reasoning effort. GPT-6 Sol, GPT-6 Luna, GPT-5.6 Sol, and GPT-5.5 use a 1,050,000 token context window. The example stays on gpt-5.6-sol.
from openai import OpenAI
client = OpenAI(
api_key="ts_live_...",
base_url="https://api.token-supply.com/v1",
)
resp = client.chat.completions.create(
model="gpt-5.6-sol",
reasoning_effort="high",
messages=[{"role": "user", "content": "hi"}],
)
Why this works: The SDK call is unchanged except base_url.
GPT-6.1 Terra rates
gpt-6.1-terra (GPT-6.1 Terra) is available on the OpenAI plan. Amounts below are USD per million tokens.
Official rates are the provider list prices. Token Supply rates are what Token Supply charges. The promotional Token Supply rates are not the permanent price.
The promotional rates are 80% below official through November 15, 2026 inclusive (Europe/Madrid). They end at 00:00 on November 16, 2026. After that, Token Supply is 60% below official. The server applies that change automatically. No other model uses this 80%-then-60% schedule.
The 12-hour cache write price applies only when the request selects 12-hour retention. Otherwise the 30-minute cache write price applies.
- Official: input $1.00, output $5.00, cached input $0.05, 30-minute cache write $1.25, 12-hour cache write $2.50.
- Token Supply promotional, through November 15, 2026 inclusive (Europe/Madrid): input $0.20, output $1.00, cached input $0.01, 30-minute cache write $0.25, 12-hour cache write $0.50.
- Token Supply after 00:00 on November 16, 2026 (Europe/Madrid): input $0.40, output $2.00, cached input $0.02, 30-minute cache write $0.50, 12-hour cache write $1.00.
OpenAI-compatible curl
The same key and base URL work from a terminal.
curl https://api.token-supply.com/v1/chat/completions \
-H "authorization: Bearer ts_live_..." \
-H "content-type: application/json" \
-d '{"model":"gpt-5.5","reasoning_effort":"high","messages":[{"role":"user","content":"hi"}]}'
Why this works: The path is /v1/chat/completions, which matches the OpenAI-compatible contract.
- Use a model that belongs to the group attached to your key. gpt-6.1-sol, gpt-6-sol, gpt-6-luna, and gpt-6.1-terra are OpenAI ids. This example stays gpt-5.6-sol. gpt-6.1-sol reasoning effort is low, medium, high, xhigh, or max.
- Claude Fable 5.1 (claude-fable-5-1), Opus 5.5 (claude-opus-5-5), and Haiku 5.5 (claude-haiku-5-5) can only be used inside the Claude Code CLI via Token Supply, due to Anthropic security settings. This example uses claude-sonnet-5. claude-haiku-4.5 is the Haiku id.
- Do not log requests containing prompts or keys.
Related clients
Codex uses the Responses API rather than chat completions. Cursor uses this same OpenAI base URL in its Models settings.
Codex Responses setup · Cursor OpenAI override · OpenCode OpenAI preset
Details
- Does OpenAI SDK work with Token Supply?
- Yes. Services that already construct an OpenAI client and can set base_url.
- Does the URL include /v1?
- Yes for the OpenAI SDK, curl, Cursor, and OpenCode OpenAI. Codex uses the host without /v1 and wire_api responses.
- Which header carries the key?
- Authorization: Bearer ts_live_YOUR_API_KEY.
- What if the model is not found?
- The key's plan may not include that model. Create a key on the plan that lists it.
Related
- Codex custom endpoint — config.toml, auth.json, and the Responses API.
- Cursor OpenAI-compatible API — Override the OpenAI base URL and paste a plan key.
- OpenCode custom provider — OpenAI, Anthropic, Gemini, and Grok presets.
- Hermes custom endpoint — YAML model config and an OpenAI-compatible key.
- AI API token cost calculator — Compare listed Token Supply rates with public list prices.