Base URL
When running Perplexica locally, the default base URL is:Replace
localhost:3000 with your Perplexica instance URL if running on a different host or port.API architecture
Perplexica’s API is built on Next.js and provides several key endpoints:- Search API (
/api/search) - Execute AI-powered searches with customizable sources and models - Chat API (
/api/chat) - Interactive chat interface with conversation history - Providers API (
/api/providers) - Retrieve available AI model providers and their models - Additional endpoints - Images, videos, suggestions, and more
Key concepts
Providers and models
Before making search requests, you need to understand Perplexica’s provider system:- Providers are AI service platforms (OpenAI, Anthropic, Ollama, etc.)
- Each provider offers chat models (for generating responses) and embedding models (for semantic search)
- You must specify both a chat model and embedding model for each request
- Provider IDs are UUIDs that you obtain from the
/api/providersendpoint
Use the
/api/providers endpoint to get a list of all configured providers and their available models before making search requests.Search sources
Perplexica can search different types of content:web- General web search resultsacademic- Academic papers and scholarly contentdiscussions- Forum discussions and community content
Optimization modes
Control the balance between speed and quality:speed- Fastest responses, ideal for quick queriesbalanced- Good balance between speed and quality (default)quality- Highest quality responses, may take longer
Response formats
Standard responses
By default, the API returns complete JSON responses with:message- The generated answersources- Array of sources used, including content snippets and metadata
Streaming responses
Setstream: true to receive real-time updates via Server-Sent Events (SSE):
- Progressive text generation
- Lower perceived latency
- Better user experience for long responses
Example workflow
-
Get available providers and models
- Extract provider IDs and model keys from the response
-
Make a search request using the obtained IDs:
- Process the response containing the answer and sources
Error handling
The API uses standard HTTP status codes:- 200 - Successful request
- 400 - Invalid request (missing required fields, malformed JSON)
- 500 - Internal server error
message field describing the issue:
Rate limits
Perplexica does not enforce built-in rate limits, but your responses may be limited by:- The AI provider’s rate limits (OpenAI, Anthropic, etc.)
- Your server’s resource capacity
- Network bandwidth for streaming responses
Next steps
Authentication
Learn about API authentication requirements
Search endpoint
Detailed documentation for the search API