openrouter-agent-migration — Claude Code skill: move agent code
Walks you through switching agent imports from @openrouter/sdk to the @openrouter/agent package.
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a claude-codeWhat openrouter-agent-migration does
Reach for this skill when your code pulls callModel, the tool() factory or stop conditions such as stepCountIs and hasToolCall out of @openrouter/sdk. Agent features now ship in a separate package, @openrouter/agent, and the skill maps the move.
It carries import mapping tables: the client and callModel, tool creation, stop conditions, format converters, types and type guards. A before-and-after example makes the scope clear — only the import lines change, the call itself stays as it was. The OpenRouter client class now lives in the new package, so agent-only projects can drop the old one.
Keep @openrouter/sdk around if you also call the models list, chat completions, credits, OAuth or API key endpoints. Uninstalling it breaks those calls. The standalone callModel function needs an OpenRouterCore instance from @openrouter/sdk/core; without one that path fails.
What it helps with
- move agent imports onto the new package
- swap the old
OpenRouterclient import - fix paths for stop conditions and format converters
- decide when both packages stay in dependencies
- update tool types and type guards
Example prompts for the agent
- Migrate my agent code from
@openrouter/sdkto@openrouter/agent - Where do
tool()andstepCountIscome from now? - Show me the import changes for
callModel
How to install openrouter-agent-migration
1Skills CLI (Vercel)
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a claude-code2Manually: put the files in place
~/.claude/skills/openrouter-agent-migration/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/openrouter-agent-migration/
1Skills CLI (Vercel)
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a codex2Manually: put the files in place
.agents/skills/openrouter-agent-migration/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a cursor2Manually: put the files in place
.cursor/skills/openrouter-agent-migration/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install OpenRouterTeam/skills openrouter-agent-migration2Manually: put the files in place
.github/skills/openrouter-agent-migration/SKILL.md1Skills CLI (Vercel)
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a gemini-cli2Platform CLI
gemini skills install https://github.com/OpenRouterTeam/skills --path skills/openrouter-agent-migrationManually: put the files in place
.devin/skills/openrouter-agent-migration/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about openrouter-agent-migration
How do I install openrouter-agent-migration in Claude Code?
Run npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a claude-code. The skill lands at ~/.claude/skills/openrouter-agent-migration/SKILL.md.
What does openrouter-agent-migration do?
It documents the move from @openrouter/sdk to @openrouter/agent, covering imports for callModel, tool(), stop conditions, converters and types.
Do I still need @openrouter/sdk?
Yes, if you use non-agent features. Model listing, chat completions, credits, OAuth and API keys stay in that package, so both are required.