NadirClaw

Open-source LLM router and cost optimizer with an OpenAI-compatible proxy

open-sourcetool-integration
655
Stars
+46
Stars/month
13
Commits (90d)
10
Releases (6m)

Star Growth

+287 (78.0%)
361515669Mar 27Oct 2

Overview

NadirClaw 是一个开源的 LLM 路由器和 AI 成本优化工具,通过智能分析提示复杂度自动将请求路由到最合适的模型。它能识别简单任务(如代码格式化、简单问答)并将其发送到成本更低的模型(如 Gemini Flash、Claude Haiku),而将复杂任务(如代码重构、调试)路由到高端模型。该工具作为 OpenAI 兼容的代理运行,可无缝集成到 Claude Code、Cursor、Continue、Aider 等开发工具中。NadirClaw 在本地运行,确保 API 密钥安全,支持故障转移链,并提供实时成本追踪和预算管理功能。分类延迟仅约 10ms,几乎不影响使用体验,但能在实际使用中节省 40-70% 的 AI API 成本。

Deep Analysis

Key Differentiator

Local-first LLM cost optimizer — classifies prompt complexity in 10ms and routes simple requests to 10-20x cheaper models, with no third-party proxy or middleman

⚡ Capabilities

  • • LLM request routing to cheaper models for simple prompts
  • • 10ms prompt classification overhead
  • • Three-tier routing (simple/mid/complex)
  • • Agentic task auto-detection
  • • Context optimization (input token compaction)
  • • Session persistence for multi-turn conversations
  • • Cost tracking dashboard and budget alerts
  • • Fallback chains with automatic failover
  • • Prometheus metrics and OpenTelemetry tracing

🔗 Integrations

OpenAIAnthropicGoogle GeminiOllamaLiteLLMClaude CodeCursorContinueAiderWindsurfOpen WebUI

✓ Best For

  • ✓ Teams spending heavily on LLM APIs wanting 40-70% cost reduction
  • ✓ AI coding assistants (Claude Code, Cursor) with mixed complexity prompts
  • ✓ Budget-conscious developers using multiple LLM providers

✗ Not Ideal For

  • ✗ Applications where every request needs top-tier model quality
  • ✗ Ultra-low-latency requirements where 10ms matters

Languages

Python

Deployment

pip installDockerDocker Compose (with Ollama)GitHub Action

Pricing Detail

Free: Open-source, self-hosted; works with free-tier providers (Gemini, Ollama)
Paid: N/A — pay only for LLM API usage

⚠ Known Limitations

  • ⚠ Classification may occasionally misroute complex prompts
  • ⚠ Requires Python 3.10+
  • ⚠ Adds ~10ms latency per request
  • ⚠ Newer project — smaller community

Pros

  • + 显著成本节省:通过智能路由可节省 40-70% 的 AI API 成本,特别适合高频使用场景
  • + 即插即用兼容性:作为 OpenAI 兼容代理,可直接集成到现有的 AI 开发工具中无需修改代码
  • + 隐私保护设计:完全本地运行,API 密钥和数据不会发送到第三方服务器

Cons

  • - 分类准确性依赖:可能存在复杂度判断错误,导致重要任务被路由到能力不足的模型
  • - 配置复杂性:需要设置和管理多个模型提供商的 API 密钥和配置
  • - 额外运行开销:需要运行本地代理服务,增加了系统复杂度

Use Cases

  • • 开发团队降低 AI 辅助编程成本:在日常代码审查、文档生成、简单问答中使用便宜模型,复杂架构设计使用高端模型
  • • AI 应用开发中的成本控制:在构建聊天机器人或 AI 助手时,根据用户查询复杂度智能选择模型以控制运营成本
  • • 大规模内容处理任务:在批量文本处理、翻译、格式化等场景中,自动筛选简单任务使用低成本模型完成

Getting Started

1. 安装:执行 `pip install nadirclaw` 从 PyPI 安装工具;2. 配置:设置各个模型提供商的 API 密钥和路由规则;3. 启动使用:运行 `nadirclaw serve` 启动代理服务器,然后将现有 AI 工具的 API 端点指向 localhost:8856 即可开始智能路由

Alternatives

See all 8 NadirClaw alternatives →

Works with NadirClaw

Tools that integrate with NadirClaw, often used together in the same stack.

Compare NadirClaw

Maintain NadirClaw?

Show your live rank in your README, or put NadirClaw in front of every visitor to AgentoolRank.