← 返回
未分类 Key 中文

Infinity Router

Routes AI requests across free OpenRouter models for OpenClaw and Claude Code. Auto-discovers, scores, and configures the best free model with a smart fallba...
将 AI 请求路由到 OpenClaw 和 Claude Code 的免费 OpenRouter 模型,自动发现、打分并配置最佳免费模型,配备智能回退机制。
genoshide genoshide 来源
未分类 clawhub v2.1.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 282
下载
💾 0
安装
1
版本
#free-ai#latest#llm-routing#model-fallback#openclaw#openrouter#rate-limit

概述

infinity-router

What it does

Configures OpenClaw (or Claude Code) to use free AI models from OpenRouter.

Selects the best tool-capable model as primary, builds a ranked fallback chain so

rate limits cause zero interruption, and leaves the rest of the config untouched.

Only chat models are selected — audio, image, video, and embedding models are

automatically filtered out. Models that claim tool support but fail at runtime

(e.g. Gemma) are excluded from tool scoring.

Prerequisites

1. API key(s)

# Single key
openclaw config set env.OPENROUTER_API_KEY "sk-or-v1-..."

# Multiple keys (comma-separated) — recommended to avoid daily free-tier limits
openclaw config set env.OPENROUTER_API_KEY "sk-or-v1-KEY1,sk-or-v1-KEY2,sk-or-v1-KEY3"

For OpenClaw inference key rotation, add each key as a separate profile in

~/.openclaw/agents/main/agent/auth-profiles.json:

{
  "version": 1,
  "profiles": {
    "openrouter:default": { "type": "api_key", "provider": "openrouter", "key": "sk-or-v1-KEY1" },
    "openrouter:key2":    { "type": "api_key", "provider": "openrouter", "key": "sk-or-v1-KEY2" },
    "openrouter:key3":    { "type": "api_key", "provider": "openrouter", "key": "sk-or-v1-KEY3" }
  }
}

> Note: the file is auth-profiles.json (with s), not auth-profile.json.

2. Install

On Debian/Ubuntu servers (Python 3.12+), use the provided script:

cd /path/to/infinity-router
chmod +x install.sh
./install.sh
which infinity-router    # should return /usr/local/bin/infinity-router

To uninstall: ./uninstall.sh

Standard workflow

# 1. Configure best model + fallback chain
infinity-router pick

# 2. Apply to the running gateway
openclaw gateway restart

For a safer run that validates each model before writing (avoids stale/broken models):

infinity-router pick --validate
openclaw gateway restart

Command reference

CommandWhen to run
----------------------
infinity-router pickSet up best free model + fallbacks (most common)
infinity-router pick --validateProbe each candidate before writing — avoids "Unknown model" errors
infinity-router pick -fKeep current primary, rebuild fallbacks only
infinity-router pick -c 10Use 10 fallbacks instead of default 5
infinity-router pick --authAlso add OpenRouter auth profile to OpenClaw
infinity-router scanBrowse all available free models
infinity-router scan -n 30Show all 30+ models
infinity-router use deepseekSet a specific model (partial name OK)
infinity-router use qwen3-coder -fAdd model to fallbacks only
infinity-router use deepseek --validateSet model and validate fallbacks
infinity-router benchLatency-test top 5 models
infinity-router bench -c 10Test top 10 models
infinity-router statusShow current config, all API keys, cache age
infinity-router watchTail gateway log, auto-rotate + restart on failures
infinity-router watch --verboseAlso print every matched failure line
infinity-router watch --notify URLPOST rotation event to webhook on each rotate
infinity-router resetRemove model config from target
infinity-router reset --clear-rlAlso clear rate-limit cooldown records

Always run openclaw gateway restart after any command that changes config.

Config targets

infinity-router pick                        # default: openclaw
infinity-router pick --target claude-code   # Claude Code settings.json

What gets written (OpenClaw)

Only these keys in ~/.openclaw/openclaw.json:

  • agents.defaults.model.primary — e.g. openrouter/meta-llama/llama-3.3-70b-instruct:free
  • agents.defaults.model.fallbacks — e.g. ["openrouter/free", "mistralai/mistral-small:free", …]
  • agents.defaults.models — model allowlist

The first fallback is always openrouter/free — OpenRouter's smart router that

auto-picks the best available model for each request.

Daemon (auto-rotation)

infinity-router-daemon            # one-shot check
infinity-router-daemon --loop     # continuous monitoring
infinity-router-daemon --rotate   # force rotate now
infinity-router-daemon --status   # rotation history
infinity-router-daemon --clear-rl # reset all cooldowns

Daily maintenance

Run once a day or when models start failing:

rm -f ~/.infinity-router/model-cache.json
infinity-router pick
openclaw gateway restart

Troubleshooting

ProblemFix
--------------
infinity-router: command not foundRun ./install.sh from the project directory
OPENROUTER_API_KEY not setGet a free key at https://openrouter.ai/keys
Config not taking effectopenclaw gateway restart, then /new in Telegram
Unknown model errors in gateway logStale cache — rm ~/.infinity-router/model-cache.json && infinity-router pick --validate
Agent gives fake/hallucinated responsesModel doesn't support tools — run infinity-router pick --validate to get a real tool-capable model
All probes return rate_limitDaily free quota exhausted — wait for UTC midnight reset, or add more API keys
HTTP 429: free-models-per-dayAdd more keys comma-separated in env.OPENROUTER_API_KEY, or add separate profiles to auth-profiles.json
Something went wrong in TelegramRun infinity-router status to see active model, then openclaw gateway restart and /new

版本历史

共 1 个版本

  • v2.1.0 当前
    2026-05-07 23:15 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

wallet-mcp

genoshide
在Solana和EVM链上生成、管理并执行多链钱包操作,输出JSON格式,包括批量转账、扫币、扫描、导入和导出等。
★ 0 📥 410
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,174 📥 945,244
ai-agent

Find Skills

root
帮助用户发现和安装智能体技能,当用户询问如「如何做X」、「找X的技能」、「有能做...的吗」等问题时
★ 1,526 📥 582,183