Open WebUI with Nadir

Add prompt-aware model choice to Open WebUI with a filter function: Nadir sizes each message and Open WebUI sends it to the model you set for that tier.

Prompt-aware model choice for Open WebUI, as a filter function. Attach it to one model, for example a workspace model called Nadir Auto. Before each message to that model, the filter asks Nadir whether the message is simple, medium or complex, and Open WebUI sends it to the model you set for that tier.

Nadir only returns the tier. Your connections and provider keys stay in Open WebUI and the chat never passes through Nadir.

Setup

1. Import the function

As an admin, open Admin Panel, Functions, then Import from link, and paste:

Function URL
https://getnadir.com/integrations/open-webui/nadir_router.py

Read the code before you save it; it is about 90 lines. Then turn the function on.

2. Set the valves

Open the function's valves and enter model IDs exactly as Open WebUI lists them. They can come from any connection you already have.

Valves
simple_model:   claude-haiku-4-5
medium_model:   claude-sonnet-5        # optional
complex_model:  claude-opus-5
nadir_api_key:  ndr_...                # optional

3. Attach it to a model

In Workspace, Models, create a model named Nadir Auto on top of your complex model, and tick the Nadir Router filter. Choosing Nadir Auto in a chat turns routing on. Every other model is untouched.

Users who are not admins need access to all three tier models, since Open WebUI checks access on the model a message is routed to.

Behavior

  • Each message is classified on its own, so one chat can move between tiers. With show_status on, the reply carries a line such as Nadir: simple -> claude-haiku-4-5.
  • Without medium_model, medium messages go to the complex model.
  • Images, empty messages, missing valves, an unknown tier, an error or a timeout (2 seconds by default) all leave the model as it was. The filter fails open.
  • The filter sends up to 8,192 characters of the latest user message and nothing else: no system prompt, files or earlier turns.

With or without a key

Without nadir_api_key the filter uses the free anonymous tier of api.getnadir.com. It is rate-limited per IP and keeps no per-request record, only aggregate counts. With a key, decisions appear in your Nadir dashboard. base_url points the filter at a self-hosted Nadir deployment instead; a trailing /v1 is stripped.

See the Decision API for the full contract.

What Nadir is

Nadir is an LLM router. Nadir sends each prompt to the cheapest model that can handle it. A small decision model reads each prompt against your model menu and picks the lowest-cost model it expects to handle it. When the decision model is uncertain or unavailable, the request goes to the strongest model on the menu. The routing step makes no call to your model provider.

Nadir runs two ways. The decision API returns a model, reasoning-effort, cache, context, and policy recommendation without calling a model provider, beside the gateway you already run. That is how a shadow-mode evaluation works, and its projected savings stay advisory. The OpenAI compatible managed proxy executes the route, and migration is a two-line change: point the base URL at api.getnadir.com and set model to auto. On that path an optional verifier can score a complete non-streaming answer and escalate to a stronger model when it misses the configured bar. Streaming bypasses post-generation verification. BYOK is supported on every tier.

For coding agents, Nadir Auto is a terminal launcher for Claude Code or Codex that asks Nadir for the main-session model before each turn, with your configured model as the fallback and cost ceiling. Delegation integrations for Claude Code, Codex, or Cursor instead recommend a model tier for subagent work, and the agent decides; the Claude plugin can also move a main-thread turn to Haiku when Nadir's cache check prices it cheaper, unless its switch_main_model option is off. Either way inference runs on your own provider account, so Nadir holds no provider keys on that path.

What the numbers are, and what they are not

Nadir publishes each evaluation with its scope. On checkable code, run-check-escalate solved 392 of 395 common HumanEval and MBPP problems (99.2%), graded by running the canonical tests; that applies only to tasks with runnable deterministic tests. Nadir-Tumbler posts an arena_score of 72.3 on RouterArena's public scorer, 5th of 23 routers, which measures the routing decision on RouterArena's own model pool. A reference-assisted RouterBench evaluation over 11,420 held-out triples produced a 60% lower projected cost than always-Opus with about 98% retained quality and a 1.7% catastrophic-route rate. That experiment gave the verifier the expensive-model reference answer, which production does not have, so it is a research ceiling and not the deployed path.

None of these is a production guarantee, a universal savings rate, or a forecast for any particular workload. Customer savings are reported from measured execution against a declared baseline, and customer quality only from outcome-labelled traffic. Projected savings and realized savings are separate artifacts and are never blended.

Design-partner program

Three rungs, picked by risk appetite. Rung 0 Shadow runs advisory decision calls alongside live traffic and returns a projected receipt, with nothing in the request path changed. Rung 1 Hosted is the two-line swap on a production slice and returns a realized receipt. Rung 2 On-prem is a supervised six-week proof of concept inside the partner's VPC, where no prompt, response, or usage reaches Nadir. The commitments are the same at every rung. Apply for a rung directly: Rung 0 Shadow, Rung 1 Hosted, or Rung 2 On-prem. Not sure which fits? Start at getnadir.com/contact/?reason=design-partner.

Licensing

NadirClaw is the self-hosted core, source-available under the PolyForm Noncommercial License. Source-available is the correct label; NadirClaw is not open source. Nadir Route's hosted plan has no base fee and charges a variable fee only on measured savings from requests Nadir executed.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.