โ† All skills
Tencent SkillHub ยท Developer Tools

Rotate OpenRouter Key

Safely rotate the OpenRouter API key across all config files in an OpenClaw installation. Finds every location where the key is stored, updates them, restart...

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Safely rotate the OpenRouter API key across all config files in an OpenClaw installation. Finds every location where the key is stored, updates them, restart...

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
CHANGELOG.md, README.md, SKILL.md, references/key-rotation-guide.md, scripts/update-openrouter-key.py, skill.yml

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.0

Documentation

ClawHub primary doc Primary doc: SKILL.md 12 sections Open source page

Rotate OpenRouter Key

Safely replace the OpenRouter API key across an entire OpenClaw installation, handling all config locations, priority chains, and verification.

When to Use

User says "rotate my openrouter key" or "change openrouter key" User reports 401 errors from OpenRouter User disabled an old key and needs to set a new one Periodic key rotation for security

Key Priority Chain

OpenClaw reads the OpenRouter API key from three sources, highest priority first: ~/.openclaw/.env โ€” environment file, overrides everything ~/.openclaw/agents/<name>/agent/models.json โ€” per-agent config ~/.openclaw/openclaw.json โ€” global config If a higher-priority source has the old key, updating a lower-priority file has no effect. You must update the key at whichever level it is actually being read from.

Step 1: Get the New Key

Ask the user for the new key. It must start with sk-or-v1-. If the user doesn't have one yet, direct them to openrouter.ai/keys to generate one.

Step 2: Find All Key Locations

# Find every file containing an OpenRouter key grep -r "sk-or-v1" ~/.openclaw/ --include="*.json" --include=".env" -l 2>/dev/null # Also check for uncommented key in .env grep -v '^#' ~/.openclaw/.env 2>/dev/null | grep OPENROUTER_API_KEY Report what you found to the user before making changes.

Step 3: Update All Locations and Verify

Run the helper script โ€” it handles both .env and JSON files in one pass: python3 scripts/update-openrouter-key.py --key "sk-or-v1-NEW-KEY" --verify The script: Finds all config files (.env + JSON) containing an openrouter key Creates timestamped backups before each write Updates only the key value (minimal change) Verifies the new key against the OpenRouter API Reports what it changed Preview first with --dry-run: python3 scripts/update-openrouter-key.py --key "sk-or-v1-NEW-KEY" --dry-run

Step 4: Restart Gateway

openclaw gateway restart

Step 5: Remote Hosts (if applicable)

If the user manages OpenClaw on other machines, repeat Steps 2-5 via SSH: ssh <host> "grep -r 'sk-or-v1' ~/.openclaw/ --include='*.json' --include='.env' -l" Then run the update script remotely or copy it over.

Step 6: Disable Old Key

Only after verifying the new key works everywhere, tell the user they can now safely disable/delete the old key at openrouter.ai/keys.

Scope & Boundaries

Handles: Finding, updating, and verifying OpenRouter API keys in all OpenClaw config locations. Does NOT handle: Other provider keys (Anthropic, OpenAI). Key generation (user does that on openrouter.ai). Billing or usage issues.

Error Handling

ErrorCauseFix401 after updateMissed a config locationRe-run Step 2 to find remaining old keysKey works in curl but not in bot.env has old key overriding JSONCheck and update .envGateway won't restartUnrelated issueopenclaw gateway stop && openclaw gateway startRemote host still failingForgot to update remote configsSSH in and repeat Steps 2-5

Limitations

Cannot generate or revoke keys (user must do that on openrouter.ai) Cannot update keys on remote hosts without SSH access Does not handle keys stored outside ~/.openclaw/ (e.g., in systemd environment files)

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
4 Docs1 Scripts1 Config
  • SKILL.md Primary doc
  • CHANGELOG.md Docs
  • README.md Docs
  • references/key-rotation-guide.md Docs
  • scripts/update-openrouter-key.py Scripts
  • skill.yml Config