跳到正文
TakoAPI
返回技能列表

rotate-openrouter-key

由 chunhualiao 提供

Coding Agents & IDEs
338下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Safely rotate the OpenRouter API key across all config files in an OpenClaw installation.

描述

该技能的功能

Handles OpenRouter API key rotation across an entire OpenClaw installation. Finds every config location where the key is stored, updates them according to the priority chain, restarts the gateway, and verifies the new key works before advising you to disable the old one.

Manually updating config files is error-prone because OpenClaw reads the key from three sources at different priority levels, so missing a higher-priority location means lower-priority updates have no effect.

何时使用

  • Replacing a leaked or compromised OpenRouter key
  • Rotating keys periodically for security compliance
  • Fixing 401 errors after disabling an old key on openrouter.ai
  • Updating all configs after generating a new key
  • Syncing a new key across multiple machines running OpenClaw

示例工作流

输入

User asks: rotate my OpenRouter key, I just generated sk-or-v1-abc123

智能体
  1. 1

    Confirm the new key starts with sk-or-v1-

  2. 2

    Search all files under ~/.openclaw/ for the existing key pattern

  3. 3

    Run update-openrouter-key.py with --dry-run to preview what will change

  4. 4

    Run update-openrouter-key.py with --verify to update all locations and confirm the new key is accepted by OpenRouter

  5. 5

    Restart the gateway with openclaw gateway restart

输出

All config files updated, gateway restarted, new key verified against the OpenRouter API. User advised to disable the old key at openrouter.ai/keys.

前置要求

  • OpenRouter account with a new API key generated at openrouter.ai/keys

安装

clawhub install chunhualiao/rotate-openrouter-key

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接