# Openrouter > Documentation for Openrouter ## Pages - [Openrouter Documentation](openrouter-documentation.md) - [Quickstart](quickstart.md): Get started with OpenRouter's unified API for hundreds of AI models. Learn how to integrate using OpenAI SDK, direct ... - [Principles](principles.md): Learn about OpenRouter's guiding principles and mission. Understand our commitment to price optimization, standardize... - [Models](models.md): Access all major language models (LLMs) through OpenRouter's unified API. Browse available models, compare capabiliti... - [Multimodal Capabilities](multimodal-capabilities.md): Send images, PDFs, audio, and video to OpenRouter models through our unified API. - [Image Inputs](image-inputs.md): Send images to vision models through the OpenRouter API. - [Image Generation](image-generation.md): Generate images using AI models through the OpenRouter API. - [PDF Inputs](pdf-inputs.md): Send PDF documents to any model on OpenRouter. - [Audio Inputs](audio-inputs.md): Send audio files to speech-capable models through the OpenRouter API. - [Video Inputs](video-inputs.md): Send video files to video-capable models through the OpenRouter API. - [OAuth PKCE](oauth-pkce.md): Implement secure user authentication with OpenRouter using OAuth PKCE. Complete guide to setting up and managing OAut... - [Provisioning API Keys](provisioning-api-keys.md): Manage OpenRouter API keys programmatically through dedicated management endpoints. Create, read, update, and delete ... - [BYOK](byok.md): Learn how to use your existing AI provider keys with OpenRouter. Integrate your own API keys while leveraging OpenRou... - [Frequently Asked Questions](frequently-asked-questions.md): Find answers to commonly asked questions about OpenRouter's unified API, model access, pricing, and integration. - [Report Feedback](report-feedback.md): Learn how to report issues with AI generations on OpenRouter using the Report Feedback feature in the Chatroom and Ac... - [Model Fallbacks](model-fallbacks.md): Configure automatic failover between AI models when providers are down, rate-limited, or refuse requests. - [Provider Routing](provider-routing.md): Route AI model requests across multiple providers intelligently. Learn how to optimize for cost, performance, and rel... - [Free Variant](free-variant.md): Access free models using the :free variant suffix. - [Extended Variant](extended-variant.md): Access extended context window versions of models using the :extended variant. - [Exacto Variant](exacto-variant.md): Learn how to target OpenRouter-selected providers by using the :exacto model variant. - [Thinking Variant](thinking-variant.md): Enable extended reasoning capabilities using the :thinking variant. - [Online Variant](online-variant.md): Enable real-time web search capabilities using the :online variant. - [Nitro Variant](nitro-variant.md): Access high-speed model inference using the :nitro variant. - [Auto Router](auto-router.md): Automatically select the best AI model for your prompts using OpenRouter's Auto Router powered by NotDiamond. - [Body Builder](body-builder.md): Use natural language to generate multiple OpenRouter API requests for parallel model execution. - [Presets](presets.md): Learn how to use OpenRouter's presets to manage model configurations, system prompts, and parameters across your appl... - [Tool & Function Calling](tool-function-calling.md): Use tools (or functions) in your prompts with OpenRouter. Learn how to use tools with OpenAI, Anthropic, and other mo... - [Plugins](plugins.md): Enable powerful plugins like web search, PDF processing, and response healing to extend any model's capabilities on O... - [Web Search](web-search.md): Enable real-time web search capabilities in your AI model responses. Add factual, up-to-date information to any model... - [Response Healing](response-healing.md): Automatically validate and repair malformed JSON responses from AI models. Ensure your responses match your schema ev... - [Structured Outputs](structured-outputs.md): Enforce JSON Schema validation on AI model responses. Get consistent, type-safe outputs and avoid parsing errors with... - [Message Transforms](message-transforms.md): Transform and optimize messages before sending them to AI models. Learn about middle-out compression and context wind... - [Zero Completion Insurance](zero-completion-insurance.md): Learn how OpenRouter protects users from being charged for failed or empty AI responses with zero completion insurance. - [Zero Data Retention](zero-data-retention.md): Learn how OpenRouter gives you control over your data - [App Attribution](app-attribution.md): Learn how to attribute your API usage to your app and appear in OpenRouter's app rankings and model analytics. - [Guardrails](guardrails.md): Set spending limits, restrict model access, and enforce data policies for your organization members and API keys with... - [Broadcast](broadcast.md): Connect your LLM observability platforms to automatically receive traces from your OpenRouter requests. Supports Lang... - [Arize AI](arize-ai.md): Connect Arize AI to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Arize in... - [Braintrust](braintrust.md): Connect Braintrust to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Braint... - [ClickHouse](clickhouse.md): Connect ClickHouse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for ClickH... - [Comet Opik](comet-opik.md): Connect Comet Opik to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Opik i... - [Datadog](datadog.md): Connect Datadog LLM Observability to automatically receive traces from your OpenRouter requests. Step-by-step setup g... - [Grafana Cloud](grafana-cloud.md): Connect Grafana Cloud to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Gra... - [Langfuse](langfuse.md): Connect Langfuse to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Langfuse... - [LangSmith](langsmith.md): Connect LangSmith to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for LangSmi... - [New Relic](new-relic.md): Connect New Relic to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for New Rel... - [OpenTelemetry Collector](opentelemetry-collector.md): Connect any OpenTelemetry-compatible backend to automatically receive traces from your OpenRouter requests. Step-by-s... - [PostHog](posthog.md): Connect PostHog to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for PostHog i... - [S3 / S3-Compatible](s3-s3-compatible.md): Connect Amazon S3 or S3-compatible storage to automatically receive traces from your OpenRouter requests. Step-by-ste... - [Sentry](sentry.md): Connect Sentry to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Sentry int... - [Snowflake](snowflake.md): Connect Snowflake to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for Snowfla... - [W&B Weave](wb-weave.md): Connect W&B Weave to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for W&B Wea... - [Webhook](webhook.md): Connect any HTTP endpoint to automatically receive traces from your OpenRouter requests. Step-by-step setup guide for... - [Data Collection](data-collection.md): Learn what data OpenRouter collects and how it's used. - [Logging](logging.md): Understand how AI providers handle logging and data retention when you use OpenRouter. - [Latency and Performance](latency-and-performance.md): Learn about OpenRouter's performance characteristics, latency optimizations, and best practices for achieving optimal... - [Prompt Caching](prompt-caching.md): Reduce your AI model costs with OpenRouter's prompt caching feature. Learn how to cache and reuse responses across Op... - [Uptime Optimization](uptime-optimization.md): Learn how OpenRouter maximizes AI model uptime through real-time monitoring, intelligent routing, and automatic fallb... - [Reasoning Tokens](reasoning-tokens.md): Learn how to use reasoning tokens to enhance AI model outputs. Implement step-by-step reasoning traces for better dec... - [Enterprise Quickstart](enterprise-quickstart.md): A comprehensive guide for enterprise customers to get started with OpenRouter. Learn about organizations, API key man... - [API Key Rotation](api-key-rotation.md): Learn how to securely rotate your OpenRouter API keys using the key minting API. Includes best practices and BYOK adv... - [Crypto API](crypto-api.md): Learn how to purchase OpenRouter credits using cryptocurrency. Complete guide to Coinbase integration, supported chai... - [Using MCP Servers with OpenRouter](using-mcp-servers-with-openrouter.md): Learn how to use MCP Servers with OpenRouter - [Claude Code](claude-code.md): Learn how to use Claude Code with OpenRouter for improved reliability, provider failover, and organizational controls. - [OpenClaw 🦞](openclaw.md): Learn how to configure OpenClaw to use OpenRouter for AI agents across multiple messaging platforms. - [Organization Management](organization-management.md): Learn how to create and manage organizations on OpenRouter for team collaboration, shared credits, and centralized AP... - [Provider Integration](provider-integration.md): Learn how to integrate your AI models with OpenRouter. Complete guide for providers to make their models available th... - [Usage Accounting](usage-accounting.md): Learn how to track AI model usage including prompt tokens, completion tokens, and cached tokens without additional AP... - [Activity Export](activity-export.md): Learn how to export your OpenRouter usage data as CSV or PDF reports, grouped by API key, model, or organization member. - [User Tracking](user-tracking.md): Learn how to use the user parameter to track your own user IDs with OpenRouter. Improve caching performance and get d... - [Consistent format](consistent-format.md): user_id = f"app_{internal_user_id}" - [Distillation](distillation.md): Learn how to use the distillable filter to ensure compliance with provider and model creator policies when using mode... - [Frameworks and Integrations Overview](frameworks-and-integrations-overview.md): Integrate OpenRouter using popular frameworks and SDKs. Complete guides for OpenAI SDK, LangChain, PydanticAI, and Ve... - [Awesome OpenRouter](awesome-openrouter.md): Discover community-built projects and apps powered by OpenRouter. Submit your own project to the awesome-openrouter l... - [Effect AI SDK](effect-ai-sdk.md): Integrate OpenRouter using the Effect AI SDK. Complete guide for integrating the Effect AI SDK with OpenRouter. - [Arize](arize.md): Integrate OpenRouter using Arize for observability and tracing. Complete guide for Arize integration with OpenRouter ... - [LangChain](langchain.md): Integrate OpenRouter using LangChain framework. Complete guide for LangChain integration with OpenRouter for Python a... - [LiveKit](livekit.md): Integrate OpenRouter using LiveKit Agents framework. Complete guide for LiveKit integration with OpenRouter to build ... - [Langfuse](langfuse-2.md): Integrate OpenRouter using Langfuse for observability and tracing. Complete guide for Langfuse integration with OpenR... - [Mastra](mastra.md): Integrate OpenRouter using Mastra framework. Complete guide for Mastra integration with OpenRouter for unified AI mod... - [OpenAI SDK](openai-sdk.md): Integrate OpenRouter using the official OpenAI SDK. Complete guide for OpenAI SDK integration with OpenRouter for Pyt... - [Anthropic Agent SDK](anthropic-agent-sdk.md): Integrate OpenRouter using the Anthropic Agent SDK. Complete guide for building AI agents with OpenRouter in Python a... - [Environment variables should be set before running:](environment-variables-should-be-set-before-running.md) - [ANTHROPIC_API_KEY=""](anthropic-api-key.md): async def main(): - [PydanticAI](pydanticai.md): Integrate OpenRouter using PydanticAI framework. Complete guide for PydanticAI integration with OpenRouter for Python... - [TanStack AI](tanstack-ai.md): Integrate OpenRouter using TanStack AI. Complete guide for TanStack AI integration with OpenRouter for React, Solid, ... - [Vercel AI SDK](vercel-ai-sdk.md): Integrate OpenRouter using Vercel AI SDK. Complete guide for Vercel AI SDK integration with OpenRouter for Next.js ap... - [Xcode](xcode.md): Integrate OpenRouter with Apple Intelligence in Xcode 26. Complete setup guide for accessing hundreds of AI models di... - [Zapier](zapier.md): Build powerful AI automations by connecting OpenRouter with 8000+ apps through Zapier. Access 300+ AI models in your ... - [Infisical](infisical.md): Set up automatic API key rotation for OpenRouter using Infisical. Complete guide for secure key management and zero-d... - [API Reference](api-reference.md): Comprehensive guide to OpenRouter's API. Learn about request/response schemas, authentication, parameters, and integr... - [Streaming](streaming.md): Learn how to implement streaming responses with OpenRouter's API. Complete guide to Server-Sent Events (SSE) and real... - [Embeddings](embeddings.md): Generate vector embeddings from text using OpenRouter's unified embeddings API. Access multiple embedding models from... - [Limits](limits.md): Learn about OpenRouter's API rate limits, credit-based quotas, and DDoS protection. Configure and monitor your model ... - [Authentication](authentication.md): Learn how to authenticate with OpenRouter using API keys and Bearer tokens. Complete guide to secure authentication m... - [Parameters](parameters.md): Learn about all available parameters for OpenRouter API requests. Configure temperature, max tokens, top_p, and other... - [Errors and Debugging](errors-and-debugging.md): Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, mes... - [Responses API Beta](responses-api-beta.md): Beta version of OpenRouter's OpenAI-compatible Responses API. Stateless transformation layer with support for reasoni... - [Basic Usage](basic-usage.md): Learn the basics of OpenRouter's Responses API Beta with simple text input examples and response handling. - [Reasoning](reasoning.md): Access advanced reasoning capabilities with configurable effort levels and encrypted reasoning chains using OpenRoute... - [Tool Calling](tool-calling.md): Integrate function calling with support for parallel execution and complex tool interactions using OpenRouter's Respo... - [Web Search](web-search-2.md): Enable web search capabilities with real-time information retrieval and citation annotations using OpenRouter's Respo... - [Error Handling](error-handling.md): Learn how to handle errors in OpenRouter's Responses API Beta with the basic error response format. - [Create a response](create-a-response.md): POST - [Exchange authorization code for API key](exchange-authorization-code-for-api-key.md): POST - [Create authorization code](create-authorization-code.md): POST - [Create a message](create-a-message.md): POST - [Get user activity grouped by endpoint](get-user-activity-grouped-by-endpoint.md): GET - [Get remaining credits](get-remaining-credits.md): GET - [Create a Coinbase charge for crypto payment](create-a-coinbase-charge-for-crypto-payment.md): POST - [Submit an embedding request](submit-an-embedding-request.md): POST - [List all embeddings models](list-all-embeddings-models.md): GET - [Get request & usage metadata for a generation](get-request-usage-metadata-for-a-generation.md): GET - [Get total count of available models](get-total-count-of-available-models.md): GET - [List all models and their properties](list-all-models-and-their-properties.md): GET - [List models filtered by user provider preferences, privacy settings, and guardrails](list-models-filtered-by-user-provider-preferences-privacy-settings-and-guardrail.md): GET - [List all endpoints for a model](list-all-endpoints-for-a-model.md): GET - [Preview the impact of ZDR on the available endpoints](preview-the-impact-of-zdr-on-the-available-endpoints.md): GET - [List all providers](list-all-providers.md): GET - [List API keys](list-api-keys.md): GET - [Create a new API key](create-a-new-api-key.md): POST - [Get a single API key](get-a-single-api-key.md): GET - [Delete an API key](delete-an-api-key.md): DELETE - [Update an API key](update-an-api-key.md): PATCH - [Get current API key](get-current-api-key.md): GET - [List guardrails](list-guardrails.md): GET - [Create a guardrail](create-a-guardrail.md): POST - [Get a guardrail](get-a-guardrail.md): GET - [Delete a guardrail](delete-a-guardrail.md): DELETE - [Update a guardrail](update-a-guardrail.md): PATCH - [List all key assignments](list-all-key-assignments.md): GET - [List all member assignments](list-all-member-assignments.md): GET - [List key assignments for a guardrail](list-key-assignments-for-a-guardrail.md): GET - [Bulk assign keys to a guardrail](bulk-assign-keys-to-a-guardrail.md): POST - [List member assignments for a guardrail](list-member-assignments-for-a-guardrail.md): GET - [Bulk assign members to a guardrail](bulk-assign-members-to-a-guardrail.md): POST - [Bulk unassign keys from a guardrail](bulk-unassign-keys-from-a-guardrail.md): POST - [Bulk unassign members from a guardrail](bulk-unassign-members-from-a-guardrail.md): POST - [Create a chat completion](create-a-chat-completion.md): POST - [Agentic Usage](agentic-usage.md): Add OpenRouter SDK skills to AI coding assistants like Claude Code, Cursor, GitHub Copilot, and more. Enable your AI ... - [DevTools](devtools.md): Comprehensive development tools for the OpenRouter SDK. Capture telemetry, visualize requests, and debug your AI appl... - [TypeScript SDK](typescript-sdk.md): Complete guide to using the OpenRouter TypeScript SDK. Learn how to integrate AI models into your TypeScript applicat... - [Call Model (Typescript)](call-model-typescript.md): Learn how to use callModel for text generation, streaming, and tool calling with automatic execution. Access 300+ LLM... - [Working with Items](working-with-items.md): Learn the items-based streaming paradigm for callModel. Replace items by ID instead of accumulating chunks for simple... - [API Reference](api-reference-2.md): Complete API reference for callModel, ModelResult, tool types, and helper functions in the OpenRouter SDK. - [Dynamic Parameters](dynamic-parameters.md): Use async functions to dynamically compute callModel parameters. Adapt model selection, temperature, and instructions... - [Next Turn Params](next-turn-params.md): Build encapsulated, context-aware tools with nextTurnParams. Create skills systems, plugins, and adaptive multi-turn ... - [Stop Conditions](stop-conditions.md): Control multi-turn execution with stopWhen. Use built-in helpers or custom conditions to stop by step count, tool cal... - [Streaming](streaming-2.md): Learn to stream LLM responses with callModel. Covers text streaming, reasoning streams, message updates, and concurre... - [Text Generation](text-generation.md): Learn how to generate text with callModel. Covers input formats, model selection, system instructions, and response h... - [Message Formats](message-formats.md): Convert between OpenAI chat format, Anthropic Claude format, and OpenResponses format. Easy migration from other SDKs. - [Tools](tools.md): Create strongly-typed tools for LLMs with Zod schemas. Learn about regular tools, generator tools with progress, manu... - [Weather Tool](weather-tool.md): Build a weather tool with external API integration, Zod validation, error handling, and environment configuration. - [Skills Loader](skills-loader.md): Build a complete skills system like Claude Code using nextTurnParams for context injection, idempotency, and multi-sk... - [PDF Processing Skill](pdf-processing-skill.md): You are now equipped with PDF processing capabilities. - [Analytics - TypeScript SDK](analytics-typescript-sdk.md): Analytics method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [APIKeys - TypeScript SDK](apikeys-typescript-sdk.md): APIKeys method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Chat - TypeScript SDK](chat-typescript-sdk.md): Chat method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Credits - TypeScript SDK](credits-typescript-sdk.md): Credits method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Embeddings - TypeScript SDK](embeddings-typescript-sdk.md): Embeddings method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examp... - [Endpoints - TypeScript SDK](endpoints-typescript-sdk.md): Endpoints method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Generations - TypeScript SDK](generations-typescript-sdk.md): Generations method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code exam... - [Guardrails - TypeScript SDK](guardrails-typescript-sdk.md): Guardrails method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examp... - [Models - TypeScript SDK](models-typescript-sdk.md): Models method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [OAuth - TypeScript SDK](oauth-typescript-sdk.md): OAuth method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Providers - TypeScript SDK](providers-typescript-sdk.md): Providers method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code examples. - [Beta.Responses - TypeScript SDK](betaresponses-typescript-sdk.md): Beta.Responses method documentation for the OpenRouter TypeScript SDK. Learn how to use this API endpoint with code e... - [Python SDK](python-sdk.md): Complete guide to using the OpenRouter Python SDK. Learn how to integrate AI models into your Python applications. - [When new models launch, they're available instantly](when-new-models-launch-theyre-available-instantly.md): response = client.chat.send( - [Instead of generic errors, get specific guidance:](instead-of-generic-errors-get-specific-guidance.md) - ["Model 'openai/o1-preview' requires at least 2 messages.](model-openaio1-preview-requires-at-least-2-messages.md) - [You provided 1 message. Add a system or user message."](you-provided-1-message-add-a-system-or-user-message.md): **Type-safe streaming:** - [Using poetry](using-poetry.md): poetry add openrouter - [Analytics - Python SDK](analytics-python-sdk.md): Analytics method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [APIKeys - Python SDK](apikeys-python-sdk.md): APIKeys method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Chat - Python SDK](chat-python-sdk.md): Chat method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Credits - Python SDK](credits-python-sdk.md): Credits method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Embeddings - Python SDK](embeddings-python-sdk.md): Embeddings method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Endpoints - Python SDK](endpoints-python-sdk.md): Endpoints method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Generations - Python SDK](generations-python-sdk.md): Generations method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Guardrails - Python SDK](guardrails-python-sdk.md): Guardrails method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Models - Python SDK](models-python-sdk.md): Models method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [OAuth - Python SDK](oauth-python-sdk.md): OAuth method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Providers - Python SDK](providers-python-sdk.md): Providers method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples. - [Responses - Python SDK](responses-python-sdk.md): Responses method documentation for the OpenRouter Python SDK. Learn how to use this API endpoint with code examples.