openrouter-typescript-sdk
Complete reference for integrating with 300+ AI models through the OpenRouter TypeScript SDK and Agent packages using the callModel pattern
Skill by x402agent
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/x402agent-openrouter-typescript-sdk
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: not checked yet.
What's inside
- Skill name
openrouter-typescript-sdk- Description
- Complete reference for integrating with 300+ AI models through the OpenRouter TypeScript SDK and Agent packages using the callModel pattern
- License
- MIT
- Instructions
- 1,263 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- body: 1263 lines (spec recommends under 500)
Files (2)
- SKILL.md
- metadata.json
SKILL.md (first lines)
# 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.
The SDK is split into two packages:
- **`@openrouter/agent`** — Agent features: `callModel`, `tool()`, stop conditions, streaming, format converters
- **`@openrouter/sdk`** — Platform features: model listing, chat completions, credits, OAuth, API key management
---
## Installation
```bash
# For agent features (callModel, tools, stop conditions)
npm install @openrouter/agent
# For platform features (models, credits, OAuth, API keys)
npm install @openrouter/sdk
```
## Setup
Get your API key from [openrouter.ai/settings/keys](https://openrouter.ai/settings/keys), then initialize:
```typescript
import { OpenRouter } from '@openrouter/agent';
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
1. Visit [openrouter.ai/settings/keys](https://openrouter.ai/settings/keys)
2. Create a new API key
3. Store securely in an environment variable
#### Environment Setup
```bash
export OPENROUTER_API_KEY=sk-or-v1-your-key-here
```
#### Client Initialization
```typescript
import { OpenRouter } from '@openrouter/agent';
const client = new OpenRouter({
apiKey: process.env.OPENROUTER_API_KEY
});
```
The client automatically uses this key for all subsequent requests:
```typescript
// API key is automatically included
const result = client.callModel({
model: 'openai/gpt-5-nano',
input: 'Hello!'
});
```
#### Get Current Key Metadata
Retrieve information about the currently configured API key (requires `@openrouter/sdk`):
```typescript
import OpenRouter from '@openrouter/sdk';
const sdkClient = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
const keyInfo = await sdkClient.apiKeys.getCurrentKeyMetadata();
console.log('Key name:', keyInfo.name);
console.log('Created:', keyInfo.createdAt);
```
#### API Key Management
Programmatically manage API keys:
```typescript
// List all keys
const keys = await client.apiKeys.list();
// Create a new key
const newKey = await client.apiKeys.create({
name: 'Production API Key'
});
// Get a specific key by hash
const key = await client.apiKeys.get({
hash: 'sk-or-v1-...'
});
// Update a key
await client.apiKeys.update({
hash: 'sk-or-v1-...',
requestBody: {
name: 'Updated Key Name'
}
});
// Delete a key
await client.apiKeys.delete({
hash: 'sk-or-v1-...'
});
```From x402agent/openclawd-ts, MIT.
More from x402agent/openclawd-ts
- 0.359score
cookie-sync
x402agent
Sync cookies from local Chrome to a Browserbase persistent context so the browse CLI can access authenticated sites.
SkillDFreshness: DClaude Code +9 - 0.355score
browser
x402agent
Automate web browser interactions using natural language via CLI commands.
SkillDFreshness: DClaude Code +9 - 0.355score
browserbase-cli
x402agent
Use the Browserbase CLI (`bb`) for Browserbase Functions and platform API workflows.
SkillDFreshness: DClaude Code +9 - 0.355score
functions
x402agent
Deploy serverless browser automation as cloud functions using Browserbase.
SkillDFreshness: DClaude Code +9 - 0.338score
1password
x402agent
Set up and use 1Password CLI (op).
SkillDFreshness: DClaude Code +9 - 0.333score
bluebubbles
x402agent
Use when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration).
SkillDFreshness: DClaude Code +9 - 0.333score
fetch
x402agent
Use this skill when the user wants to retrieve a URL without a full browser session: fetch HTML or JSON from static pages, inspect status codes or headers…
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Apr 26, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/x402agent/openclawd-ts
- Website
- openclawd.biz
- 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 x402agent
- 0.487score
dex-screener-scanner
x402agent
Automate DexScreener Solana token discovery and screening via browser automation.
SkillCFreshness: C★ 25Claude Code +9 - 0.483score
dflow-kalshi-trading
x402agent
Buy, sell, or redeem YES/NO outcome tokens on Kalshi prediction markets via DFlow.
SkillCFreshness: C★ 25Claude Code +9 - 0.483score
dflow-kalshi-market-data
x402agent
Read market data for a known Kalshi prediction market on DFlow — orderbook, trades, top-of-book prices, candlesticks, forecast-percentile history, and Kalshi…
SkillCFreshness: C★ 25Claude Code +9 - 0.483score
dflow-kalshi-market-scanner
x402agent
Find Kalshi prediction markets on DFlow that match a criterion — arbitrage (YES+NO<$1), cheap long-shots, near-certain short-dated plays, biggest movers…
SkillCFreshness: C★ 25Claude Code +9 - 0.483score
dflow-kalshi-portfolio
x402agent
View what a wallet holds on DFlow's Kalshi prediction markets — current positions, unrealized mark-to-market, realized P&L, activity history, and redeemable…
SkillCFreshness: C★ 25Claude Code +9 - 0.483score
dflow-platform-fees
x402agent
Monetize a DFlow integration by collecting a builder-defined fee on trades your app routes through the Trade API — either a fixed percentage (spot + PM) via…
SkillCFreshness: C★ 25Claude Code +9
Cite this page
openrouter-typescript-sdk skill. Agent Mart. https://agentmart.dev/skills/x402agent-openrouter-typescript-sdk (last updated 2026-10-24)