Automatically balance cost and quality for every request
Reads task difficulty and context to match the right model in real time.
Still routing every request through one flagship model?
More traffic, faster bills — and with tasks of every difficulty, cost and quality are hard to hold steady.
Bills that keep climbing
Even simple Q&A hits your priciest flagship — the more you scale, the harder spend is to control.
Quality you can't balance
Static mappings miss task difficulty — you overspend where you shouldn't and underdeliver where it counts.
Runaway agent costs
Every step of a multi-turn call on a flagship — costs multiply once the workflow runs.
One router, two engines
Two decoupled engines: "how hard is this request?" and "which step is the agent on?"
Vertical · Difficulty routing
Gauges each request's difficulty: simple → economy, complex → flagship,
sensitive → safety — scored in ~0.1ms.
Horizontal · Stage downgrade
Tracks the agent's stage: strong models for planning, automatic downshift for execution and wrap-up.
Routing pipeline for every request
Every request runs a self-healing pipeline — safety and quality checks along the way, automatic fallback at any stage.
Match the right compute to every agent turn
Ordinary gateways miss multi-turn agent reasoning. This engine detects each stage — strong models only where it matters, downshift in between.
Per-step savings are estimates for a typical 6-step task; actual results vary by workload and models.
The cost difference, at a glance
Monthly spend under different routing strategies, based on 1 million calls per day.
Based on tests in typical business scenarios, choosing auto or auto-eco mode can save up to about 76%–85% in costs.
A self-evolving routing flywheel
Beyond the numbers, it keeps improving — not hardcoded rules, but a loop that learns from your traffic and retrains itself.
Every call reports real performance (latency, fallbacks) as optimization samples.
Weekly, a stronger model re-grades calls and surfaces requests where experience fell short.
Qualified retrains roll out gradually and hot-swap in ~60 seconds — no service disruption.
Integrate in just two lines
Practically zero onboarding — keep your stack and the OpenAI calls you already use.
import openai openai.api_base = "https://api.tokenlx.ai/v1" openai.api_key = "YOUR_TOKENLX_API_KEY" response = openai.ChatCompletion.create( model="auto", messages=[{"role": "user", "content": "Summarize this weekly report..."}] )
# Auto selects the base model; Agent refines routing by stage curl https://api.tokenlx.ai/v1/chat/completions \ -H "Authorization: Bearer $TOKENLX_API_KEY" \ -d '{ "model": "auto-eco", "messages": [{"role": "user", "content": "Summarize this weekly report..."}], "tools": [...], # Pass agent_id to enable stage-based routing "agent_id": "tokenlx-my-agent" }'
You're in control — every step traceable
Fully automatic by default — as granular as you want, with every choice visible.
In production, it watches stability and safety for you
Model drift, node failures, quality anomalies — handled automatically. Your core business doesn't absorb third-party turbulence.
Automatic failure circuit-breaking
Repeated failures on one node trip the breaker for ~60 seconds; traffic returns smoothly once health checks pass — upstream hiccups don't reach your business.
Safety-valve protection
When fallback rates near the threshold, the safety valve closes in seconds and pulls traffic back to a flagship — protecting stability and experience first.
Pure pass-through data
Request data passes through end to end, never written to disk — aligned with GDPR compliance and security audits.
Bring Smart Routing into your app today
Create a key and start making requests right away — fully OpenAI-compatible.