OpenAI-compatible protocol · streaming · per-token & per-call billing · Claude native protocol supported
Change one line of base_url — existing AI apps work with zero rewrites
Business email / phone number, auto-approved within 5 minutes.
Pick models, set quotas, get your API Key in one click.
Point your SDK at TuneRouter and go live instantly.
from openai import OpenAI client = OpenAI( api_key="sk-tr-your-token", base_url="https://api.tunerouter.com/v1" # the only line you change ) resp = client.chat.completions.create( model="auto", # TuneRouter picks the best model; or pin one like glm-5.3 / claude-opus-4-8 messages=[{"role": "user", "content": "Hello!"}] ) print(resp.choices[0].message.content)
Everything you need to integrate, debug and go to production
| Base URL | https://api.tunerouter.com/v1 |
| Authentication | Authorization: Bearer sk-tr-your-token |
| Endpoints | POST /v1/chat/completions · POST /v1/messages (Claude native) · POST /v1/images/generations · GET /v1/models |
| Streaming | Supported — set "stream": true (SSE passthrough) |
curl https://api.tunerouter.com/v1/chat/completions \ -H "Authorization: Bearer sk-tr-your-token" \ -H "Content-Type: application/json" \ -d '{ "model": "glm-5.3", "stream": true, "messages": [{"role": "user", "content": "Hello, introduce yourself"}] }'
from openai import OpenAI client = OpenAI( api_key="sk-tr-your-token", base_url="https://api.tunerouter.com/v1" ) resp = client.chat.completions.create( model="glm-5.3", messages=[{"role": "user", "content": "1+1=?"}] ) print(resp.choices[0].message.content)
The official Anthropic SDK connects directly — no OpenAI conversion layer. Streaming and cache-aware billing supported. Note the base URL carries no /v1 suffix; the SDK appends it.
from anthropic import Anthropic client = Anthropic( api_key="sk-tr-your-token", base_url="https://api.tunerouter.com" ) msg = client.messages.create( model="claude-opus-4-8", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}] ) print(msg.content[0].text)
Per-call billed image models (glm-image / seedream / wan-image and more) go through /v1/images/generations.
curl https://api.tunerouter.com/v1/images/generations \ -H "Authorization: Bearer sk-tr-your-token" \ -H "Content-Type: application/json" \ -d '{ "model": "glm-image", "prompt": "An orange cat wearing glasses, cartoon style" }'
| HTTP | Meaning |
|---|---|
| 401 | Token invalid or disabled |
| 402 | Insufficient balance (pre-deduction check failed) |
| 404 | Model not found or no available channel |
| 4xx | Upstream parameter error, passed through as-is (not billed) |
| 502 | All channels failed (pre-deducted fee refunded) |
Common questions on billing, private deployment and new models
In auto mode, TuneRouter matches the best model per request by cost, latency and capability, and intelligently tunes call parameters. You can also explicitly pin a model (e.g. glm-5.3, claude-opus-4-8) in the request.
Pay-as-you-go: metered by model input / output tokens, all models uniformly at ~15% off official list price; consolidated monthly bills, no minimum spend, no hidden fees, monthly or quarterly settlement, volume negotiable with tiered rebates. Failed requests are never billed — see the error-code table above.
Yes. TuneRouter supports private intranet deployment and dedicated gateway addresses, with multi-tenant isolation, tiered API Keys and full audit logs — meeting the compliance needs of finance, government and similar scenarios.
New releases from DeepSeek, Qwen, Claude, GPT and other major vendors are callable the day they launch, guaranteed within 72 hours. If a provider times out or errors, requests automatically retry on the next best model — business stays unaffected, no manual firefighting.
Contact account manager → tenant provisioning → get API Key → go live
Contact Our Team