# openrouter-typescript-sdk

Use this skill to integrate the OpenRouter TypeScript SDK into a project. It covers model calls, agent tools, streaming, OAuth, and API key management.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 439 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-typescript-sdk/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/openrouter-typescript-sdk

## What it does

The reference covers two packages. `@openrouter/agent` provides the `callModel` pattern, tools, streaming, and stop conditions; `@openrouter/sdk` handles platform features such as model listings, chat completions, OAuth, and API keys. It also describes retrieving generated text from a model response.

API requests require an OpenRouter key supplied through `OPENROUTER_API_KEY`. For user-facing apps, the guide outlines OAuth with PKCE: create an authorization code, then exchange it for the user’s key. Keep keys in environment variables rather than source code. Installing this skill is separate from adding either SDK package to your project.

## Install

### Claude Code (native platform)

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

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

### Codex

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

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

### Cursor

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

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install OpenRouterTeam/skills openrouter-typescript-sdk
```

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

### Gemini CLI

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

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

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add OpenRouterTeam/skills --skill openrouter-typescript-sdk -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-typescript-sdk/SKILL.md

## When to use it
- connect a TypeScript client to OpenRouter
- call a model with `callModel`
- add tools and streaming to an agent
- let users authorize through OAuth PKCE
- manage API keys from application code

## Example prompts
- Show me how to call an OpenRouter model with `callModel` in my TypeScript project.
- Explain how to add tools with `@openrouter/agent`.
- Walk me through OAuth PKCE and exchanging an authorization code for a user API key.

## Similar
- [skill-creator](https://affpapa.org/en/nevibecode/skills/skill-creator.md) — skill · 414180 installs
- [writing-for-agents](https://affpapa.org/en/nevibecode/skills/writing-for-agents.md) — skill · 466719 installs
- [media-use](https://affpapa.org/en/nevibecode/skills/media-use.md) — skill · 1100000 installs
- [mcp-builder](https://affpapa.org/en/nevibecode/skills/mcp-builder.md) — skill · 130949 installs
- [subagent-driven-development](https://affpapa.org/en/nevibecode/skills/subagent-driven-development.md) — skill · 237746 installs
- [orchestration](https://affpapa.org/en/nevibecode/skills/orchestration.md) — skill · 350300 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
