# openrouter-agent-migration

Walks you through switching agent imports from @openrouter/sdk to the @openrouter/agent package.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 311 installs · ★ 307
- Author: OpenRouterTeam
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/OpenRouterTeam/skills/tree/HEAD/skills/openrouter-agent-migration/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/openrouter-agent-migration

## What it 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.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/openrouter-agent-migration/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/openrouter-agent-migration/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/openrouter-agent-migration/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/openrouter-agent-migration/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install OpenRouterTeam/skills openrouter-agent-migration
```

2. **Manually: put the files in place**
- File: `.github/skills/openrouter-agent-migration/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/OpenRouterTeam/skills --path skills/openrouter-agent-migration
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/openrouter-agent-migration/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-agent-migration -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/OpenRouterTeam/skills/tree/HEAD/skills/openrouter-agent-migration/SKILL.md

## When to use it
- move agent imports onto the new package
- swap the old `OpenRouter` client import
- fix paths for stop conditions and format converters
- decide when both packages stay in dependencies
- update tool types and type guards

## Example prompts
- Migrate my agent code from `@openrouter/sdk` to `@openrouter/agent`
- Where do `tool()` and `stepCountIs` come from now?
- Show me the import changes for `callModel`

## Similar
- [setup-matt-pocock-skills](https://affpapa.org/en/nevibecode/skills/setup-matt-pocock-skills.md) — skill · 1052851 installs
- [ask-matt](https://affpapa.org/en/nevibecode/skills/ask-matt.md) — skill · 766587 installs
- [to-tickets](https://affpapa.org/en/nevibecode/skills/to-tickets.md) — skill · 711230 installs
- [writing-plans](https://affpapa.org/en/nevibecode/skills/writing-plans.md) — skill · 282859 installs
- [caveman-review](https://affpapa.org/en/nevibecode/skills/caveman-review.md) — skill · 411800 installs
- [caveman-compress](https://affpapa.org/en/nevibecode/skills/caveman-compress.md) — skill · 411500 installs

From the same set: [openrouterteam/skills](https://affpapa.org/en/nevibecode/by/openrouterteam/skills.md) — 8 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
