flux://router
loading routing engine
0%
Open source · Self-hosted · AGPL-3.0

Stop overspending on AI.

Flux routes every wrapper request and agent step to the best-fit model — delivering up to 89% estimated savings in our benchmarks with millisecond routing.

Self-hosted · OpenAI-compatible · Five providers · 1,400+ automated tests
up to 89%estimated cost savings
500/500routing decisions under 10 ms
5major AI providers
1,400+automated tests
30catalog models
Flux is the self-hosted control plane for AI wrappers and agents. Benchmark methodology
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="your-flux-token",
)

response = client.chat.completions.create(
    model="flux-auto",
    messages=[
        {"role": "user", "content": "Summarize this document"}
    ],
)
# Same OpenAI-compatible call — add two headers
POST /v1/chat/completions
X-Flux-Run-Id: run-123
X-Flux-Step-Type: plan

# Flux tracks spend against run-123 and keeps a
# higher quality floor for "plan" steps than for
# mechanical steps like tool_result.
Budget guardrail
Reserves estimated cost before dispatch, blocks what would exceed the cap
Step-aware routing
Plan, tool-select, and final steps keep a quality floor
Self-hosted
Routing, budgets, and telemetry stay in your infrastructure
Cost control

Cut model costs without downgrading every request.

Most AI systems send every request to one expensive model. Flux evaluates each request and agent step, then selects the least expensive available model that satisfies the configured capability and quality requirements.

Up to 89% estimated savings

in Flux's synthetic evaluations, measured across three baseline scenarios.

84.8%
estimated savings versus GPT-4o
89.3%
estimated savings versus Claude Sonnet 4.6
82.2%
estimated savings versus Gemini 2.5 Pro

Offline synthetic evaluation using registry pricing and catalog-rated model quality. Results vary by workload, routing policy, pricing and model availability. Full methodology →

Routing latency

Flux makes routing decisions in milliseconds.

Routing is pure heuristic logic — no LLM call sits in the decision path, so the decision itself is effectively free next to inference.

500/500
local routing decisions completed under 10 ms
0.31 ms
median routing-decision latency
0.60 ms
P95 routing-decision latency

Routing-decision measurement only. Provider inference, network latency and complete HTTP gateway overhead are measured separately. Methodology →

How it works

Two jobs, deliberately separate.

Flux routes every call to the best-fit model on cost, capability, latency and reliability — and separately, applies an enforced estimated spend guardrail on what an agent run can consume.

01 · Capability-aware, cost-conscious routing

Every request is classified by task type, filtered down to models that meet configured capability and quality-floor requirements, then scored on cost against quality and dispatched — pure heuristic logic, no LLM call in the routing path.

01
Request
Incoming call
02
Classify
Task type + complexity
03
Constrain
Capability + quality floor
04
Score
Cost × quality
05
Route
Dispatch to provider
06
Reconcile
Log actual cost
Pure heuristics
Zero LLM calls in the routing path
Adaptive per-(model, task) learning
Prompt-cache aware
02 · Estimated per-run agent budget guardrails

A budget is set per agent run. Flux reserves the estimated cost of each step before dispatch, blocks any request predicted to exceed the configured budget, and reconciles the reservation against actual reported usage once the response comes back.

$0.00run-123 · $0.74 of $1.00 reserved$1.00 cap
Under 60% — normal model tier 60–90% — degrade to cheaper models Predicted to exceed cap — request blocked, run summary returned
Scope, honestly

This is a guardrail based on token and price estimates, not a guarantee against every provider-side billing discrepancy. Pooling one shared budget across multiple concurrent agents over a time window is on the roadmap — not yet built.

Agentic AI

Route every step of an AI agent intelligently.

A planning step and a tool-result summary do not require the same model. Flux applies step-aware routing so agents can reserve premium models for the work that genuinely needs them — across OpenAI-compatible wrapper traffic and multi-step agent workflows alike.

X-Flux-Run-Id: run-123
X-Flux-Step-Type: plan
plan — planning
tool_select — tool selection
tool_result — tool-result interpretation
reflect — reflection
final — final-answer generation
Reliability and governance

Your AI control plane. Your infrastructure.

Deploy Flux beside your application and keep routing policy, budgets and telemetry under your control. Model requests still go to the providers you configure; Flux itself does not require another managed routing service.

Automatic fallback

Typed fallback chains for rate limits, timeouts, and content filters, handled separately per failure mode.

Circuit breakers

A provider that starts failing is tripped out of the candidate pool until it recovers.

Model-availability filtering

Only models marked available in the catalog enter scoring, so routing doesn't pick something you can't call.

Per-tenant budgets

Tag requests with a customer or tenant ID for per-customer cost tracking and daily ceilings.

Estimated run-spend guardrails

Reserves estimated cost before dispatch and reconciles it against actual reported usage after the call.

Streaming and non-streaming

Both request modes are supported through the OpenAI-compatible wrapper.

Structured output

Routes structured-output requests only to models that support the required response format.

Tool calling

Routes tool-calling requests only to models in the catalog marked as supporting function/tool calling.

Local dashboard and telemetry

Prometheus-format routing and budget metrics, plus a local dashboard — no data leaves your infrastructure.

Capability-aware routing

Filters candidates to models that support the request's required capabilities before scoring.

Prompt-cache-aware selection

Avoids switching providers mid-conversation when doing so would break a warm prompt cache.

Redis-backed multi-worker enforcement

Required for correct shared run-budget state when Flux is deployed across multiple worker processes.

Precise about what's enforced

Spend control is an enforced estimated spend guardrail based on token and price estimates, not an absolute billing guarantee. Quality floors are a configured quality threshold based on catalog ratings, not a guarantee of objective answer quality. Flux is not a medical, legal, or safety decision system — high-stakes classification is rule-based and should not replace application-level safety controls.

What is verified

What we can back up, and what we can't — yet

We'd rather tell you the boundary than let you find it in production.

Verified

  • 1,400+ automated tests
  • Offline routing benchmark passes all nine benchmark checks
  • 500/500 local routing decisions completed under 10 ms
  • Security scanning reports no medium/high Bandit findings
  • Wrapper and agent-routing code paths have automated test coverage

Not yet proven

  • Savings on real customer production traffic
  • Live answer-quality superiority across every provider/model
  • Empirical agent-step-specific quality ratings for every model
  • Native incremental streaming for every provider
  • Universal medical/legal intent detection
Last updated: Aug 10, 2026
Where Flux fits

The self-hosted control plane purpose-built for cost-aware wrappers and step-aware AI agents.

LiteLLM and Portkey can also be self-hosted — self-hosting isn't the differentiator. What's rare is the combination below: routing that decides per request and per agent step, with cost governance in the same layer. Sources and access dates in the methodology.

01

Per-request automatic model selection

Sub-millisecond, pure-Python heuristic routing based on task type and complexity scoring — not a config you maintain by hand.

02

Step-aware agent routing

Planning, tool selection, tool-result interpretation, reflection and final answers each get their own routing treatment.

03

Cost governance in the routing layer

Per-tenant budgets and estimated run-spend guardrails live where the routing decision is made, not in a separate billing system.

04

Adaptive learning from response quality

Per-(model, task) exponential moving average, optionally per customer — routing sharpens as it accumulates outcomes.

05

Local telemetry and policy ownership

Routing policy, budgets and telemetry stay in your infrastructure. Model requests go only to providers you configure.

Savings calculator

See what intelligent routing could save

Pick the model you'd otherwise send everything to. The estimate uses the measured Flux benchmark scenario for that baseline, not one blanket percentage.

$2.0k/month
Estimated savings based on the selected Flux benchmark scenario
$1.7k
per month
That's $20.4k/year versus GPT-4o at 84.8%.
Illustrative estimate. Actual savings depend on workload, model mix, pricing and routing configuration. See methodology.
View benchmark →
Benchmark methodology

Every number above, and exactly how we got it

Offline synthetic evaluation. Reproducible from the committed benchmark artifact in the repo.

Sample count
500 requests, fixed set, same set across all baselines
Workload composition
Mixed task types — summarization, classification, extraction, code, reasoning, and multi-step agent traces
Baselines
Every request sent to a single model: GPT-4o (84.8%), Claude Sonnet 4.6 (89.3%), Gemini 2.5 Pro (82.2%)
Model catalog & pricing snapshot
30 catalog models across five providers, priced from the committed registry snapshot, Aug 2026
Test date
August 2026
Environment
Single local machine, no network calls to providers; routing evaluated offline
Routing latency definition
Time to produce a routing decision only — excludes provider inference, network latency and full HTTP gateway overhead
Quality basis
Configured quality threshold from catalog ratings, not graded answer quality on live traffic

Savings figures are estimates derived from registry pricing and catalog-rated model quality on a synthetic request set — not measurements of live production traffic. Actual savings depend on workload, model mix, provider pricing and routing configuration. Competitor capability statements elsewhere on this site are drawn from each project's public documentation; source links and access dates accompany the comparison in the repo README.

Last updated: Aug 25, 2026
Who this is for

Built for teams already worried about the bill

Already had a runaway agent bill

One bad loop, one missing guardrail, and a single agent run outspent a week of normal traffic. Flux's per-run budget reservation is built for exactly that failure mode.

Margin-sensitive, fixed-price contracts

If an agent's cost overruns eat into your margin, an estimated per-run budget cap is the guardrail your pricing model assumes exists.

Regulated buyers: fintech, healthtech, GCCs

Routing logic, budgets, and telemetry stay in your infrastructure — a requirement hosted gateways can't meet by policy.

Early access

Self-hosted and open source. Commercial licensing for the rest.

Flux is free to self-host under AGPL-3.0. You still pay your chosen model providers (OpenAI, Anthropic, Google, Groq, Mistral) directly — Flux only controls routing and spend on top of that. Embedding or reselling Flux needs a separate commercial license. Exact managed-tier pricing isn't finalized; join the waitlist for early access and founding pricing.

We're an early-stage startup building Flux in the open. For any queries, reach us at fluxllmdev@gmail.com

Quickstart

Clone, install, run

Flux isn't published to PyPI yet — install from a local clone in editable mode, then point your existing OpenAI SDK client at the server.

Works with an unmodified OpenAI SDK client
Routing logic and budgets stay in your infrastructure
Programmatic Python API also available
Read the Docs →
# Clone and install (editable, no PyPI package yet)
git clone https://github.com/vbc1406/flux-router.git
cd flux-router
pip install -e .
flux serve

# Point the OpenAI SDK at it — nothing else changes
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1")

resp = client.chat.completions.create(
    model="flux-auto",
    messages=[{"role": "user", "content": "Summarize this document..."}]
)
Prefer programmatic control?
from router.flux import make_flux

flux = make_flux()  # reads provider keys from env
resp = asyncio.run(flux.complete(
    "Summarize this document...",
    user_id="u123",
))

Stop overspending
on AI

Self-hosted routing, cost governance and budget guardrails. Free and open source today.