Self-host NadirClaw

Run NadirClaw, the self-hosted, source-available LLM router: install it, run the setup wizard with your keys, and serve a local OpenAI-compatible endpoint.

NadirClaw is a self-hosted, source-available CLI LLM router under the PolyForm Noncommercial License that automatically routes each request to the best model for the job. PolyForm Noncommercial licensed, runs locally, unlimited requests.

1. Install

Install via pip
pip install nadirClaw

2. Setup

Run the interactive setup wizard. It will ask for your provider API keys and let you pick which models to use for simple and complex requests.

Interactive setup
nadirclaw setup

3. Serve

Start the local router. By default it listens on port 8856.

Start the router
nadirclaw serve

4. Point your tools

Set your base URL to http://localhost:8856/v1 and your API key to local. Any OpenAI-compatible client works out of the box.

import openai

client = openai.OpenAI(
    base_url="http://localhost:8856/v1",
    api_key="local",
)

response = client.chat.completions.create(
    messages=[{"role": "user", "content": "Explain quantum computing"}],
    model="auto",  # let NadirClaw choose the best model
)

print(response.choices[0].message.content)

5. Understand the response

Responses follow the OpenAI format with an additional nadirclaw_metadata field showing routing decisions, latency, cost, and token savings.

Example response
{
  "id": "nadirclaw-a1b2c3d4",
  "object": "chat.completion",
  "model": "gemini-2.0-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Quantum computing uses qubits..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 85,
    "total_tokens": 97
  },
  "nadirclaw_metadata": {
    "complexity_tier": "simple",
    "routed_model": "gemini-2.0-flash",
    "latency_ms": 420,
    "cost_usd": 0.00003,
    "tokens_saved": 0
  }
}

Tip

Set model to "auto" (or omit it) to let NadirClaw's classifier pick the most cost-effective model. Or specify a model name like "claude-sonnet-4-20250514" to pin the request.

Pages on this site

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