niuronniuron
niuron / automatic model routing

Use the best model for every prompt. Automatically.

niuron picks between OpenAI, Anthropic, Gemini and your own models on quality, cost and latency — and shows why it chose.

One API. Many models. niuron decides which one to use on every request.OpenAI-compatible, with fallback, caching and BYOK.

live routing decision
POST/v1/chat/completionsmodel: "niuron/auto" · task: summarization
router.route()
OpenAI
gpt-4o-mini
$0.15/1M inscore 0.71
Anthropic
claude-3-5-haiku
$0.80/1M inscore 0.68
Gemini
gemini-1.5-flash
$0.075/1M inscore 0.79
selected
self-hosted
qwen2.5-0.5b
$0.00 inscore 0.44
estimated cost
$0.0011
gemini-1.5-flash
reference model
$0.0120
claude-3-5-haiku · highest-quality eligible
savings
$0.0109
91% less
Routed to gemini-1.5-flash: it handles summarization and costs 91% less than the reference model, claude-3-5-haiku (highest-quality eligible).

Name the job. niuron picks the model.

Hardcoding a model name means re-testing every time a better or cheaper one ships. A niuron model is a routing rule instead: the quality bar, latency budget and capabilities one kind of work needs, resolved against the live catalog on every request.

niuron/code

Code generation, review, debugging and refactors. Strong coding models that also answer fast.

  • coding quality
  • low latency
niuron/agent

Agents that call tools in a loop. Only models with reliable function calling and JSON, weighted hard toward speed because every step's latency stacks.

  • tool calls
  • JSON
  • speed
niuron/reason

Math, logic and multi-step analysis. Quality first: it will wait for a slower model when the answer needs it.

  • max quality
niuron/science

Derivations, data analysis and technical writing, with room for long papers in context.

  • max quality
  • 200k+ context
niuron/research

Long documents and many sources at once. Only models with a very large context window, tuned for careful synthesis.

  • 400k+ context
niuron/extract

Structured extraction and classification at volume. The cheapest model that returns valid JSON, and quickly.

  • cheapest
  • JSON
  • fast
niuron/write

Copy, articles and creative text. A quality bar for prose without paying reasoning-model prices.

  • prose quality
  • fast
niuron/translate

Translation and localization, quality-gated and tuned for speed.

  • fast
  • quality-gated

Pin any specific model whenever you want. niuron models are a shortcut, not a lock-in.

Your code stays. The base URL changes.

No new SDK and no wrapper library. Three steps, and the last one is watching it work.

  1. 1

    Sign up, grab a key

    Starter credit included, no card required. Your first API key is one click away in the dashboard.

    Dashboard → API keys
    productionar_live_9f3k••••••••a1c2active
  2. 2

    Point your client at us

    Swap the base URL and key in your existing OpenAI SDK. Everything else, from messages to streaming to tool calls, stays the same.

    your client config
    base_url = "https://api.openai.com/v1"base_url = "https://api.niuron.ai/v1"api_key  = "sk-..."api_key  = "ar_live_..."
  3. 3

    Watch it route

    Every request is classified and scored against your registered models, then sent to the best eligible one.

    Requestsillustrative
    • 12:04:11niuron/codeclaude-sonnet-5
      anthropic1.2s$0.0041
    • 12:04:13niuron/freenemotron-3-superfree
      nvidia0.8s$0.0000
    • 12:04:19niuron/autogpt-4o-mini
      openai0.7s$0.0002
    • 12:04:22niuron/autogpt-4o-minicached
      openai4ms$0.0000

Delete the glue code.

Every provider you call directly adds an SDK, a key, a bill and an outage plan. This is the pull request niuron makes possible.

app/llm.py−17+2
from openai import OpenAIfrom anthropic import Anthropicimport google.generativeai as genai openai_client = OpenAI(api_key=OPENAI_KEY)claude = Anthropic(api_key=ANTHROPIC_KEY)genai.configure(api_key=GEMINI_KEY)
One API, one bill

One OpenAI-compatible endpoint and one balance. No separate contract, key or invoice for each provider.

def ask(prompt):    for provider in (openai_client, claude, gemini):        try:            return provider.complete(prompt, timeout=20)        except (RateLimit, Timeout, ServerError):            time.sleep(backoff()); continue    raise AllProvidersDown
Automatic failover

Retries, fallback chains and a circuit breaker for every provider. A provider outage isn't your outage.

MODEL_BY_TASK = {"code": "gpt-4o", "summarize": "claude-haiku"}def pick_model(task, budget):    ...  # re-tested every time a better or cheaper model shipsclient = OpenAI(base_url="https://api.niuron.ai/v1", api_key=NIURON_KEY)client.chat.completions.create(model="niuron/code", messages=msgs)
Switch models, keep the code

Pin a model or send niuron/code. Same request, same response shape, no code change either way.

Illustrative code. Your stack will differ; the shape of the work does not.

integrate

OpenAI-compatible. Point your existing client at /v1/chat/completions with your router API key — no new SDK to learn.

curl
curl https://api.niuron.ai/v1/chat/completions \
  -H "Authorization: Bearer ar_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "niuron/auto",
    "messages": [{"role": "user", "content": "Explain routing in one sentence."}]
  }'
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.niuron.ai/v1",
    api_key="ar_live_...",  # Dashboard -> API keys
)

resp = client.chat.completions.create(
    model="niuron/auto",  # or niuron/code, niuron/agent... or pin "gpt-4o"
    messages=[{"role": "user", "content": "Explain routing in one sentence."}],
)
node
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.niuron.ai/v1",
  apiKey: "ar_live_...", // Dashboard -> API keys
});

const resp = await client.chat.completions.create({
  model: "niuron/auto", // or niuron/code, niuron/agent... or pin "gpt-4o"
  messages: [{ role: "user", content: "Explain routing in one sentence." }],
});

model: "niuron/auto" lets the router pick (leave the field out and you get it too). Use a job like niuron/code or niuron/agent when you know the work, or pin a specific model (e.g. gpt-4o, claude-sonnet-5). The response shape is identical either way.

works with your agent

Every OpenAI-compatible coding agent takes the same two settings. Swap them in, pick niuron/code as the model, and keep the tool you already use.

Claude Code — shell — real Anthropic Messages API, not a shim
export ANTHROPIC_BASE_URL=https://api.niuron.ai
export ANTHROPIC_AUTH_TOKEN=ar_live_...
export ANTHROPIC_MODEL=niuron/auto
Codex CLI — ~/.codex/config.toml — stateless Responses compatibility
[model_providers.niuron]
base_url = "https://api.niuron.ai/v1"
env_key = "NIURON_API_KEY"
wire_api = "responses"
GitHub Copilot CLI — shell, before running `copilot` — Copilot CLI's own BYOK
export COPILOT_PROVIDER_BASE_URL=https://api.niuron.ai/v1
export COPILOT_PROVIDER_API_KEY=ar_live_...
export COPILOT_MODEL=niuron/auto
Cursor — Settings -> Models -> Add Model -> enable "Override OpenAI Base URL"
Base URL:  https://api.niuron.ai/v1
API Key:   ar_live_...
(click Verify)
Cline — VS Code -> Cline settings (gear icon) -> API Provider -> "OpenAI Compatible"
Base URL:  https://api.niuron.ai/v1
API Key:   ar_live_...
Model ID:  niuron/code
Roo Code — VS Code -> Roo Code settings (gear icon) -> API Provider -> "OpenAI Compatible"
Base URL:  https://api.niuron.ai/v1
API Key:   ar_live_...
Model:     niuron/code
Kilo Code — VS Code -> Kilo Code settings -> API Provider -> "OpenAI Compatible"
Base URL:  https://api.niuron.ai/v1
API Key:   ar_live_...
Continue.dev — config.yaml
models:
  - name: niuron
    provider: openai
    model: niuron/code
    apiBase: https://api.niuron.ai/v1
    apiKey: ar_live_...
Zed — settings.json, or Agent Panel -> Add Provider
"language_models": {
  "openai_compatible": {
    "niuron": {
      "api_url": "https://api.niuron.ai/v1",
      "available_models": [
        { "name": "niuron/auto", "max_tokens": 128000 }
      ]
    }
  }
}
JetBrains AI Assistant — Settings -> Tools -> AI Assistant -> Providers & API keys
Provider:  OpenAI-compatible
Base URL:  https://api.niuron.ai/v1
API Key:   ar_live_...
Aider — shell
export OPENAI_API_BASE=https://api.niuron.ai/v1
export OPENAI_API_KEY=ar_live_...
aider --model openai/niuron/code
Hermes Agent — ~/.hermes/.env
OPENAI_BASE_URL=https://api.niuron.ai/v1
OPENAI_API_KEY=ar_live_...
explainable routing

You shouldn't have to trust a router blindly.

Each response can show which model was chosen, which alternatives were considered, the estimated cost and the savings.

Savings against a named reference
Savings are measured against one named model: the highest-quality eligible one for that request. If the winner already is that model, savings are zero.
Same shape, one extra key
The decision comes as a routing object next to the OpenAI fields, so current SDKs keep working. On streams it arrives in the X-Niuron-Routing header.
You can check it
Shadow routing can replay a sample of traffic on the runner-up models and record real cost and latency side by side.
response · POST /v1/chat/completions
{
  "id": "chatcmpl-9f2a41c7",
  "object": "chat.completion",
  "model": "gemini-1.5-flash",
  "choices": [ … ],
  "usage": { "prompt_tokens": 12038, "completion_tokens": 604, "total_tokens": 12642 },
  "routing": {
    "selected_model": "gemini-1.5-flash",
    "selected_provider": "gemini",
    "strategy": "auto",
    "estimated_cost_usd": 0.0011,
    "baseline_model": "claude-3-5-haiku",
    "baseline_cost_usd": 0.0120,
    "estimated_savings_usd": 0.0109,
    "reason": "Best score for summarization tasks under auto routing - quality 84%, about 91% cheaper than claude-3-5-haiku, the highest-quality eligible option.",
    "alternatives": [
      { "model": "gpt-4o-mini",
        "provider": "openai",
        "estimated_cost_usd": 0.0022 },
      { "model": "claude-3-5-haiku",
        "provider": "anthropic",
        "estimated_cost_usd": 0.0120 }
    ]
  }
}

And everything you expect from a router.

  • OpenAI-compatible API
  • OpenAI, Anthropic, Gemini and more
  • Automatic fallback and retries
  • Exact and semantic cache
  • Bring your own keys
  • Free-tier chaining
  • Streaming
  • Per-request cost tracking
  • Self-hosted models
capabilities
reliability

A provider outage isn't your outage

Retries with full-jitter backoff, a circuit breaker per provider, and automatic fallback chains keep requests flowing.

routing

Scored on every request

Each request is classified and scored on quality, cost, latency and reliability. The best eligible model wins.

caching

Don't pay for the same answer twice

Exact-match and semantic (pgvector) caching cut repeat costs to zero, with tenant isolation and configurable safeguards.

shadow routing

Try a model without the risk

Sample real traffic to an alternate model and compare it against production — your client only ever sees the response you chose to serve.

observability

See where every request went

Cost, latency, cache hits, and the routing decision behind them — queryable in the dashboard, in real time.

Ready to stop picking models by hand?