LaunchKit · 2026
Back to Skills

rotate-openrouter-key

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

0
338 downloads
by @chunhualiao

Setup & Installation

openclaw skills install @chunhualiao/rotate-openrouter-key

Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:

npx clawhub install rotate-openrouter-key

What This Skill Does

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.

When to use it

  • 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

Example Workflow

Here's how your AI assistant might use this skill in practice.

INPUT

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

AGENT
  1. 1Confirm the new key starts with sk-or-v1-
  2. 2Search all files under ~/.openclaw/ for the existing key pattern
  3. 3Run update-openrouter-key.py with --dry-run to preview what will change
  4. 4Run update-openrouter-key.py with --verify to update all locations and confirm the new key is accepted by OpenRouter
  5. 5Restart the gateway with openclaw gateway restart
OUTPUT

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

Requirements

Accounts, API keys, or tools you or your AI assistant may need to set up while using this skill.

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