Token导航 LogoToken导航TokenDH.com
开发可写文件clawhub未标认证来源可访问clear审计提醒

updating-openrouter-free-models更新 openrouter 免费模型

Agent Skill

updating-openrouter-free-models 用于辅助测试设计、自动化测试和回归验证,适合在 OpenClaw 中需要补充测试、分析失败日志或验证功能改动时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

7,409

周安装

315

GitHub Stars

公开资料未说明

下载量

2,596
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:updating-openrouter-free-models(更新 openrouter 免费模型)
来源仓库:https://github.com/youshu3008/updating-openrouter-free-models
安装命令:
openclaw skills install updating-openrouter-free-models
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install updating-openrouter-free-models

简介

当需要在 Claude Code 或 OpenClaw 配置中获取、测试和更新 OpenRouter 免费模型列表时使用

SKILL.md

name
updating-openrouter-free-models
description
Use when needing to fetch, test, and update OpenRouter free model lists in Claude Code or OpenClaw configurations

Updating OpenRouter Free Models

Overview

A systematic, test-driven process for updating OpenRouter free models that ensures only verified working models are added to configuration files. Combines automated fetching, batch testing, and multi-config synchronization.

When to Use

Use when:

  • Adding new OpenRouter free models to configurations
  • Syncing model lists between Claude Code and OpenClaw
  • need to verify model availability before adding
  • Managing model fallbacks and availability allowlists

Do NOT use for:

  • Single model additions (manual edit is faster)
  • Paid model configurations (different testing criteria)
  • Other provider types (Anthropic, OpenAI direct)

Core Workflow

graph LR
    A[Fetch models from OpenRouter API] --> B[Batch test each model];
    B --> C{Pass test?};
    C -->|Yes| D[Add to verified list];
    C -->|No| E[Skip + log reason];
    D --> F[Update configurations];
    F --> G[Validate JSON syntax];
    G --> H[Self-test updated config];
    H --> I[Restart OpenClaw service];

Quick Reference

StepCommandPurpose
1python3 fetch_models.pyFetch all free models
2python3 test_models.pyBatch test availability
3node apply_updates_openclaw.jsUpdate OpenClaw config
4./restart_openclaw.shRestart service
5Validate JSONPrevent syntax errors

Implementation

Step 1: Fetch Free Models from OpenRouter API

# Use the provided fetcher script which implements comprehensive free model detection
python3 fetch_models.py

Free Model Detection: The script identifies free models by:

  • ID containing :free suffix, OR
  • All pricing fields (prompt, completion, request) equaling 0 or "0"

This captures models like openrouter/hunter-alpha that have zero pricing but lack the :free tag.

Step 2: Batch Test Availability

# Test each fetched model via API
python3 test_models.py

The script will:

  • Read models from /tmp/free_models.txt
  • Test each with a short API call
  • Save verified models to /tmp/verified_models.txt
  • Save failed models to /tmp/failed_models.txt with error reasons

Note: The script supports multiple token sources:

  • ANTHROPIC_AUTH_TOKEN (Claude Code compatibility)
  • OPENROUTER_API_KEY (OpenRouter direct)
  • OpenClaw config (~/.openclaw/openclaw.jsonmodels.providers.openrouter.apiKey)

Step 3: Update Claude Code Settings

# Generate JSON array for availableModels
cat > /tmp/availableModels.json << 'EOF'
$(python3 -c "
models = open('/tmp/verified_models.txt').read().strip().split('\
')
print('  \"availableModels\": [')
for i, m in enumerate(models):
    comma = ',' if i < len(models)-1 else ''
    print(f'    \"{m}\"{comma}')
print('  ],')
")

Then manually or programmatically insert into ~/.claude/settings.json.

Step 4: Update OpenClaw Configuration

import json
from pathlib import Path

# Read existing config
with open(Path.home() / '.openclaw' / 'openclaw.json', 'r') as f:
    config = json.load(f)

# Update provider models
verified = open('/tmp/verified_models.txt').read().strip().split('\
')
provider_models = []
fallbacks = []

for i, model_id in enumerate(verified):
    provider_models.append({
        "id": model_id,
        "name": model_id.split('/')[-1],
        "api": "openai-completions"
    })
    if i > 0:  # Skip primary (stepfun) from fallbacks
        fallbacks.append(f"openrouter/{model_id}")

config['models']['providers']['openrouter']['models'] = provider_models
config['agents']['defaults']['model']['fallbacks'] = fallbacks

# Add to agents.defaults.models
for model_id in verified:
    key = f"openrouter/{model_id}"
    if key not in config['agents']['defaults']['models']:
        config['agents']['defaults']['models'][key] = {}

# Save
with open(Path.home() / '.openclaw' / 'openclaw.json', 'w') as f:
    json.dump(config, f, indent=2)

print(f"Updated OpenClaw config with {len(verified)} models")

Step 5: Validate and Self-Test

# Validate JSON syntax
python3 -m json.tool ~/.claude/settings.json > /dev/null && echo "✓ Claude settings valid"
python3 -m json.tool ~/.openclaw/openclaw.json > /dev/null && echo "✓ OpenClaw config valid"

# Self-test: verify models field exists and is array
python3 -c "
import json
with open('~/.claude/settings.json') as f:
    cfg = json.load(f)
    assert 'availableModels' in cfg
    assert isinstance(cfg['availableModels'], list)
    print(f'✅ Claude: {len(cfg[\"availableModels\"])} models available')
"

Common Pitfalls

PitfallSymptomFix
Missing rate limitingAPI errors/timeoutsAdd time.sleep(0.5) between tests
Not filtering duplicatesSame model twiceUse set() on results
Forgetting fallbacks arrayOnly primary worksUpdate both models and fallbacks
Invalid JSON after editConfig won't loadRun python3 -m json.tool to validate
Skipping self-testBroken config deployedAlways run validation commands

Real-World Example

Before: Manually copying models from website → errors, outdated models, missing configs

After: Automated fetch + test → only verified models, synchronized configs, repeatable process

Anti-Patterns

❌ Add All Models Without Testing

# BAD: Just grab list and add everything
models = fetch_all()
# Problem: Some models may be rate-limited, deprecated, or region-blocked

❌ One Configuration Only

# BAD: Only update Claude settings, forget OpenClaw
update_claude_settings(verified_models)
# Problem: OpenClaw still has old list → inconsistent behavior

❌ No Self-Test

# BAD: Write file and assume it's correct
with open('settings.json', 'w') as f:
    json.dump(config, f)
# Problem: Syntax error breaks entire application

Testing Checklist

  • [ ] Fetch produces non-empty model list
  • [ ] All verified models pass API test in batch
  • [ ] Claude settings JSON is valid
  • [ ] OpenClaw JSON is valid
  • [ ] availableModels exists and is array
  • [ ] OpenClaw models.providers.openrouter.models updated
  • [ ] OpenClaw agents.defaults.model.fallbacks includes all except primary
  • [ ] OpenClaw agents.defaults.models has entries for all
  • [ ] Actual API call works with at least one model from new list

Maintenance

When to rerun this skill:

  • Monthly (OpenRouter adds/removes free models regularly)
  • After API error indicates specific model unavailable
  • Adding new configuration targets (e.g., new tool that uses OpenRouter)

What to update if API changes:

  • Model filter logic (free detection criteria may change - see is_free_model() in fetch_models.py)
  • Test request format (API endpoint may version)
  • Rate limits (adjust sleep duration)

OpenClaw-Specific Notes

OpenClaw Scripts

This skill includes OpenClaw-specific scripts in the workspace:

ScriptPurpose
test_models.pyBatch test models (same as Claude Code version)
apply_updates_openclaw.jsNode.js version for OpenClaw config updates
restart_openclaw.shRestart OpenClaw gateway service after update

Full OpenClaw Workflow

# 1. Fetch free models
python3 fetch_models.py

# 2. Test availability
python3 test_models.py

# 3. Apply to OpenClaw config
node apply_updates_openclaw.js

# 4. Restart OpenClaw service (required for config changes)
./restart_openclaw.sh

# 5. Verify
openclaw --version  # or test with a model

Why restart? OpenClaw loads configuration at startup. Changes to openclaw.json require restart to take effect.

Restart Methods

restart_openclaw.sh tries multiple methods:

  1. launchctl (if running as macOS service)
  2. pkill + nohup (manual restart)
  3. Reports errors if both fail

Logs: /tmp/openclaw-gateway.log

Testing After Update

# Check gateway is running
pgrep -f "openclaw.*gateway"

# Test model fallback (send a test message via your OpenClaw channel)
# If primary fails, it should automatically fall back to next model

See Also

  • OpenRouter API docs: https://openrouter.ai/docs
  • Claude Code settings schema: ~/.claude/settings.json structure
  • OpenClaw configuration: ~/.openclaw/openclaw.json model sections
  • OpenClaw gateway docs: openclaw gateway --help

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

98.52%
按下载量换算2,558

安全审计

VirusTotal

可疑

ClawScan

可疑

Static analysis

通过

权限和风险

可写文件

该 Skill 可能写入或修改本地文件,使用前需要确认目标目录和修改范围。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills