openrouter-agent-migration
Migration guide from @openrouter/sdk to @openrouter/agent for callModel, tool(), stop conditions, and agent features.
Skill by clawdsolana
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/clawdsolana-openrouter-agent-migration
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/openrouter-agent-migration
What's inside
- Skill name
openrouter-agent-migration- Description
- Migration guide from @openrouter/sdk to @openrouter/agent for callModel, tool(), stop conditions, and agent features. This skill should be used when code imports callModel, tool(), or stop conditions from @openrouter/sdk and needs to migrate to @openrouter/agent.
- License
- MIT
- Instructions
- 346 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- metadata.json
SKILL.md (first lines)
# Migrating from @openrouter/sdk to @openrouter/agent
Agent functionality (`callModel`, `tool()`, stop conditions, format converters, streaming helpers) has moved from `@openrouter/sdk` to the standalone `@openrouter/agent` package. The `@openrouter/agent` package includes its own `OpenRouter` client class, so you do not need `@openrouter/sdk` for agent use cases.
---
## When This Applies
Migrate if your code imports any of these from `@openrouter/sdk`:
- `callModel` or uses `client.callModel()`
- `tool()` factory function
- Stop conditions: `stepCountIs`, `hasToolCall`, `maxCost`, `maxTokensUsed`, `finishReasonIs`
- Format converters: `fromClawdMessages`, `toClawdMessage`, `fromChatMessages`, `toChatMessage`
- Types: `Tool`, `ToolWithExecute`, `ToolWithGenerator`, `ManualTool`, `CallModelInput`, `ModelResult`
---
## Quick Migration
### Step 1: Install
```bash
npm install @openrouter/agent
```
If you only use agent features, you can remove `@openrouter/sdk`:
```bash
npm uninstall @openrouter/sdk
npm install @openrouter/agent
```
If you also use non-agent SDK features (models list, chat completions, credits, OAuth, API keys), keep both packages installed.
### Step 2: Update Imports
The `OpenRouter` client class and `client.callModel()` pattern work identically. Only the import source changes:
```diff
- import OpenRouter from '@openrouter/sdk';
+ import { OpenRouter } from '@openrouter/agent';
```
The rest of your code stays the same:
```typescript
const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
const result = client.callModel({
model: 'openai/gpt-5-nano',
input: 'Hello!',
});
const text = await result.getText();
```
---
## Complete Import Mapping
### Client & callModel
| Old | New |
|-----|-----|
| `import OpenRouter from '@openrouter/sdk'` | `import { OpenRouter } from '@openrouter/agent'` |
| `import OpenRouter, { tool, stepCountIs } from '@openrouter/sdk'` | `import { OpenRouter } from '@openrouter/agent'`<br>`import { tool } from '@openrouter/agent/tool'`<br>`import { stepCountIs } from '@openrouter/agent/stop-conditions'` |
A standalone `callModel` function is also available for advanced use cases where a pre-existing `OpenRouterCore` instance is available:
```typescript
import { callModel } from '@openrouter/agent/call-model';
// Requires an OpenRouterCore instance (from @openrouter/sdk/core)
const result = callModel(coreInstance, { model: 'openai/gpt-5-nano', input: 'Hello' });
```
For most use cases, prefer the `client.callModel()` method shown above.
### Tool Creation
| Old | New |
|-----|-----|
| `import { tool } from '@openrouter/sdk'` | `import { tool } from '@openrouter/agent/tool'` |
### Stop Conditions
| Old | New |
|-----|-----|
| `import { stepCountIs, hasToolCall, maxCost } from '@openrouter/sdk'` | `import { stepCountIs, hasToolCall, maxCost } from '@openrouter/agent/stop-conditions'` |
| `import { maxTokensUsed, finishReasonIs } from '@openrouter/sdk'` | `import { maxTokensUsed, finishReasonIs } from '@openrouter/agent/stop-conditions'` |
### Types
| Old | New |
|-----|-----|
| `import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter/sdk/lib/tool-types'` | `import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter/agent/tool-types'` |
| `import type { CallModelInput } from '@openrouter/sdk/lib/async-params'` | `import type { CallModelInput } from '@openrouter/agent/async-params'` |
| `import { ModelResult } from '@openrouter/sdk/lib/model-result'` | `import { ModelResult } from '@openrouter/agent/model-result'` |
### Format Converters
| Old | New |
|-----|-----|
| `import { fromClawdMessages, toClawdMessage } from '@openrouter/sdk'` | `import { fromClawdMessages, toClawdMessage } from '@openrouter/agent'` |
| `import { fromChatMessages, toChatMessage } from '@openrouter/sdk'` | `import { fromChatMessages, toChatMessage } from '@openrouter/agent'` |
### Type Guards
| Old | New |
|-----|-----|
| `import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter/sdk'` | `import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter/agent/tool-types'` |
---
## Before & After Example
### Before (using @openrouter/sdk)From clawdsolana/OpenClawd, MIT.
More from clawdsolana/OpenClawd
- 0.512score
openrouter-images
clawdsolana
Generate images from text prompts and edit existing images using OpenRouter's image generation models.
SkillCFreshness: C★ 2Claude Code +9 - 0.512score
pay
clawdsolana
User-authorized paid HTTP/API access for agents through local Pay MCP and TouchID gated payments (x402 MPP HTTP 402) SERVICES: search web, scrape, enrich…
SkillCFreshness: C★ 2Claude Code +9 - 0.512score
openrouter-models
clawdsolana
Query OpenRouter for available AI models, pricing, capabilities, throughput, and provider performance.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
honcho-cli
clawdsolana
Inspect and debug Honcho workspaces via the `honcho` CLI.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
migrate-honcho-ts
clawdsolana
Migrates Honcho TypeScript SDK code from v1.6.0 to v2.1.1.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
openrouter-oauth
clawdsolana
Implement "Sign In with OpenRouter" using OAuth PKCE — framework-agnostic, no SDK or client registration required.
SkillCFreshness: C★ 2Claude Code +9 - 0.504score
crossmint-agentic-wallet
clawdsolana
Create non-custodial Solana wallets for AI agents with e-commerce, Jupiter swaps, faucet funding, and agent-to-agent payments
SkillCFreshness: C★ 2Claude Code +9 - 0.503score
create-agent-tui
clawdsolana
Scaffolds a complete agent TUI in TypeScript using @openrouter/agent — like create-react-app for terminal agents.
SkillCFreshness: C★ 2Claude Code +9 - 0.503score
honcho-memory
plastic-labs
Gives AI agents persistent memory across conversations using Honcho.
SkillCFreshness: C★ 2Claude Code +9 - 0.503score
migrate-honcho
clawdsolana
Migrates Honcho Python SDK code from v1.6.0 to v2.1.1.
SkillCFreshness: C★ 2Claude Code +9 - 0.501score
competitive-analysis
clawdsolana
Perform competitive market analysis with comparisons and strategic recommendations.
SkillCFreshness: C★ 2Claude Code +9 - 0.501score
branding-generator
clawdsolana
Create brand identity kits — logos, color palettes, typography, naming, and style guides.
SkillCFreshness: C★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 3
- Open issues
- 2
- Last commit (this folder)
- May 7, 2026 (5 months ago)
- Last release
- Apr 30, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/clawdsolana/OpenClawd
- Website
- solanaclawd.com/openclawd
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from clawdsolana
- 0.512score
openrouter-images
clawdsolana
Generate images from text prompts and edit existing images using OpenRouter's image generation models.
SkillCFreshness: C★ 2Claude Code +9 - 0.512score
pay
clawdsolana
User-authorized paid HTTP/API access for agents through local Pay MCP and TouchID gated payments (x402 MPP HTTP 402) SERVICES: search web, scrape, enrich…
SkillCFreshness: C★ 2Claude Code +9 - 0.512score
openrouter-models
clawdsolana
Query OpenRouter for available AI models, pricing, capabilities, throughput, and provider performance.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
openrouter-oauth
clawdsolana
Implement "Sign In with OpenRouter" using OAuth PKCE — framework-agnostic, no SDK or client registration required.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
honcho-cli
clawdsolana
Inspect and debug Honcho workspaces via the `honcho` CLI.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
migrate-honcho-ts
clawdsolana
Migrates Honcho TypeScript SDK code from v1.6.0 to v2.1.1.
SkillCFreshness: C★ 2Claude Code +9
Cite this page
openrouter-agent-migration skill. Agent Mart. https://agentmart.dev/skills/clawdsolana-openrouter-agent-migration (last updated 2026-10-24)