Getting started

Quick start

Every tool uses the same base URL and the same key. The gateway detects the request format — Anthropic Messages, OpenAI Chat Completions or Responses — from the path, so there is nothing else to configure.

Base URL
https://api.tokenlowcost.com
With /v1
https://api.tokenlowcost.com/v1  (also works)
Auth header
Authorization: Bearer sk-tlc-…
Anthropic header
x-api-key: sk-tlc-…  (also accepted)

1. Create a key

In the dashboard, choose the model, an optional budget and an expiry. The full key is shown once — store it in your password manager or the tool's settings immediately.

2. Point your tool at the base URL

Pick your tool below. In most cases it's two settings: the base URL and the key.

3. Send a request

bash
curl https://api.tokenlowcost.com/v1/chat/completions \
  -H "Authorization: Bearer sk-tlc-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-5.5","messages":[{"role":"user","content":"Hello"}]}'

Models & billing

Each key is pinned to the model you selected when you created it. That is the model that answers and the model you're billed for, regardless of the model string your client sends. To use several models, create several keys.

Billing is prepaid and per token, deducted from your balance after each request at the key model's rate. Cached input tokens are billed at the cached rate. When a key's budget is reached or its expiry passes, the gateway rejects requests with that key; when your balance reaches zero, all requests stop. There is no overdraft.

Live rates for every model are on the pricing page. The catalog is also available as GET /v1/models.

bash
curl https://api.tokenlowcost.com/v1/models -H "Authorization: Bearer sk-tlc-your-key"

Cursor

Cursor talks to OpenAI-compatible endpoints through its OpenAI API Key setting.

  1. Open Settings → Models.
  2. Under OpenAI API Key, paste your key and turn on Override OpenAI Base URL.
  3. Set the base URL to https://api.tokenlowcost.com/v1.
  4. Click + Add model, enter any name (for example tlc-opus) and enable it. The name is only a label — the key decides the model.
  5. Click Verify. It turns green. Select your model in chat.
Settings → Models
OpenAI API Key            sk-tlc-your-key
Override OpenAI Base URL  on
Base URL                  https://api.tokenlowcost.com/v1

Cursor requires a public HTTPS endpoint; this one already is.

Claude Code

Set the base URL and auth token as environment variables, then run Claude Code as usual. Leave ANTHROPIC_API_KEY empty so the auth token is used.

~/.zshrc · ~/.bashrc
export ANTHROPIC_BASE_URL=https://api.tokenlowcost.com
export ANTHROPIC_AUTH_TOKEN=sk-tlc-your-key
export ANTHROPIC_API_KEY=

claude

Or per project, in .claude/settings.json:

.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenlowcost.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-tlc-your-key"
  }
}

Codex

Add a provider that uses the Responses API, then select it.

~/.codex/config.toml
[model_providers.tokenlowcost]
name     = "TokenLowCost"
base_url = "https://api.tokenlowcost.com"
wire_api = "responses"
env_key  = "TOKENLOWCOST_API_KEY"

model_provider = "tokenlowcost"
model          = "gpt-5.5"
bash
export TOKENLOWCOST_API_KEY=sk-tlc-your-key
codex

VS Code — Cline, Roo Code, Continue

Any extension with an OpenAI Compatible provider works. In the extension's provider settings:

Provider settings
Provider   OpenAI Compatible
Base URL   https://api.tokenlowcost.com/v1
API Key    sk-tlc-your-key
Model      any name, e.g. tlc-opus

For Continue, add the same values under models in ~/.continue/config.yaml with provider: openai and apiBase set to the base URL.

OpenAI SDK

main.py
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokenlowcost.com/v1",
    api_key="sk-tlc-your-key",
)

r = client.chat.completions.create(
    model="claude-opus-5.5",
    messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
main.ts
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.tokenlowcost.com/v1",
  apiKey: "sk-tlc-your-key",
});

const r = await client.chat.completions.create({
  model: "claude-opus-5.5",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);

Streaming (stream: true) and the Responses API (client.responses.create) work the same way.

Anthropic SDK

main.py
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.tokenlowcost.com",
    api_key="sk-tlc-your-key",
)

msg = client.messages.create(
    model="claude-opus-5.5",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)

cURL

Chat Completions
curl https://api.tokenlowcost.com/v1/chat/completions \
  -H "Authorization: Bearer sk-tlc-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-5.5","messages":[{"role":"user","content":"Hello"}]}'
Anthropic Messages
curl https://api.tokenlowcost.com/v1/messages \
  -H "x-api-key: sk-tlc-your-key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-5.5","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'

Check balance and the last 20 requests for a key:

Account
curl https://api.tokenlowcost.com/me -H "Authorization: Bearer sk-tlc-your-key"

Errors

The gateway returns standard HTTP status codes with a JSON body describing the problem.

401
missing, malformed or revoked key
402
key budget reached, or account balance is zero
403
key has expired
404
unknown endpoint — check the path suffix
4xx / 5xx
passed through from the model provider unchanged

Budget and expiry are set per key in the dashboard; balance is under Billing.