One SDK, one key, any model

One key for every model. Pay only for the tokens you use.

pip install tokenflow, drop in your api_key, and let us route to the best model — or pick one yourself. One prepaid wallet, billed per call.

Your API key (placeholder)Sign in to see yours
tf-live-your-key-here
Base URL
api.tokenflow.co.in
Header
x-api-key
This is a placeholder. Sign in and your real masked key prefix appears here — never the raw key.
01

How a request flows

From key creation to async billing. Warm steps are things you do; neutral steps happen on our servers.

Your side
1
Create a key in the dashboard
Name it, set a lifetime spend limit in dollars.
2
Install the TokenFlow SDK
pip install tokenflow, then drop in your key. One import.
3
Build & send the request
Leave model on "auto" and we route it, or name one yourself.
request sent
TokenFlow side
Reserve the worst case
We hold the max possible cost of your max_tokens up front. If your balance can’t cover it, the call returns 402 — the error names the max_tokens you can afford.
Check key spend cap
Reject if this key has hit its lifetime dollar cap — in-flight requests count too.
Call the model
Forward the request to the selected model.
Stream or return, then bill async
You get the response immediately; usage is metered and debited after.
02

Two kinds of control — don't confuse them

Key controls are set once, in dollars, when you create the key. Request controls are set on every call, in the request body.

Key controls
Set once · at creation · in dollars ($)
name
A label so you can tell keys apart.
string
spend_limit_usd
Lifetime dollar cap for this key. Hit it and the key stops.
$ lifetime
revoke
Kill the key instantly. Cannot be undone.
action
Request controls
Set every call · per-request · in the body
model
Which model handles this call.
string
max_tokens
Max length of ONE response, in tokens. Ceiling: 8192 per call.
token count
system
System prompt for this call.
string
temperature / top_p / top_k
Sampling controls.
number
stop_sequences
Strings that end generation early.
string[]
tools / tool_choice
Your own tools (with parameters) or TokenFlow-hosted web_search.
array
metadata
Opaque tracking fields you attach.
object
stream
Server-sent events vs one response.
boolean
max_tokens bounds one response's length — a token count, not a budget. It does not stack against the key's dollar cap directly.
03

Request builder

Set the request controls and copy the generated code. No calls are made — this is a pure code generator.

loading…
token count of the response · max 8192
stream
receive the response as server-sent events
from tokenflow import TokenFlow

client = TokenFlow(
    api_key="tf-live-your-key-here",
    base_url="https://api.tokenflow.co.in",
)

response = client.messages.create(
    model="auto",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello, world"}
    ],
)

print(response.content[0].text)
04

Gotchas worth knowing

The things developers ask us about most.

No passwords here
This is a dev surface — you authenticate with an API key, never a password. We never ask for one.
Lost a key? Regenerate it
Raw keys are shown once at creation and never again. If you lose one, revoke it and make a new one — we can’t recover it.
Low wallet = 402
Before each call we reserve the worst-case cost of your max_tokens. If your balance can’t cover it, you get HTTP 402 — the error tells you the largest max_tokens you can still afford. Top up (or lower max_tokens) and calls resume immediately.
Spend cap ≠ max_tokens
The key’s dollar cap is a lifetime budget. max_tokens only bounds one response’s length. See section 02 above.
Keys stay masked here
This page only ever shows a masked prefix like tf-live-••••3a9f. Raw keys live only in your dashboard, once.