
Openrouter Typescript Sdk
If you need to hit multiple AI models without writing separate integrations for each provider, this SDK gives you one interface for 300+ models through OpenRouter. The callModel pattern handles the usual stuff: streaming, tool calls, multi-turn conversations with automatic tool execution. The tool system uses Zod schemas and lets you modify parameters between turns via nextTurnParams, which is handy for adaptive workflows. You also get cost controls and stop conditions to prevent runaway multi-turn loops. Worth noting it includes OAuth PKCE flow support if you're building user-facing apps rather than just internal tooling. Solid choice when you want model flexibility without maintaining a dozen different client libraries.
- skills.sh installs
- 2K
- GitHub stars
- 29
- last updated
- Jul 14, 2026
Install
$ npx -y skills add openrouterteam/agent-skills --skill openrouter-typescript-sdk --agent claude-codeInstalls into .claude/skills of the current project.
Files
OpenRouter TypeScript SDK
A comprehensive TypeScript SDK for interacting with OpenRouter's unified API, providing access to 300+ AI models through a single, type-safe interface. This skill enables AI agents to leverage the callModel pattern for text generation, tool usage, streaming, and multi-turn conversations.
Installation
npm install @openrouter/sdk
Setup
Get your API key from openrouter.ai/settings/keys, then initialize:
import OpenRouter from '@openrouter/sdk';
const client = new OpenRouter({
apiKey: process.env.OPENROUTER_API_KEY
});
Authentication
The SDK supports two authentication methods: API keys for server-side applications and OAuth PKCE flow for user-facing applications.
API Key Authentication
The primary authentication method uses API keys from your OpenRouter account.
Obtaining an API Key
- Visit openrouter.ai/settings/keys
- Create a new API key
- Store securely in an environment variable
Environment Setup
export OPENROUTER_API_KEY=sk-or-v1-your-key-here
Client Initialization
Sponsors
Details
- Repository
- github.com/openrouterteam/agent-skills
- Category
- AI & Agent Building