Skip to main content
Router API is in private preview. Email api@perplexity.ai to request access.

Overview

The Router API provides unified access to open-weight models hosted by Perplexity through a single API and API key. Send requests in the OpenAI Chat Completions, OpenAI Responses, or Anthropic Messages format, pick any model from the catalog, and the platform routes each request to a healthy deployment automatically — no per-provider accounts, SDKs, or failover logic on your side. Any model in the catalog can be called through any supported schema, regardless of the model’s original provider. This makes the Router a drop-in replacement for existing OpenAI or Anthropic integrations — only the base URL and API key need to change. Use the Router API for direct model access with your own prompts and tools. For web-grounded answers with built-in citations, use the Agent API. The base URL is https://api.perplexity.ai/router/v1, and your existing Perplexity API key works as-is.

Installation

The Router API supports the OpenAI Chat Completions and Responses formats plus the Anthropic Messages format, so you can use either provider’s official SDK — install whichever matches your integration (or both):

Authentication

Set your API key as an environment variable:
Requests authenticate with an Authorization: Bearer header, which the SDKs set for you from the api_key parameter.

Basic Usage

Point the OpenAI SDK at the Router base URL and pass any model id from the catalog. Model ids use creator/model-name slugs, so switching providers is a one-line change:
The response echoes the model id you requested, and you are always billed at that model’s published rates no matter how the request was served.

OpenAI Responses

Use client.responses.create() with the same Router base URL when your integration uses the OpenAI Responses format. The Router Responses endpoint is stateless, so include the full conversation in input on each request.

Streaming Chat Completions

Set stream: true to receive tokens as server-sent events. To get token usage with a streamed response, also set stream_options: {"include_usage": true} — usage then arrives in a final chunk before data: [DONE]:

Anthropic Messages

The same models are available in the Anthropic Messages format at /router/v1/messages, so code written against the Anthropic SDK works with a base-URL change:
The Anthropic SDK appends /v1/messages to its base URL, so configure it with https://api.perplexity.ai/router (no /v1). The OpenAI SDK appends /chat/completions and is configured with https://api.perplexity.ai/router/v1.

Discovering Models

List the current catalog at any time — the response is OpenAI-compatible, sorted by model id, and includes each model’s base token prices in USD per 1M tokens:
See the models page for the full catalog with pricing.

Next Steps

Models & Pricing

The model catalog with per-token rates.

Routing & Reliability

How requests are routed and what happens when a provider fails.

Chat Completions Reference

Full request and response schema.

Responses Reference

The OpenAI Responses-compatible endpoint schema.

Messages Reference

The Anthropic-compatible endpoint schema.
Need help? Check out our community for support.