Status: [UNTESTED] Endpoints found: http://127.0.0.1:64130/v1/chat/completions http://127.0.0.1:64130/v1/responses Source: https://github.com/anojndr/perplexity-to-openai # Perplexity → OpenAI-compatible API Runs your Perplexity accounts behind a FastAPI server that speaks the OpenAI Chat Completions **and** Responses APIs. No browser is involved at runtime: requests go straight to Perplexity's private SSE endpoint with the session cookies from `accounts.txt` (Chrome TLS impersonation via `curl_cffi`). - Port: **64130** - Endpoints: `/v1/chat/completions`, `/v1/responses`, `/v1/models`, `/v1/responses/{id}`, `/healthz` - Streaming supported on both APIs (`stream: true`) - Multi-turn: Perplexity keeps thread state server-side; the proxy maps conversation identity (message-history hash / `previous_response_id`) to Perplexity's thread handle (`backend_uuid` + `read_write_token`). Only the new user message is sent per turn — never the whole conversation. - Files: images (data URL or remote URL) attach as image attachments (verified working); text-like files (`.py`, `.json`, `.txt`, …) are also inlined into the query so free-tier accounts can read them; binary files attach as file attachments (ingestion is gated by your Perplexity plan). - Accounts: load-balanced, any number. Add more blocks to `accounts.txt` — the file is re-read automatically (mtime check), no restart needed. Quota-exhausted or failing accounts are skipped and cooled down. ## Setup ```bash cd /home/sweetpotet/Desktop/perplexity-to-openai python3 -m venv .venv && . .venv/bin/activate pip install -r requirements.txt uvicorn server:app --host 0.0.0.0 --port 64130 ``` ## accounts.txt format Netscape cookie export, one block per account: ``` account 1: # Netscape HTTP Cookie File www.perplexity.ai FALSE / FALSE pplx.visitor-id ... .perplexity.ai TRUE / TRUE __Secure-next-auth.session-token ... account 2: ... ``` Export cookies (e.g. with a browser extension / DevTools) from `https://www.perplexity.ai` while logged in, including the `__Secure-next-auth.session-token` and `__Secure-pplx.session.*` cookies and `cf_clearance`