# Perplexity

> **You are on:** `https://beta-api.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | beta-api.paywithlocus.com |
> | Stage | stage.paywithlocus.com | stage-api.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> AI-powered search — Sonar chat with real-time web grounding, web search, and embeddings.

**Category:** AI / Search | **Website:** [perplexity.ai](https://perplexity.ai) | **Docs:** [docs.perplexity.ai](https://docs.perplexity.ai)

## Access Methods

| Method | Base URL | Auth |
|--------|----------|------|
| **MPP (Tempo)** | `https://perplexity.mpp.paywithlocus.com/perplexity/` | HTTP 402 auto-payment |
| **Wrapped API** | `https://beta-api.paywithlocus.com/api/wrapped/perplexity/` | `Authorization: Bearer <LOCUS_API_KEY>` |

**OpenAPI discovery:** `GET https://perplexity.mpp.paywithlocus.com/openapi.json`

## Endpoints

### Sonar Chat

Generate chat completions with Sonar models. Features real-time web search grounding, citations, structured output, and reasoning capabilities.

**Estimated cost:** Model-dependent (~$0.005–$0.02)

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Sonar model ID: 'sonar', 'sonar-pro', 'sonar-reasoning-pro', 'sonar-deep-research' |
| `messages` | array | Yes | Conversation messages. Each: { role: "system"|"user"|"assistant", content: "text" } or multimodal with image_url content blocks. |
| `max_tokens` | number | No | Maximum output tokens (up to 128000) |
| `temperature` | number | No | Sampling temperature (0.0–2.0) |
| `top_p` | number | No | Nucleus sampling threshold (0.0–1.0) |
| `response_format` | object | No | Structured output. { type: "json_schema", json_schema: { name: "...", schema: {...} } } |
| `web_search_options` | object | No | Web search configuration: { search_context_size: 'low'|'medium'|'high', search_type: 'fast'|'pro'|'auto', user_location: { country: '...', city: '...' } } |
| `search_domain_filter` | string[] | No | Restrict search to specific domains |
| `search_recency_filter` | string | No | Time filter for search results: 'hour', 'day', 'week', 'month', 'year' |
| `search_language_filter` | string[] | No | Filter search results by language (ISO 639-1 codes) |
| `return_images` | boolean | No | Include image results in the response |
| `return_related_questions` | boolean | No | Include related follow-up questions in the response |
| `reasoning_effort` | string | No | Reasoning effort level (sonar-reasoning-pro only): 'minimal', 'low', 'medium', 'high' |

```bash
curl -X POST https://perplexity.mpp.paywithlocus.com/perplexity/chat \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","messages":"<array>","max_tokens":"<number>","temperature":"<number>","top_p":"<number>","response_format":"<object>","web_search_options":"<object>","search_domain_filter":"<string[]>","search_recency_filter":"<string>","search_language_filter":"<string[]>","return_images":"<boolean>","return_related_questions":"<boolean>","reasoning_effort":"<string>"}'
```

### Web Search

Search the web and retrieve ranked results with titles, URLs, snippets, and dates. Supports domain, language, recency, and date range filters.

**Estimated cost:** $0.006

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | string[] | Yes | Search query — a single string or array of queries |
| `max_results` | number | No | Maximum results to return (1–20, default 10) |
| `search_domain_filter` | string[] | No | Restrict search to specific domains (max 20) |
| `search_recency_filter` | string | No | Time filter: 'hour', 'day', 'week', 'month', 'year' |
| `search_language_filter` | string[] | No | Language filter (ISO 639-1 codes) |
| `search_after_date_filter` | string | No | Only results after this date (MM/DD/YYYY) |
| `search_before_date_filter` | string | No | Only results before this date (MM/DD/YYYY) |
| `country` | string | No | Country code for result localization (ISO 3166-1 alpha-2) |

```bash
curl -X POST https://perplexity.mpp.paywithlocus.com/perplexity/search \
  -H "Content-Type: application/json" \
  -d '{"query":"<string | string[]>","max_results":"<number>","search_domain_filter":"<string[]>","search_recency_filter":"<string>","search_language_filter":"<string[]>","search_after_date_filter":"<string>","search_before_date_filter":"<string>","country":"<string>"}'
```

### Embeddings

Generate vector embeddings for semantic search, clustering, and RAG. Supports MRL (Matryoshka) dimensionality reduction and INT8/BINARY quantization.

**Estimated cost:** ~$0.001

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Embedding model: 'pplx-embed-v1-0.6b' or 'pplx-embed-v1-4b' |
| `input` | string | string[] | Yes | Text to embed. Single string or array of strings. |

```bash
curl -X POST https://perplexity.mpp.paywithlocus.com/perplexity/embed \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","input":"<string | string[]>"}'
```

### Contextualized Embeddings

Generate document-aware embeddings where chunks share context from a parent document. Better for RAG over chunked documents.

**Estimated cost:** ~$0.001

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Contextualized model: 'pplx-embed-context-v1-0.6b' or 'pplx-embed-context-v1-4b' |
| `document` | string | Yes | The full parent document text providing shared context |
| `chunks` | string[] | Yes | Array of text chunks from the document to embed |

```bash
curl -X POST https://perplexity.mpp.paywithlocus.com/perplexity/context-embed \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","document":"<string>","chunks":"<string[]>"}'
```
