KI
kirkryan/perplexity-api
Perplexity API OpenAPI Specification
This repository contains an OpenAPI 3.0.3 specification for the Perplexity API.
Overview
The Perplexity API allows developers to integrate powerful AI models with search capabilities. The API is OpenAI-compatible for easy integration with existing applications.
Specification
The OpenAPI specification (perplexity-openapi.yaml) includes:
- Authentication method (Bearer token)
- Available endpoints (
/chat/completions) - Request and response schemas
- Available models
- Parameters for controlling model behavior
- Structured output formats (JSON Schema and Regex)
Available Models
sonar-deep-research: Performs exhaustive research across many sourcessonar-reasoning-pro: Premier reasoning offering powered by DeepSeek R1 with Chain of Thoughtsonar-pro: Premier search offering with search groundingsonar: Lightweight offering with search groundingr1-1776: DeepSeek R1 model post-trained for uncensored, unbiased information
Usage
You can use this OpenAPI specification to:
- Generate client libraries in various programming languages
- Set up API documentation
- Test API endpoints with tools like Postman or Swagger UI
- Validate API requests and responses
Example Request
curl --location 'https://api.perplexity.ai/chat/completions' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer {API_KEY}' \
--data '{
"model": "sonar-pro",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
},
{
"role": "user",
"content": "How many stars are there in our galaxy?"
}
]
}'Rate Limits
Rate limits vary by model and usage tier. Please refer to the official documentation for the most up-to-date information.
Resources
On this page
Contributors
Created March 6, 2025
Updated March 12, 2025