Skip to main content
OpenRouter provides access to many AI models from different providers through a single, unified API. This makes it easy to switch between models without changing your code.

Setup

Set your API key as an environment variable:
Get your API key from OpenRouter.

Usage

Available Models

OpenRouter provides access to models from many providers. Model IDs follow the pattern provider/model-name: See the OpenRouter models page for a full list.

Provider Options

Customize parameters:

Streaming

Why OpenRouter?

  • Single API: Access models from OpenAI, Anthropic, Google, Meta, and more through one API
  • Fallback routing: Automatically fall back to alternative models if one is unavailable
  • Cost optimization: Compare prices across providers
  • No vendor lock-in: Easily switch between models without code changes