OpenRouter

openrouter.ai
AI & Machine Learning

A unified interface for LLMs. Find the best models & prices for your prompts

llms.txt

OpenRouter | Documentation

Instructions for AI Agents

Docs

  • Quickstart: Get started with OpenRouter's unified API for hundreds of AI models. Learn how to integrate using the API directly, the Client SDKs, or the Agent SDK.
  • Principles: Learn about OpenRouter's guiding principles and mission. Understand our commitment to price optimization, standardized APIs, and high availability in AI model deployment.
  • Models: Access all major language models (LLMs) through OpenRouter's unified API. Browse available models, compare capabilities, and integrate with your preferred provider.
  • Multimodal Capabilities: Send images, PDFs, audio, and video to OpenRouter models, generate speech from text, or transcribe audio to text through our unified API.
  • Image Inputs: Send images to vision models through the OpenRouter API.
  • Image Generation: Generate images using AI models through the OpenRouter API.
  • PDF Inputs: Send PDF documents to any model on OpenRouter.
  • Audio: Send audio files to and receive audio responses from speech-capable models through the OpenRouter API.
  • Video Inputs: Send video files to video-capable models through the OpenRouter API.
  • Video Generation: Generate videos using AI models through the OpenRouter API.
  • Text-to-Speech: Generate speech audio from text using AI models through the OpenRouter API.
  • Speech-to-Text: Transcribe audio into text using AI models through the OpenRouter API. Access multiple STT providers with a single unified interface.
  • OAuth PKCE: Implement secure user authentication with OpenRouter using OAuth PKCE. Complete guide to setting up and managing OAuth authentication flows.
  • Management API Keys: Manage OpenRouter API keys programmatically through dedicated management endpoints. Create, read, update, and delete API keys for automated key distribution and control.
  • BYOK: Learn how to use your existing AI provider keys with OpenRouter. Integrate your own API keys while leveraging OpenRouter's unified interface and features.
  • Stripe Projects: Provision OpenRouter API access directly from the Stripe Projects CLI. Get an API key, manage credentials, and access 300+ AI models in seconds.
  • Frequently Asked Questions: Find answers to commonly asked questions about OpenRouter's unified API, model access, pricing, and integration.
  • Report Feedback: Learn how to report issues with AI generations on OpenRouter using the Report Feedback feature in the Chatroom and Activity page.
  • Model Fallbacks: Configure automatic failover between AI models when providers are down, rate-limited, or refuse requests.
  • Provider Routing: Route AI model requests across multiple providers intelligently. Learn how to optimize for cost, performance, and reliability with OpenRouter's provider routing.
  • Auto Exacto: Learn how Auto Exacto automatically optimizes provider ordering for tool-calling requests using throughput, success rate, and benchmark signals.
  • Private Models: Run your own custom, fine-tuned, or dedicated model deployments through the OpenRouter API. Private models are scoped to approved users and organizations and hidden from public model lists.
  • Free Variant: Access free models using the :free variant suffix.
  • Extended Variant: Access extended context window versions of models using the :extended variant.
  • Exacto Variant: Learn how to use the :exacto model variant to prioritize providers with stronger tool-calling quality signals.
  • Thinking Variant: Enable extended reasoning capabilities using the :thinking variant.
  • Online Variant: Enable real-time web search capabilities using the :online variant.
  • Nitro Variant: Access high-speed model inference using the :nitro variant.
  • Auto Router: Automatically select the best AI model for your prompts using OpenRouter's Auto Router powered by NotDiamond.
  • Body Builder: Use natural language to generate multiple OpenRouter API requests for parallel model execution.
  • Free Models Router: Route requests to free AI models automatically using OpenRouter's Free Models Router.
  • Latest Model Resolution: Use ~author/family-latest slugs to automatically route to the newest model in a family on OpenRouter.
  • Pareto Router: Route coding requests by a single minimum coding score using OpenRouter's Pareto Router.
  • Fusion Router: Use the openrouter/fusion model slug to access multi-model deliberation — a panel of models, a judge, and a final answer — in a single API call.
  • Workspaces: Separate your OpenRouter projects into independent environments, each with its own API keys, routing defaults, guardrails, and observability.
  • Presets: Learn how to use OpenRouter's presets to manage model configurations, system prompts, and parameters across your applications.
  • Response Caching: Cache identical LLM requests with OpenRouter's response caching feature. Reduce costs and latency for agent workflows, unit testing, and repeated context processing.
  • Tool & Function Calling: Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other models that support tool calling.
  • Server Tools: Add powerful server-side tools like web search, web fetch, datetime, and image generation to any model on OpenRouter. Models decide when to call them — OpenRouter executes them automatically.
  • Web Search: Add real-time web search to any model on OpenRouter. The model decides when to search, OpenRouter executes it, and results are returned with citations.
  • Web Fetch: Add URL content fetching to any model on OpenRouter. The model decides when to fetch, OpenRouter retrieves the content, and results are returned as text.
  • Datetime: Add current date and time awareness to any model on OpenRouter. The model calls the tool when it needs temporal context.
  • Image Generation: Add AI image generation to any model on OpenRouter. The model calls the tool with a prompt, OpenRouter generates the image and returns it.
  • Apply Patch: Enable any model on OpenRouter to propose file edits using V4A diff patches. The model generates the patch, OpenRouter validates it, and your application applies it.
  • Fusion: Let any model invoke an expert panel and judge to surface consensus, contradictions, coverage gaps, unique insights, and blind spots.
  • Advisor: Let a fast executor model consult a higher-intelligence advisor model for guidance mid-generation, with any OpenRouter model and optional sub-agent tools.
  • Plugins: Enable powerful plugins like web search, PDF processing, and response healing to extend any model's capabilities on OpenRouter.
  • Web Search: Enable real-time web search capabilities in your AI model responses. Add factual, up-to-date information to any model's output with OpenRouter's web search feature.
  • Response Healing: Automatically validate and repair malformed JSON responses from AI models. Ensure your responses match your schema even when models return imperfect formatting.
  • Fusion: Get richer answers by running a panel of models in parallel and comparing their responses through a judge. Fusion makes this a one-line addition to any OpenRouter request.
  • Structured Outputs: Enforce JSON Schema validation on AI model responses. Get consistent, type-safe outputs and avoid parsing errors with OpenRouter's structured output feature.
  • Message Transforms: Transform and optimize messages before sending them to AI models. Learn about middle-out compression and context window optimization with OpenRouter.
  • Zero Completion Insurance: Learn how OpenRouter protects users from being charged for failed or empty AI responses with zero completion insurance.
  • Zero Data Retention: Learn how OpenRouter gives you control over your data
  • App Attribution: Learn how to attribute your API usage to your app and appear in OpenRouter's app rankings and model analytics.
  • Guardrails: Set spending limits, restrict model access, and enforce data policies for your organization members and API keys with OpenRouter guardrails.
  • Prompt Injection Detection: Reference documentation for the regex-based prompt injection detection patterns used by OpenRouter guardrails, inspired by the OWASP LLM Prompt Injection Prevention Cheat Sheet.
  • Sensitive Info Guardrail: Protect sensitive data in your AI requests with OpenRouter Sensitive Info Guardrails. Automatically detect and redact or block PII like emails, phone numbers, names, addresses, and more.
  • Service Tiers: Learn how to use service tiers on OpenRouter to control cost and latency tradeoffs when routing requests to AI providers.
  • Sovereign AI: Learn how OpenRouter enables sovereign AI with in-region routing, data residency controls, and compliance features that keep your AI workloads within national and regional boundaries.
  • Router Metadata: Opt in to OpenRouter routing metadata to see which provider was selected, fallback attempts, and pipeline stages applied to your request.
  • Input & Output Logging: Store your prompts and completions privately on OpenRouter for debugging, evaluation, and optimization. View them in your Logs page.
  • Broadcast: Connect your LLM observability platforms to automatically receive traces from your OpenRouter requests. Supports Langfuse, Datadog, Braintrust, and more.
  • Arize AI: Connect Arize AI to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Arize integration.
  • Braintrust: Connect Braintrust to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Braintrust integration.
  • ClickHouse: Connect ClickHouse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for ClickHouse integration.
  • Comet Opik: Connect Comet Opik to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Opik integration.
  • Datadog: Connect Datadog LLM Observability to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Datadog integration.
  • Grafana Cloud: Connect Grafana Cloud to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Grafana Cloud integration.
  • Langfuse: Connect Langfuse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Langfuse integration.
  • LangSmith: Connect LangSmith to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for LangSmith integration.
  • New Relic: Connect New Relic to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for New Relic integration.
  • OpenTelemetry Collector: Connect any OpenTelemetry-compatible backend to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for OTLP integration.
  • PostHog: Connect PostHog to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for PostHog integration.
  • Ramp: Connect Ramp to automatically receive AI usage traces from your OpenRouter requests. Step-by-step setup guide for Ramp integration.
  • S3 / S3-Compatible: Connect Amazon S3 or S3-compatible storage to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for S3 integration.
  • Sentry: Connect Sentry to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Sentry integration.
  • Snowflake: Connect Snowflake to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Snowflake integration.
  • W&B Weave: Connect W&B Weave to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for W&B Weave integration.
  • Webhook: Connect any HTTP endpoint to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Webhook integration.
  • Data Collection: Learn what data OpenRouter collects and how it's used.
  • Provider Logging: Understand how AI providers handle logging and data retention when you use OpenRouter.
  • Latency and Performance: Learn about OpenRouter's performance characteristics, latency optimizations, and best practices for achieving optimal response times.
  • Prompt Caching: Reduce your AI model costs with OpenRouter's prompt caching feature. Learn how to cache and reuse responses across OpenAI, Anthropic Claude, and DeepSeek models.
  • Uptime Optimization: Learn how OpenRouter maximizes AI model uptime through real-time monitoring, intelligent routing, and automatic fallbacks across multiple providers.
  • Reasoning Tokens: Learn how to use reasoning tokens to enhance AI model outputs. Implement step-by-step reasoning traces for better decision making and transparency.
  • Provider Integration: Learn how to integrate your AI models with OpenRouter. Complete guide for providers to make their models available through OpenRouter's unified API.
  • Frameworks and Integrations Overview: Integrate OpenRouter using popular frameworks and SDKs. Complete guides for OpenAI SDK, LangChain, PydanticAI, and Vercel AI SDK integration.
  • Awesome OpenRouter: Discover community-built projects and apps powered by OpenRouter. Submit your own project to the awesome-openrouter list.
  • Effect AI SDK: Integrate OpenRouter using the Effect AI SDK. Complete guide for integrating the Effect AI SDK with OpenRouter.
  • Arize: Integrate OpenRouter using Arize for observability and tracing. Complete guide for Arize integration with OpenRouter for Python and JavaScript applications.
  • LangChain: Integrate OpenRouter using LangChain framework. Complete guide for LangChain integration with OpenRouter for Python and JavaScript.
  • LiveKit: Integrate OpenRouter using LiveKit Agents framework. Complete guide for LiveKit integration with OpenRouter to build voice AI agents with access to 300+ models.
  • Langfuse: Integrate OpenRouter using Langfuse for observability and tracing. Complete guide for Langfuse integration with OpenRouter for Python applications.
  • Mastra: Integrate OpenRouter using Mastra framework. Complete guide for Mastra integration with OpenRouter for unified AI model access.
  • OpenAI SDK: Integrate OpenRouter using the official OpenAI SDK. Complete guide for OpenAI SDK integration with OpenRouter for Python and TypeScript.
  • Anthropic Agent SDK: Integrate OpenRouter using the Anthropic Agent SDK. Complete guide for building AI agents with OpenRouter in Python and TypeScript.
  • PydanticAI: Integrate OpenRouter using PydanticAI framework. Complete guide for PydanticAI integration with OpenRouter for Python applications.
  • Replit: Add your OpenRouter API key to Replit to access 300+ AI models in Replit Agent and your Replit apps. Covers BYOK setup and project Secrets.
  • TanStack AI: Integrate OpenRouter using TanStack AI. Complete guide for TanStack AI integration with OpenRouter for React, Solid, and Preact applications.
  • Vercel AI SDK: Integrate OpenRouter using Vercel AI SDK. Complete guide for Vercel AI SDK integration with OpenRouter for Next.js applications.
  • Xcode: Integrate OpenRouter with Apple Intelligence in Xcode 26. Complete setup guide for accessing hundreds of AI models directly in your Xcode development environment.
  • Zapier: Build powerful AI automations by connecting OpenRouter with 8000+ apps through Zapier. Access 300+ AI models in your workflows.
  • Infisical: Set up automatic API key rotation for OpenRouter using Infisical. Complete guide for secure key management and zero-downtime rotation.
  • API Reference: Comprehensive guide to OpenRouter's API. Learn about request/response schemas, authentication, parameters, and integration with multiple AI model providers.
  • Streaming: Learn how to implement streaming responses with OpenRouter's API. Complete guide to Server-Sent Events (SSE) and real-time model outputs.
  • Embeddings: Generate vector embeddings from text and images using OpenRouter's unified embeddings API. Access multiple embedding models from different providers with a single interface.
  • Limits: Learn about OpenRouter's API rate limits, credit-based quotas, and DDoS protection. Configure and monitor your model usage limits effectively.
  • Authentication: Learn how to authenticate with OpenRouter using API keys and Bearer tokens. Complete guide to secure authentication methods and best practices.
  • Parameters: Learn about all available parameters for OpenRouter API requests. Configure temperature, max tokens, top_p, and other model-specific settings.
  • Errors and Debugging: Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.
  • Responses API Beta: Beta version of OpenRouter's OpenAI-compatible Responses API. Stateless transformation layer with support for reasoning, tool calling, and web search.
  • Basic Usage: Learn the basics of OpenRouter's Responses API Beta with simple text input examples and response handling.
  • Reasoning: Access advanced reasoning capabilities with configurable effort levels and encrypted reasoning chains using OpenRouter's Responses API Beta.
  • Tool Calling: Integrate function calling with support for parallel execution and complex tool interactions using OpenRouter's Responses API Beta.
  • Web Search: Enable web search capabilities with real-time information retrieval and citation annotations using OpenRouter's Responses API Beta.
  • Error Handling: Learn how to handle errors in OpenRouter's Responses API Beta with the basic error response format.
  • Client SDKs: Lightweight, type-safe SDK clients for calling AI models through OpenRouter. Available for TypeScript, Python, and Go.
  • Usage for Agents: Add OpenRouter Client SDKs skills to AI coding assistants like Claude Code, Cursor, GitHub Copilot, and more. Enable your AI to code with the OpenRouter Client SDKs.
  • TypeScript SDK: Complete guide to using the OpenRouter TypeScript SDK. Learn how to integrate AI models into your TypeScript applications.
  • Analytics - TypeScript SDK: Analytics method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • APIKeys - TypeScript SDK: APIKeys method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Byok - TypeScript SDK: Byok method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Chat - TypeScript SDK: Chat method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Credits - TypeScript SDK: Credits method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Datasets - TypeScript SDK: Datasets method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Embeddings - TypeScript SDK: Embeddings method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Endpoints - TypeScript SDK: Endpoints method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Generations - TypeScript SDK: Generations method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Guardrails - TypeScript SDK: Guardrails method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Models - TypeScript SDK: Models method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • OAuth - TypeScript SDK: OAuth method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Observability - TypeScript SDK: Observability method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Organization - TypeScript SDK: Organization method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Presets - TypeScript SDK: Presets method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Providers - TypeScript SDK: Providers method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Rerank - TypeScript SDK: Rerank method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Beta.Responses - TypeScript SDK: Beta.Responses method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Transcriptions - TypeScript SDK: Transcriptions method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Speech - TypeScript SDK: Speech method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • VideoGeneration - TypeScript SDK: VideoGeneration method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Workspaces - TypeScript SDK: Workspaces method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples.
  • Python SDK: Complete guide to using the OpenRouter Python SDK. Learn how to integrate AI models into your Python applications.
  • Analytics - Python SDK: Analytics method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • APIKeys - Python SDK: APIKeys method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Byok - Python SDK: Byok method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Chat - Python SDK: Chat method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Credits - Python SDK: Credits method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Datasets - Python SDK: Datasets method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Embeddings - Python SDK: Embeddings method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Endpoints - Python SDK: Endpoints method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Generations - Python SDK: Generations method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Guardrails - Python SDK: Guardrails method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Models - Python SDK: Models method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • OAuth - Python SDK: OAuth method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Observability - Python SDK: Observability method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Organization - Python SDK: Organization method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Presets - Python SDK: Presets method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Providers - Python SDK: Providers method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Rerank - Python SDK: Rerank method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Beta.Responses - Python SDK: Beta.Responses method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Transcriptions - Python SDK: Transcriptions method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Speech - Python SDK: Speech method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • VideoGeneration - Python SDK: VideoGeneration method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Workspaces - Python SDK: Workspaces method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.
  • Analytics - Go SDK: Analytics method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • APIKeys - Go SDK: APIKeys method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Byok - Go SDK: Byok method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Chat - Go SDK: Chat method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Credits - Go SDK: Credits method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Datasets - Go SDK: Datasets method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Embeddings - Go SDK: Embeddings method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Endpoints - Go SDK: Endpoints method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Generations - Go SDK: Generations method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Guardrails - Go SDK: Guardrails method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Models - Go SDK: Models method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • OAuth - Go SDK: OAuth method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Observability - Go SDK: Observability method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Organization - Go SDK: Organization method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Presets - Go SDK: Presets method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Providers - Go SDK: Providers method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Rerank - Go SDK: Rerank method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Beta.Responses - Go SDK: Beta.Responses method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Transcriptions - Go SDK: Transcriptions method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Speech - Go SDK: Speech method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • VideoGeneration - Go SDK: VideoGeneration method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • Workspaces - Go SDK: Workspaces method documentation for the OpenRouter Go SDK. Learn how to use this API endpoint with code examples.
  • DevTools: Comprehensive development tools for the OpenRouter SDK. Capture telemetry, visualize requests, and debug your AI applications with ease.
  • Migrating to @openrouter/agent: Step-by-step guide to migrating agent toolkit code from @openrouter/sdk to the new @openrouter/agent package.
  • Agent SDK: Build AI agents on OpenRouter with callModel, tool definitions, stop conditions, and automatic conversation state management.
  • Usage for Agents: Add OpenRouter Agent SDK skills to AI coding assistants like Claude Code, Cursor, GitHub Copilot, and more. Enable your AI to code with the OpenRouter Agent SDK.
  • Call Model (Typescript): Learn how to use callModel for text generation, streaming, and tool calling with automatic execution. Access 300+ LLMs through a single API.
  • Working with Items: Learn the items-based streaming paradigm for callModel. Replace items by ID instead of accumulating chunks for simpler React state management.
  • API Reference: Complete API reference for callModel, ModelResult, tool types, and helper functions in the OpenRouter SDK.
  • Dynamic Parameters: Use async functions to dynamically compute callModel parameters. Adapt model selection, temperature, and instructions based on conversation state.
  • Next Turn Params: Build encapsulated, context-aware tools with nextTurnParams. Create skills systems, plugins, and adaptive multi-turn agents.
  • Stop Conditions: Control multi-turn execution with stopWhen. Use built-in helpers or custom conditions to stop by step count, tool calls, cost, or tokens.
  • Streaming: Learn to stream LLM responses with callModel. Covers text streaming, reasoning streams, message updates, and concurrent consumers.
  • Text Generation: Learn how to generate text with callModel. Covers input formats, model selection, system instructions, and response handling.
  • Message Formats: Convert between OpenAI chat format, Anthropic Claude format, and OpenResponses format. Easy migration from other SDKs.
  • Tools: Create strongly-typed tools for LLMs with Zod schemas. Learn about regular tools, generator tools with progress, manual tools, human-in-the-loop tools, and automatic multi-turn execution.
  • Tool Approval & State Persistence: Add human-in-the-loop approval for sensitive tool calls and persist conversation state across callModel runs. Supports approval gates, resumption, and interruption recovery.
  • Weather Tool: Build a weather tool with external API integration, Zod validation, error handling, and environment configuration.
  • Skills Loader: Build a complete skills system like Claude Code using nextTurnParams for context injection, idempotency, and multi-skill loading.
  • Quickstart: Build a Chat App: Build a working chat app in TypeScript that streams responses from any model on OpenRouter. Install the SDK, send a message, and handle multi-turn conversations.
  • Enterprise Quickstart: A comprehensive guide for enterprise customers to get started with OpenRouter. Learn about organizations, workspaces, API key management, security controls, and observability.
  • Free Models Router: Learn how to use the Free Models Router in the OpenRouter Chat Playground for zero-cost inference.
  • Automatic Code Review: Set up automatic, non-blocking code reviews for Claude Code. A stop hook triggers a background reviewer agent via OpenRouter — observable, customizable, and cost-monitored.
  • Claude Code: Learn how to use Claude Code with OpenRouter for improved reliability, provider failover, and organizational controls.
  • Claude Desktop: Learn how to use Claude Desktop with OpenRouter through built-in third-party inference mode.
  • Codex CLI: Learn how to configure Codex CLI to use OpenRouter for agentic coding with the latest GPT models and more.
  • Hermes Agent: Learn how to configure Hermes Agent to use OpenRouter for AI-powered coding, automation, and multi-platform messaging.
  • Junie CLI: Integrate OpenRouter with JetBrains Junie CLI. Complete setup guide for using hundreds of AI models with the Junie agentic coding tool.
  • Using MCP Servers with OpenRouter: Learn how to use MCP Servers with OpenRouter
  • OpenClaw 🦞: Learn how to configure OpenClaw to use OpenRouter for AI agents across multiple messaging platforms.
  • OpenCode: Learn how to configure OpenCode to use OpenRouter for agentic coding with access to hundreds of AI models.
  • Add Human-in-the-Loop Controls to an Agent SDK Agent: Add HITL controls to an existing OpenRouter Agent SDK agent so routine tool calls resolve automatically and high-stakes decisions pause for human review.
  • Build a Long-Horizon Agent: Run agents for hours, not seconds. Cap cost and step count, persist state for resumability, stream progress, and drive the same loop from voice input.
  • Build Your Own Agent TUI: Use the create-agent-tui skill to scaffold a custom AI agent in TypeScript with a customizable terminal UI, configurable tools, and streaming via @openrouter/agent.
  • Build Your Own Headless Agent: Use the create-headless-agent skill to scaffold a headless AI agent in TypeScript + Bun with configurable tools, output modes, and streaming via @openrouter/agent.
  • Choose a Video Generation Model: Fetch OpenRouter video model metadata, filter by capability, and score models by speed, cost, and quality priorities before submitting a video job.
  • Generate and Download a Video from Text: Submit an OpenRouter text-to-video generation job, poll the job status, and download the finished video file.
  • Get Video Results with Webhooks: Receive OpenRouter video job results through webhooks, preserve the raw request body, and verify the webhook signature.
  • Guide a Video with Reference Images: Submit an OpenRouter reference-to-video job with input_references when images should guide the generated result.
  • Turn an Image into a Video: Submit an OpenRouter image-to-video job with frame_images, poll for completion, and download the finished clip.
  • Use Provider-Specific Video Options: Use allowed_passthrough_parameters and provider.options to send model-specific video generation controls through OpenRouter.
  • Distillation: Learn how to use the distillable filter to ensure compliance with provider and model creator policies when using model outputs for training or distillation.
  • Claude 4.7 Migration Guide: Learn about the breaking changes in Claude 4.7 Opus — removed sampling parameters, adaptive-only thinking, and the new xhigh effort level.
  • Claude 4.6 Migration Guide: Learn about adaptive thinking and the new max effort level in Claude 4.6.
  • GPT-5.4 Migration Guide: Learn how to use the phase field for GPT-5.3 Codex, GPT-5.4, and GPT-5.4 Pro on OpenRouter.
  • RAG with Embeddings & Rerank: Learn how to build RAG pipelines using OpenRouter embeddings for retrieval and rerank models for precision, then generate answers with LLMs — all through a single API.
  • Red Teaming: Understand OpenRouter policies on red teaming, jailbreaking, and adversarial model testing. Learn how to get approval for legitimate security research.
  • Activity Export: Learn how to export your OpenRouter usage data as CSV or PDF reports, grouped by API key, model, or organization member.
  • API Key Rotation: Learn how to securely rotate your OpenRouter API keys using the key minting API. Includes best practices and BYOK advantages for simplified key management.
  • Crypto API: Coinbase deprecated the APIs used by the legacy Coinbase Commerce crypto credits endpoint, which now returns 410 Gone.
  • Organization Management: Learn how to create and manage organizations on OpenRouter for team collaboration, shared credits, and centralized API management.
  • Usage Accounting: Learn how to track AI model usage including prompt tokens, completion tokens, and cached tokens without additional API calls.
  • User Tracking: Learn how to use the user parameter to track your own user IDs with OpenRouter. Get detailed reporting and analytics on your sub-users.

API Docs

OpenAPI Specification

The raw OpenAPI 3.1 specification for this API is available at:

Related

Anthropic is an AI safety and research company that's working to build reliable, interpretable, and steerable AI systems.

/llms.txt
15,391 tokens
AI & Machine Learning

Perplexity AI is an AI-powered search engine that provides direct answers to user queries by leveraging large language models.

/llms.txt
1,173 tokens
/llms-full.txt
40,087 tokens
AI & Machine Learning

Shop Dell's laptops, Monitors, Computers, Storage Solutions & Servers for your home and business. Buy online!

/llms.txt
8,533 tokens
AI & Machine Learning

The AI Code Editor

/llms.txt
4,643 tokens
/llms-full.txt
95,589 tokens
AI & Machine Learning

Create the most realistic speech with our AI audio in 1000s of voices and 32 languages. Pioneering research in Text to Speech and AI Voice Generation

/llms.txt
23,168 tokens
/llms-full.txt
1,020,683 tokens
AI & Machine Learning

Get started with the Model Context Protocol (MCP).

/llms.txt
3,315 tokens
/llms-full.txt
223,365 tokens
AI & Machine Learning

The official Python client for the Huggingface Hub.

/llms.txt
143,619 tokens
AI & Machine Learning

The Voice AI Platform: TTS Models, Voice Agents, & More.

/llms.txt
1,738 tokens
/llms-full.txt
56,923 tokens
AI & Machine Learning