Skip to main content

Overview

LiteLLM is a Python SDK and proxy server that gives you a single OpenAI-compatible interface to 100+ LLM providers. Perplexity’s Agent API — with third-party models like GPT-5, Claude, and Gemini routed through Perplexity — is a first-class provider in LiteLLM.
LiteLLM lets you swap providers without rewriting code, run a self-hosted proxy that fronts every model behind one API key, and track spend, latency, and errors per provider. Learn more at litellm.ai.

Installation

API Key Setup

LiteLLM reads your Perplexity API key from the environment:

Get API Key

Generate your Perplexity API key from the API portal.

Agent API

Use litellm.responses to call the Agent API, which routes through Perplexity to third-party models with tool orchestration and presets.

Presets

Available presets: fast, low, medium, high, xhigh.

Tool Use (web_search and fetch_url)

Structured Outputs

Supported Third-Party Models via Agent API

Prefix any Agent API model ID with perplexity/ (for example, perplexity/openai/gpt-5.6-sol). See the Agent API model list for the canonical, up-to-date catalogue.

LiteLLM Proxy

Run LiteLLM as a self-hosted proxy that fronts Perplexity (and any other provider) behind a single OpenAI-compatible endpoint.

config.yaml

Start the Proxy

Call the Proxy

LiteLLM Perplexity Docs

Official LiteLLM Perplexity provider docs.

LiteLLM Docs

Full LiteLLM documentation.

Perplexity Agent API

Agent API reference and presets.

Agent API Models

Available Agent API models.

Support

Need help with the integration?