Agent skill · software engineering · jeremylongshore
openrouter-upgrade-migration
Migrate to OpenRouter from direct provider APIs or upgrade between SDK/model
Why this skill is useful
Adds executable migration scripts and detailed procedures for transitioning to OpenRouter, which are not commonly available in public documentation.
What it needs
Requires node, python3 installed locally. Requires openrouter account access. About 5k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
OpenRouter Upgrade & Migration Current State !npm list openai 2>/dev/null head -5 !pip show openai 2>/dev/null head -5 Overview Migrating to OpenRouter from a direct provider API (OpenAI, Anthropic) is minimal: change baseurl and apikey, add two headers. The OpenAI SDK works natively with OpenRouter. This skill covers migrating from direct APIs, switching between models, upgrading SDK versions, and running comparison tests. Prerequisites An existing direct OpenAI or Anthropic integration to migrate — the Current State block above checks your installed openai SDK via npm list openai / pip show openai An OpenRouter API key (sk-or-v1-...) exported as OPENROUTERAPIKEY — see the openrouter-install-auth skill for setup Python 3.8+ or Node.js 18+ with the OpenAI SDK (Anthropic SDK users switch to the OpenAI SDK as part of the migration) The old provider key (OPENAIAPIKEY / ANTHROPICAPIKEY) kept active during migration for comparison tests and quick rollback Instructions 1. Confirm your installed SDK versions from the Current State output at the top of this skill. 2. Apply the 3-line change per Migration from Direct OpenAI, Migration from Direct Anthropic, or TypeScript Migration: swap baseurl to https://openrouter.ai/api/v1, switch to OPENROUTERAPIKEY, and add the HTTP-Referer / X-Title headers. Anthropic migrations also change response parsing to .choices[0].message.content. 3. Prefix every model ID with its provider per the Model ID Migration Map (e.g. gpt-4o → openai/gpt-4o). 4. Work through the Migration Checklist — config, code, testing, and operations items — before flipping traffic. 5. Run the Comparison Test Script on your critical prompts (temperature=0) to compare content, tokens, and latency against the old backend. 6. Roll out gradually with the Feature Flag Migration pattern (USEOPENROUTER env var plus getmodelid mapping), moving 10% → 50% → 100%. 7. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/openrouter-upgrade-migration--c3efcd