TokenBridge API Reference
All live endpoints with curl samples, response shapes, EUR pricing, and rate-limit notes. Base URL: https://tokenbridge-zoos.polsia.app/api/proxy for the proxy gateway; https://tokenbridge-zoos.polsia.app/api for account endpoints.
01Authentication
Every request to the proxy gateway and account endpoints requires a TokenBridge API key passed as a Bearer token.
bashAuthorization: Bearer tb_live_xxxxxxxxxxxxxxxxxxxx
API keys are prefixed tb_live_. Obtain yours at /signup or from your dashboard.
Rate-limit response headers
Every proxy response includes these headers:
| Header | Description |
|---|---|
| X-RateLimit-Limit | Maximum requests per 60-second window (currently 100) |
| X-RateLimit-Remaining | Requests remaining in the current window |
| X-RateLimit-Reset | Unix timestamp (seconds) when the current window resets |
The proxy gateway (/api/proxy/v1/...) accepts Bearer header only. The account endpoints (/api/usage/..., /api/keys/...) accept a tb_session cookie or Bearer header.
02POST/api/proxy/v1/chat/completions
OpenAI-compatible chat completions endpoint. Supports streaming via SSE. Deducts from your EUR wallet on every successful call.
Request
bashcurl https://tokenbridge-zoos.polsia.app/api/proxy/v1/chat/completions \
-H "Authorization: Bearer tb_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "Hello, world!"}]
}'
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (see table below). OpenAI aliases gpt-4o, gpt-4o-mini, gpt-3.5-turbo map to deepseek-chat. |
| messages | array | Yes | Array of { role, content } objects. At least one message required. |
| stream | boolean | No | Set to true to receive a Server-Sent Events stream. Billing still applies. |
| temperature, top_p, max_tokens, ... | any | No | Standard OpenAI chat parameters are forwarded to the upstream provider as-is. |
Supported models
| Model | Input (€/1M tokens) | Output (€/1M tokens) | Provider |
|---|---|---|---|
| deepseek-chat | €0.18 | €0.36 | DeepSeek |
| deepseek-reasoner | €0.44 | €0.88 | DeepSeek |
| doubao-pro-32k | €0.14 | €0.37 | ByteDance Volcano |
| doubao-lite-32k | €0.10 | €0.28 | ByteDance Volcano |
| qwen-max | €2.06 | €8.26 | Alibaba DashScope |
| qwen-plus | €0.51 | €1.55 | Alibaba DashScope |
| qwen-turbo | €0.13 | €0.39 | Alibaba DashScope |
Sample response (non-streaming)
json{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1750000000,
"model": "deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 9,
"total_tokens": 19
}
}
Rate limit
100 requests/minute per API key. Exceeding the limit returns HTTP 429 with a retryAfterMs field indicating the milliseconds until the window resets.
Error codes
tb_live_ and is active.retryAfterMs and back off before retrying.03GET/api/proxy/v1/models
Lists all supported models in OpenAI-compatible format. Auth required (no billing deduction).
bashcurl https://tokenbridge-zoos.polsia.app/api/proxy/v1/models \
-H "Authorization: Bearer tb_live_YOUR_KEY"
Sample response
json{
"object": "list",
"data": [
{
"id": "deepseek-chat",
"object": "model",
"created": 1748260000,
"owned_by": "deepseek"
},
{
"id": "deepseek-reasoner",
"object": "model",
"created": 1748260000,
"owned_by": "deepseek"
}
]
}
The data array contains all 7 supported models. Pass the id field verbatim as the model in chat completions requests.
04GET/api/me/usage
Returns current wallet balance and the last 50 usage events for the authenticated API key. Auth: Bearer tb_live_... header only (no cookie).
bashcurl https://tokenbridge-zoos.polsia.app/api/me/usage \
-H "Authorization: Bearer tb_live_YOUR_KEY"
Sample response
json{
"balance_eur_cents": 4800,
"balance_eur": "48.00",
"usage": [
{
"model": "deepseek-chat",
"input_tokens": 250,
"output_tokens": 180,
"cost_usd": 0,
"created_at": "2026-07-25T14:32:10.000Z"
}
]
}
The usage array contains rows from the legacy usage_log table. For the canonical EUR-denominated ledger with reasoning_tokens and eur_cost, use GET /api/usage/history.
05GET/api/usage/history
Itemised per-call rows from the canonical usage_events ledger with full EUR cost data. Auth: tb_session cookie or Bearer header.
Query parameters
| Param | Format | Default | Description |
|---|---|---|---|
| from | YYYY-MM-DD | — | Inclusive start date (UTC). Omit for unbounded. |
| to | YYYY-MM-DD | — | Inclusive end date (UTC). Omit for unbounded. |
| limit | integer | 500 | Max rows per page (hard cap: 1000). |
| offset | integer | 0 | Row offset for pagination. |
bashcurl "https://tokenbridge-zoos.polsia.app/api/usage/history?from=2026-07-01&to=2026-07-25&limit=100" \
-H "Authorization: Bearer tb_live_YOUR_KEY"
Sample response
json{
"rows": [
{
"created_at": "2026-07-25T14:32:10.000Z",
"model": "deepseek-chat",
"input_tokens": 250,
"output_tokens": 180,
"reasoning_tokens": 0,
"eur_cost": 0.0001098,
"eur_cents": 0,
"request_id": "req_abc123",
"status": "completed"
}
],
"total": {
"count": 1,
"total_eur": 0.0001098,
"eur_cents": 0,
"eur": "0.00"
},
"from": "2026-07-01",
"to": "2026-07-25",
"limit": 100,
"offset": 0
}
06GET/api/usage/export.csv
Downloads usage as a CSV attachment. Same auth as /history. Capped at 10,000 rows per export.
Query parameters
| Param | Format | Description |
|---|---|---|
| from | YYYY-MM-DD | Inclusive start date |
| to | YYYY-MM-DD | Inclusive end date |
bashcurl "https://tokenbridge-zoos.polsia.app/api/usage/export.csv?from=2026-07-01&to=2026-07-25" \
-H "Authorization: Bearer tb_live_YOUR_KEY" \
-o usage.csv
CSV columns
| Column | Description |
|---|---|
timestamp | ISO-8601 UTC call timestamp |
endpoint | Model ID used for the call |
prompt_tokens | Input tokens billed |
completion_tokens | Output tokens billed |
reasoning_tokens | Reasoning tokens (deepseek-reasoner only, billed at output rate) |
credits_eur | EUR cost deducted (6 decimal places) |
request_id | Opaque request identifier for support queries |
status | Always completed for billed rows |
07Dashboard usage endpoints
These endpoints power the dashboard UI. Auth: tb_session cookie or Bearer header. Not typically called by production integrations directly.
| Path | Params | Response summary |
|---|---|---|
GET /api/usage/recent |
limit (max 200, default 50) |
{ usage: [...] } — last N calls from usage_log |
GET /api/usage/daily |
days (max 90, default 30) |
{ daily: [...] } — EUR cents per day per model for the stacked bar chart |
GET /api/usage/current |
none | { used, limit, pct } — current-month spend vs wallet balance (wallet card progress bar) |
GET /api/usage/topups |
limit (max 50, default 20) |
{ topups: [...] } — last N Stripe wallet top-ups |
08POST/api/keys/rotate
Rotates your API key. The old key is invalidated immediately; requests using it will return 401 after rotation. Auth: tb_session cookie or Bearer header.
bashcurl -X POST https://tokenbridge-zoos.polsia.app/api/keys/rotate \
-H "Authorization: Bearer tb_live_YOUR_KEY"
Response
json{
"apiKey": "tb_live_YOURNEWKEYHERE"
}
Copy the new key immediately. It is returned only once and cannot be retrieved again. Update any integrations before the old key stops working.
09EUR pricing reference
All costs are deducted from your EUR wallet per call, atomically, rounded up to the nearest EUR cent. No subscriptions, no expiry on credits.
| Model | Input (€/1M tokens) | Output (€/1M tokens) | Notes |
|---|---|---|---|
| deepseek-chat | €0.18 | €0.36 | |
| deepseek-reasoner | €0.44 | €0.88 | Reasoning tokens billed at output rate |
| doubao-pro-32k | €0.14 | €0.37 | |
| doubao-lite-32k | €0.10 | €0.28 | |
| qwen-max | €2.06 | €8.26 | |
| qwen-plus | €0.51 | €1.55 | |
| qwen-turbo | €0.13 | €0.39 |
For deepseek-reasoner, reasoning_tokens are billed at the same rate as output tokens. Cost formula: (input_tokens / 1M × input_rate) + ((output_tokens + reasoning_tokens) / 1M × output_rate), rounded up to nearest cent.
A low-balance email alert fires when your wallet drops below €5. Top up at /buy or from your wallet page.
10/invoices — billing history
The /invoices page lists your Stripe-backed billing history. Auth: session (cookie or Bearer). No API endpoint — rendered as an HTML page from the dashboard.
| Path | Auth | Description |
|---|---|---|
GET /invoices | Session | Lists all invoices, newest first (up to 100 rows) |
GET /invoices/:id/download.pdf | Session | Downloads a branded PDF for the given invoice row. The :id is the internal database row ID shown in the invoice list. |
Invoice rows appear after the Stripe checkout.session.completed webhook fires. PDF invoices are generated locally (not Stripe-hosted) and include your company billing details.
Ready to build?
Run a live call in the browser or explore full model pricing.