扫描 OpenRouter 上的可用免费模型(零成本),对其进行基准测试,按能力评分,并将最佳模型自动更新至 OpenClaw 配置。适用于:“ro...
bash
# Full flow: scan → bench → test → update → restart (recommended)
scripts/rotate_free_models.py --api-key "sk-or-xxx" --restart
# Quick rotate (no bench, just connectivity)
scripts/rotate_free_models.py --api-key "sk-or-xxx" --test 30 --keep 10 --restart
# Scan + show ranked by score (no changes)
scripts/rotate_free_models.py --api-key "sk-or-xxx" --scan --sort score
# Quality benchmark
scripts/rotate_free_models.py --api-key "sk-or-xxx" --bench --json report.json
# Filter: only multimodal models
scripts/rotate_free_models.py --api-key "sk-or-xxx" --filter multimodal --restart
# Use cached results (<1h old), skip retesting
scripts/rotate_free_models.py --api-key "sk-or-xxx" --use-cache --keep 10
# Save JSON report
scripts/rotate_free_models.py --api-key "sk-or-xxx" --json /tmp/report.json
FlagDefaultDescription--api-key``$OPENROUTER_API_KEYOpenRouter API key--test N``0 (all)Max models to test--keep N``10Working models to keep in config--workers N``5Concurrent test workers--timeout N``15Per-model timeout (seconds)--benchoffEnable quality benchmark--filter TYPE``allall/text/multimodal/image/reasoning/fast/large--sort BY``scorescore/latency/name--use-cacheoffUse 1h cached results--json FILEnoneSave JSON report--restartoffRestart gateway after update--no-updateoffDon't change configs--scanoffScan only, no testing
Models are ranked by a weighted composite:
FactorWeightEffectContext window+2 per 100K tokensMore context = higher scoreMax output tokens+0.5 per 1KLonger output = higherImage input+5Multimodal bonusAudio input+5Multimodal bonusVideo input+3Advanced capabilityReasoning support+8Chain-of-thought bonusLatency-0.3 per 100msFaster = higher scoreBrand quality+2~5Qwen-Coder, Llama-70B, GPT, Gemini recognized
Run via cron every 6 hours for auto-rotation:
text
0 */6 * * * python3 rotate_free_models.py --api-key "sk-or-xxx" --restart > /var/log/model-rotate.log 2>&1