This is an early release preview. You may encounter bugs.
NadirClaw logo
Unclaimed

Tool inference

NadirClaw

Open-source LLM router & AI cost optimizer. Routes simple prompts to cheap/local models, complex ones to premium — automatically. Drop-in Op

A 81/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About NadirClaw.

NadirClaw is a self-hosted LLM router that sits between a client and the model providers as a local proxy. For each request it predicts the smallest model likely to answer, sends the prompt there first, checks the response against quality heuristics (refusals, truncation, malformed JSON), and escalates to the next tier when the response falls below an acceptance threshold of 0.80. Each routed request is priced against a baseline so the saving is measured per request rather than estimated.

Classification uses a sentence-embedding centroid classifier with about 10 ms of overhead, with an opt-in fine-tuned DistilBERT three-class classifier and a bundled trained checkpoint as alternatives. Routing modifiers override the score: agentic tool loops, reasoning markers, image content, and long context force a stronger tier. A YAML rule engine adds per-prompt overrides such as forced escalation on patterns where the verifier is unreliable, and tier profiles are N-tier YAML files that hot-reload from disk.

The proxy exposes both an OpenAI-compatible chat completions endpoint and an Anthropic-compatible messages endpoint, so OpenAI-style clients (Open WebUI, Cursor, Continue, Codex, OpenClaw) and Anthropic-native clients (Claude Code) route through it with their streaming piped through unchanged. Onboarding commands write NadirClaw in as a model provider for OpenClaw, Codex, Claude Code, and Continue. Gemini models are called natively through the Google GenAI SDK, and every other model goes through LiteLLM. Ollama instances on the local network are discovered automatically, and OAuth login lets a subscription with OpenAI, Anthropic, or Google stand in for an API key.

Published measurements come from the trained classifier and DeBERTa verifier in the hosted Nadir Pro, which shares the routing architecture with the open-source core (whose classifier is the simpler binary centroid). On the RouterBench held-out set (n=11,420) the composed system reports AUROC 0.961, expected calibration error 0.016, 98.3% quality preserved against always using the top model, a 1.7% catastrophic-downgrade rate, and 60% lower cost. On RouterArena sub_10 (n=809) the composite score is 0.7118, a projected rank of #5. A contamination audit reports zero overlap between the training corpus and either held-out set.

The open-source core differs from Nadir Pro in several ways: a rule-based heuristic verifier rather than a trained cross-encoder, local JSONL and SQLite storage rather than Postgres, a terminal and local web dashboard rather than a hosted one, and no team features. Cost tracking, reports, budgets, Prometheus metrics, optional OpenTelemetry tracing, and a GitHub Action are included in the core.

  • Route, verify, escalate: sends each prompt to the cheapest tier predicted to answer, scores the reply with a heuristic verifier, and steps up a tier when the score falls below 0.80
  • Pluggable classifier: a binary centroid classifier (about 10 ms), an opt-in three-class DistilBERT, or a bundled trained checkpoint, with a sentence-transformer embedding model loaded on first use
  • N-tier YAML profiles: one classifier head with any number of tiers, a default two-tier cascade tuned on RouterArena, and custom profiles that hot-reload from disk
  • Cascade rule engine: declarative YAML rules force escalation, raise the verifier threshold, force the cheap tier, or cap max tokens per prompt pattern
  • Routing modifiers: agentic task detection, reasoning detection, vision routing to an image-capable model, context-window filtering, and session persistence that pins a model for a multi-turn thread
  • Two API surfaces: an OpenAI-compatible chat completions endpoint and an Anthropic-compatible messages endpoint, both streaming over SSE
  • Client onboarding: commands configure OpenClaw, Codex, Claude Code, and Continue to use NadirClaw as a model provider, with setup instructions for Open WebUI and Cursor
  • Providers: Gemini called natively through the Google GenAI SDK, Ollama with local-network auto-discovery, custom OpenAI-compatible endpoints, and any provider LiteLLM supports
  • OAuth login: an OpenAI, Anthropic, or Google subscription stands in for an API key, with token refresh handled by the router
  • Context Optimize: compacts JSON, tool schemas, chat history, and whitespace before dispatch in lossless, aggressive, or progressive modes, with an optional Headroom backend
  • Fallback chains and rate limits: cascades through a configurable chain of models on 429, 5xx, or timeout, and triggers the chain when a per-model request limit is hit
  • Cost tooling: per-request spend tracking, daily and monthly budgets with alerts, cost and savings reports, CSV or JSONL log export, a Prometheus metrics endpoint, optional OpenTelemetry tracing, and terminal or web dashboards

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with NadirClaw.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get NadirClaw →

Browse the catalog