OpenAI-compatible API for Perplexity AI
Top 88.2% on sourcepulse
This project provides an OpenAI-compatible API gateway for Perplexity AI, enabling users to leverage Perplexity's advanced features like image recognition, reasoning, web search, and image generation through a familiar API structure. It targets developers and power users who want to integrate Perplexity's capabilities into their applications or workflows without direct reliance on Perplexity's native interface.
How It Works
Pplx2Api acts as a proxy, translating standard OpenAI API requests into Perplexity's internal API calls. It supports various Perplexity models, including those with integrated search capabilities (-search
suffix). Key features include handling multi-modal inputs (text and images), managing chat history by uploading long contexts as files, and offering a "privacy mode" to prevent chat history from being saved on Perplexity's servers. It also includes automatic cookie refreshing for continuous availability and an option to expose the model's thinking process.
Quick Start & Requirements
docker run -d -p 8080:8080 -e SESSIONS=<your_perplexity_session_cookie> -e APIKEY=<your_api_key> ghcr.io/yushangxiao/pplx2api:latest
__Secure-next-auth.session-token
), Go 1.23+ (for source build), Docker.SESSIONS
and APIKEY
environment variables. Multiple session cookies can be provided, comma-separated, for account rotation.Highlighted Details
Maintenance & Community
The project is maintained by yushangxiao. Contributions are welcome via pull requests.
Licensing & Compatibility
MIT License. Compatible with commercial use and closed-source applications.
Limitations & Caveats
The project relies on Perplexity.ai's internal API, which could change without notice, potentially breaking the compatibility of this wrapper. The effectiveness of features like account rotation depends on the validity and management of the provided session cookies.
1 week ago
Inactive