Documentation

Connect your tool in a minute.

Every tool needs the same two things: the base URL below and your key. Pick your tool and follow the steps.

Base URL · the same for every toolhttps://api.tokenlowcost.com/v1
API key · one key per modelsk-tlc-…

Quick start

About a minute
  1. Create a key

    In the dashboard, pick a model and click Create key. Copy the key right away: it's shown only once.

  2. Set up your tool

    Find your tool below. Right after you create a key, the dashboard shows the same steps with your key already filled in.

  3. Start working

    Use your tool as usual. Each request is paid from your balance, and the dashboard shows it with its cost.

Models

Ranked, best first

Each key works with one model: the one you pick when you create it. That model answers every request made with the key, whatever model name your tool sends. Want two models? Create two keys.

For the same reason, GET /v1/models lists only your key's model. Tools that show a model list, like Cline and Roo Code, offer just that one.

All models and their prices are on the pricing page.

Billing & limits

Prepaid · per token

You add money to your balance first. New accounts start with $50 of welcome credit, one per person. Each request costs its tokens at your model's price, and that amount comes off the balance. The dashboard lists every request with its tokens and cost.

Repeated text costs less. When the model has recently seen the start of a prompt, those tokens are billed at the cheaper cached rate. Coding tools send the same context over and over, so this saves a lot.

When requests stop

What happenedResult
Key limit reached402 for that key. Your other keys keep working.
Key expired403 for that key.
Key revoked401 right away. This can't be undone.
Balance at $0402 for all keys until you top up. The balance never goes below zero.
Account banned403 for all keys, and you can't log in. Bans are for breaking the rules.

Context & effort

Optional, set per key

When you create a key, you can also choose these two settings. The dialog shows what the input of a prompt that fills the chosen window costs.

SettingWhat it does
Context windowHow much text one request can hold, from 128K tokens up to the model's maximum. It's a limit on the key: the model itself doesn't change. Requests over the limit are refused and cost nothing. The size is estimated, so it can be off by a few percent.
EffortHow hard the model thinks before it answers. Set in the app lets your tool decide. A fixed level applies to every request made with the key. More thinking means more output tokens, so it costs more.

The setup steps in the dashboard pass both settings on to your tool.

Long chats cost more. Coding tools send the whole chat with every step, so each step costs a bit more than the one before, until the tool shortens the chat. A smaller context window makes that happen sooner. Some models also charge more for very long prompts; the pricing page shows where that starts.
Cu

Cursor

Settings → Models
  1. Open the settings

    In Cursor, open Settings → Models and scroll down to API Keys.

  2. Paste your key and the base URL

    Paste your key into OpenAI API Key. Turn on Override OpenAI Base URL and paste the base URL.

    OpenAI API Key            sk-tlc-your-key
    Override OpenAI Base URL  on
    Base URL                  https://api.tokenlowcost.com/v1
  3. Add a model name

    Click + Add model, type a name like tlc-opus and turn it on. The name is just a label: your key decides the model. Use a name Cursor doesn't already have, so the request goes out with your key.

  4. Check and chat

    Click Verify next to the key. Then pick your model in the chat.

VS

VS Code

Built-in chat · no extension, no GitHub account

The chat built into VS Code can use your key. You need VS Code 1.122 or newer. If VS Code asks you to sign in when it first starts, click Continue without Signing In.

  1. Add a custom endpoint

    Press Ctrl + Shift + P (Cmd on a Mac) and run Chat: Manage Language Models. Click Add Models, then Custom Endpoint.

  2. Enter a name and your key

    Name it TokenLowCost and paste your key. At API Type, just press Enter.

  3. Paste your model

    VS Code opens a file with an empty model in it. Replace its "models": [ … ] part with the block below and save. The dashboard gives you this block ready-made for your key, right after you create it. Copying from here? Take the Claude block for Claude models, the other one for the rest, and change id and name to your model.

    
                  
    
                
  4. Pick the model

    Open the chat, click the model name in the message box and pick your model.

VS Code keeps your key in its secure storage, not in the file. The chat works fully, agent mode included. The grey suggestions that appear as you type are not covered: those come only from GitHub Copilot.

Not signed in to GitHub? VS Code then shows Set BYOK utility models. Click Configure and choose Main Agent Model, so chat titles and commit messages use your model too. These are small requests, billed like any other.

Claude Code or Codex in VS Code

The Claude Code and Codex extensions use the same settings as their terminal versions. Paste the Claude Code or Codex line first, then install the extension and restart VS Code. For Claude Code, also open Settings, search for Claude Code login and tick Disable Login Prompt.

CC

Claude Code

One pasted line

One line saves the base URL, your key and your key's model, and every new terminal picks them up. The line below is for a Claude Opus 5.5 key and has a placeholder key. The dashboard shows it made for your key: its model, context window and effort.


          

        
  1. Paste the line

    Paste it into PowerShell (Windows) or Terminal (macOS, Linux) and press Enter.

  2. Run Claude Code

    Run claude in the same window. The first time, press Enter on the text style and security screens. When it asks whether you trust the folder, press ↓ to choose Yes, I trust this folder, then Enter: the preselected No, exit closes Claude Code. You don't need an Anthropic account.

Don't have Claude Code yet? In PowerShell, run irm https://claude.ai/install.ps1 | iex. On macOS or Linux, run curl -fsSL https://claude.ai/install.sh | bash. If the installer says its folder is not in your PATH, do what it shows. If you use the terminal inside VS Code or Cursor, restart the editor after pasting the line.

Why the model name? Without it, Claude Code thinks it's talking to Claude Opus 5.5, whatever your key's model is. It tells the model so and signs commits with that name. With the name, it knows the real model. For a model that isn't Claude, Claude Code may say it doesn't recognize the model. That's fine: it only knows Claude models by name, and the requests still work.

Rather use a file? Put this in ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenlowcost.com/v1",
    "ANTHROPIC_AUTH_TOKEN": "sk-tlc-your-key",
    "ANTHROPIC_MODEL": "claude-opus-5-5[1m]"
  }
}

Set ANTHROPIC_MODEL to your key's model: claude-opus-5-5, claude-sonnet-5, claude-haiku-4-5, or for other models the id from the price list, such as gpt-6-sol. Add [1m] at the end if the key's window is over 200K.

Claude Code also sends small background requests, such as chat titles. They use your key's model and are billed like any other request.

Cx

Codex

One pasted line

One line writes the Codex settings file and saves your key. If you already have a Codex config, it's kept as config.toml.bak. This line has a placeholder key; the dashboard shows it with yours.


          

        

Paste it into PowerShell (Windows) or Terminal (macOS, Linux) and press Enter. Then run codex in the same window and choose Trust and continue. You don't need a ChatGPT account.

Don't have Codex yet? Install it with npm install -g @openai/codex. Codex works best with OpenAI models, such as GPT-6 Sol.

Rather edit the file yourself? This is what the line writes to ~/.codex/config.toml. If you add it to an existing file, keep the first lines above any [section].

Codex reads your key from the TOKENLOWCOST_API_KEY environment variable, which the line also sets. Set it yourself too: add export TOKENLOWCOST_API_KEY=sk-tlc-your-key to ~/.zshrc or ~/.bashrc, or on Windows run setx TOKENLOWCOST_API_KEY sk-tlc-your-key and open a new window.

Cl

Cline, Roo Code & Continue

Extensions for VS Code and JetBrains

In Cline or Roo Code, open the provider settings and fill in the fields below. The first time you open Cline, choose Bring my own API key to get there. Once the key is in, the model list shows just your key's model: pick it.

API Provider  OpenAI Compatible
Base URL      https://api.tokenlowcost.com/v1
API Key       sk-tlc-your-key
Model ID      anthropic/claude-opus-5.5

Cline shows the cost as $0, since it doesn't know our prices. The real cost is under Usage in your dashboard.

Roo Code stuck at API Request…? In VS Code 1.122 and newer, Roo Code 3.54 can't find the file search tool VS Code moved, whatever provider you use. This VS Code issue has a workaround. Cline doesn't have the problem.

For Continue, put this in ~/.continue/config.yaml in place of what's there. Already have models in it? Add just the TokenLowCost entry under models:. The tool_use line lets Agent mode edit files; without it, Continue can't tell the model has tools.

name: My Config
version: 0.0.1
schema: v1
models:
  - name: TokenLowCost
    provider: openai
    model: tlc-opus
    apiBase: https://api.tokenlowcost.com/v1
    apiKey: sk-tlc-your-key
    capabilities:
      - tool_use

Any other tool with an OpenAI Compatible option works the same way.

OA

OpenAI SDK

Python and TypeScript

Set the base URL and your key. The rest is the usual SDK code.

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)
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);

The TypeScript examples on this page are ES modules: save one as main.mts and run npx tsx main.mts.

Streaming

Add stream=True. The token counts come in the last chunk, which can arrive without choices, so check chunk.choices first.

stream = client.chat.completions.create(
    model="claude-opus-5.5",
    messages=[{"role": "user", "content": "Write a haiku about caching"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")

The Responses API works too: client.responses.create(...).

An

Anthropic SDK

Python and TypeScript

Use the same base URL as everywhere else. The SDK adds /v1/messages to it, and that's fine. Some models send a thinking block before the text, so the example prints only the text blocks.

from anthropic import Anthropic

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

msg = client.messages.create(
    model="claude-opus-5.5",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello"}],
)
for block in msg.content:
    if block.type == "text":
        print(block.text)
import Anthropic from "@anthropic-ai/sdk";

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

const msg = await client.messages.create({
  model: "claude-opus-5.5",
  max_tokens: 512,
  messages: [{ role: "user", content: "Hello" }],
});
for (const block of msg.content) {
  if (block.type === "text") console.log(block.text);
}
$_

cURL

Plain HTTP requests

The same key works in all three request formats.

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"}]}'
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"}]}'
curl https://api.tokenlowcost.com/v1/responses \
  -H "Authorization: Bearer sk-tlc-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-sol", "input": "Hello"}'

Check your balance and your last 20 requests:

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

Errors

What they mean and what to do

When something goes wrong, you get a status code and a short message.

CodeWhat it meansWhat to do
401The key is missing, wrong or revoked.Check that you pasted the whole key.
402The key reached its spending limit, or your balance is $0.Top up, or create a key with a higher limit.
403The key has expired, or the account is banned. The message says which.If it expired, create a new key. Bans are explained in the rules.
400If the message says the prompt is too long: the request is bigger than the key's context window. It isn't billed.Start a new chat, or use a key with a bigger window.
404Wrong address.Check the part after /v1.
OtherPassed on from the model provider as is, for example when it's overloaded.Try again in a minute.

Spending limits and expiry dates are set per key in the dashboard. Your balance is under Billing.

Ready to connect?

Create an account, get $50 of credit and make your first key. It takes about a minute.

Get API key