# Perplexity AI

Perplexity AI provides conversational AI models for generating human-like text responses

- **Category:** artificial intelligence
- **Auth:** API_KEY
- **Tools:** 1
- **Triggers:** 0
- **Slug:** `PERPLEXITYAI`
- **Version:** 20260211_00

## Tools

### Create Async Chat Completion

**Slug:** `PERPLEXITYAI_CREATE_ASYNC_CHAT_COMPLETION`

Create Async Chat Completion (POST /v1/async/sonar). Submits an asynchronous chat completion request for long-running tasks. Returns immediately with a request ID that can be polled using the Get Async Chat Completion action. Only the 'sonar-deep-research' model is supported for async processing. Async jobs have a 7-day TTL. Deep research generates very long responses (10K-100K+ words) with exhaustive multi-source analysis. Use the idempotency_key to prevent duplicate submissions. Poll with Get Async Chat Completion using the returned request ID to retrieve results when status is COMPLETED.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `request` | object | Yes | The chat completion request to run asynchronously. |
| `idempotency_key` | string | No | Optional key to prevent duplicate requests. Deduplication requires the exact same request body. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Chat Completion

**Slug:** `PERPLEXITYAI_CREATE_CHAT_COMPLETION`

Perplexity Sonar Chat Completions (POST /v1/sonar). Generates web-grounded conversational AI responses with citations. Supports multiple Sonar models optimized for different use cases: - sonar: Fast, cost-effective for simple queries - sonar-pro: Enhanced quality for complex questions - sonar-reasoning-pro: Chain-of-thought reasoning with <think> blocks - sonar-deep-research: Exhaustive multi-source research (generates very long responses, 10K+ words; prefer the async endpoint for this model) Features: web search grounding, citations, images, structured JSON output, search filtering by domain/date/language/recency, and streaming. Important constraints: - search_recency_filter and date filters (search_after_date_filter, search_before_date_filter, etc.) are mutually exclusive. Use one or the other, not both. - Messages with the 'tool' role must alternate with 'assistant' messages. A valid pattern is: system -> user -> assistant -> tool -> user. - The 'stop' parameter is not currently supported by the API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `stop` | string | No | Stop sequence(s) to end generation. Note: the API may not support custom stop words for all models. |
| `model` | string ("sonar" | "sonar-pro" | "sonar-deep-research" | "sonar-reasoning-pro") | No | The Sonar model to use. 'sonar' for fast/cheap queries, 'sonar-pro' for complex queries, 'sonar-reasoning-pro' for chain-of-thought reasoning, 'sonar-deep-research' for exhaustive research (generates very long 10K+ word responses; prefer the async endpoint for this model). |
| `top_p` | number | No | Nucleus sampling threshold controlling cumulative probability of tokens. |
| `stream` | boolean | No | Whether to stream the response using server-sent events. |
| `messages` | array | Yes | A list of messages comprising the conversation. Each message has a role (system, user, assistant, tool) and content. Messages with 'tool' role must alternate with 'assistant' messages. Valid pattern: system -> user -> assistant -> tool -> user. |
| `max_tokens` | integer | No | Maximum number of tokens to generate. Max 128000. |
| `search_mode` | string | No | Search mode. Options: 'web', 'academic', 'sec'. |
| `stream_mode` | string | No | Stream mode: 'full' (default) or 'concise'. |
| `temperature` | number | No | Controls randomness. 0 is deterministic, up to 2 is more random. |
| `return_images` | boolean | No | Whether to include images in the response. |
| `disable_search` | boolean | No | Whether to disable web search entirely. |
| `response_format` | object | No | Response format configuration. |
| `reasoning_effort` | string | No | Reasoning effort level: 'minimal', 'low', 'medium', 'high'. |
| `web_search_options` | object | No | Options for web search behavior. |
| `image_domain_filter` | array | No | Filter images by source domain. |
| `image_format_filter` | array | No | Filter images by format (e.g. 'png', 'jpg'). |
| `language_preference` | string | No | Preferred response language as ISO 639-1 code (e.g. 'en', 'fr'). |
| `search_domain_filter` | array | No | List of domains to restrict search results to. |
| `search_recency_filter` | string | No | Filter by recency: 'hour', 'day', 'week', 'month', 'year'. Mutually exclusive with date filters (search_after_date_filter, search_before_date_filter, last_updated_after_filter, last_updated_before_filter). |
| `search_language_filter` | array | No | ISO 639-1 language codes to filter search results. |
| `enable_search_classifier` | boolean | No | Whether to enable the search classifier. |
| `return_related_questions` | boolean | No | Whether to return related questions. |
| `search_after_date_filter` | string | No | Only include results published after this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |
| `last_updated_after_filter` | string | No | Only include results last updated after this date (MM/DD/YYYY). |
| `search_before_date_filter` | string | No | Only include results published before this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |
| `last_updated_before_filter` | string | No | Only include results last updated before this date (MM/DD/YYYY). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Contextualized Embeddings

**Slug:** `PERPLEXITYAI_CREATE_CONTEXTUALIZED_EMBEDDINGS`

Create Contextualized Embeddings (POST /v1/contextualizedembeddings). Generates document-aware embeddings where chunks from the same document share context. Unlike standard embeddings, these recognize sequential relationships within documents, improving retrieval quality. Models: pplx-embed-context-v1-0.6b (1024 dims) and pplx-embed-context-v1-4b (2560 dims). Both support Matryoshka dimension reduction and INT8/binary quantization.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `input` | array | Yes | Nested array of texts: outer array = documents, inner array = ordered chunks from that document. Max 512 documents, max 16000 total chunks, max 32K tokens per document, max 120K combined tokens. Empty strings not allowed. |
| `model` | string ("pplx-embed-context-v1-0.6b" | "pplx-embed-context-v1-4b") | Yes | The contextualized embedding model. pplx-embed-context-v1-0.6b (1024 dims, $0.008/1M tokens) or pplx-embed-context-v1-4b (2560 dims, $0.05/1M tokens). |
| `dimensions` | integer | No | Custom output dimensions via Matryoshka. Range: 128-1024 for 0.6b, 128-2560 for 4b. Defaults to full dimensions. |
| `encoding_format` | string ("base64_int8" | "base64_binary") | No | Encoding format for embeddings output. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### CreateEmbeddings

**Slug:** `PERPLEXITYAI_CREATE_EMBEDDINGS`

Generate vector embeddings for independent texts (queries, sentences, documents). This action takes one or more input texts and generates vector embeddings using Perplexity AI's embedding models. Embeddings are useful for semantic search, similarity matching, and machine learning downstream tasks. Supported models: - pplx-embed-v1-0.6b: Smaller, faster model (1024 dimensions) - pplx-embed-v1-4b: Larger, more accurate model (2560 dimensions) The output embeddings are base64-encoded for efficient transmission. Use the dimensions parameter to reduce embedding size for faster processing when full precision is not required (Matryoshka representation).

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `input` | string | Yes | Input text to embed, encoded as a string or array of strings. Maximum 512 texts per request. Each input must not exceed 32K tokens. All inputs in a single request must not exceed 120,000 tokens combined. Empty strings are not allowed. |
| `model` | string ("pplx-embed-v1-0.6b" | "pplx-embed-v1-4b") | Yes | The embedding model to use. pplx-embed-v1-0.6b is smaller and faster, while pplx-embed-v1-4b is larger and more accurate. |
| `dimensions` | integer | No | Number of dimensions for output embeddings (Matryoshka). Range: 128-1024 for pplx-embed-v1-0.6b, 128-2560 for pplx-embed-v1-4b. Defaults to full dimensions (1024 or 2560). |
| `encoding_format` | string ("base64_int8" | "base64_binary") | No | Encoding format for embeddings output. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Execute Agent

**Slug:** `PERPLEXITYAI_EXECUTE_AGENT`

Create Agent Response (POST /v1/agent). Orchestrates multi-step agentic workflows with built-in tools (web search, URL fetching, function calling), reasoning, and multi-model support. Streaming is not supported by this action. At least one of 'model', 'models', or 'preset' must be provided. Available presets: 'fast-search', 'pro-search', 'deep-research'. The 'deep-research' preset generates very long responses (10K-100K+ words) with exhaustive multi-source analysis. Available models include Perplexity Sonar, OpenAI, Anthropic, Google, xAI, and NVIDIA models at direct provider rates. Use the List Models action to see available model identifiers.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `input` | string | Yes | The user's input/query to process. |
| `model` | string | No | Model identifier (e.g. 'openai/gpt-5.2', 'perplexity/sonar'). Provider/model format. At least one of model, models, or preset is required. |
| `tools` | array | No | Tools available to the agent: web_search, fetch_url, function. |
| `models` | array | No | Fallback chain of models (min 1, max 5). API tries each in order if prior fails. At least one of model, models, or preset is required. |
| `preset` | string | No | Preset configuration: 'fast-search', 'pro-search', 'deep-research'. 'deep-research' generates very long responses (10K-100K+ words). At least one of model, models, or preset is required. |
| `max_steps` | integer | No | Maximum number of agent steps (1-10). |
| `reasoning` | object | No | Configuration for reasoning behavior. |
| `instructions` | string | No | System instructions to guide the agent's behavior. |
| `response_format` | object | No | Response format for structured output. |
| `max_output_tokens` | integer | No | Maximum output tokens. |
| `language_preference` | string | No | Preferred response language as ISO 639-1 code. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Async Chat Completion

**Slug:** `PERPLEXITYAI_GET_ASYNC_CHAT_COMPLETION`

Get Async Chat Completion (GET /v1/async/sonar/{id}). Retrieves the result of an asynchronous chat completion request by its ID. Use this to poll for the result after creating an async job. The response includes the status and, when completed, the full completion.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `request_id` | string | Yes | The unique identifier of the async chat completion request to retrieve. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Async Chat Completions

**Slug:** `PERPLEXITYAI_LIST_ASYNC_CHAT_COMPLETIONS`

List Async Chat Completions (GET /v1/async/sonar). Retrieves a list of all asynchronous chat completion requests for the authenticated user. Use this to see the status of all your pending, completed, and failed async jobs.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Models

**Slug:** `PERPLEXITYAI_LIST_MODELS`

List Models (GET /v1/models). Lists models available for the Agent API. Returns model identifiers that can be used with the Agent endpoint. The response follows the OpenAI List Models format for compatibility. This is a public endpoint that does not require authentication.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Perplexity Search (Raw Results)

**Slug:** `PERPLEXITYAI_SEARCH`

Search the Web (POST /search). Returns raw, ranked web search results directly from Perplexity's index without LLM processing. Faster and cheaper than chat completions when you need raw results. Supports filtering by domain, date, language, country, and recency. Max 20 results per request. Important: search_recency_filter and date filters (search_after_date_filter, search_before_date_filter, last_updated_after_filter, last_updated_before_filter) are mutually exclusive. Use one or the other, not both.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | Search query. Can be a single string or list of strings for multi-query search. |
| `country` | string | No | ISO 3166-1 alpha-2 country code (e.g. 'US', 'GB', 'DE'). |
| `max_tokens` | integer | No | Maximum total tokens of webpage content returned (1-1000000). |
| `max_results` | integer | No | Maximum number of search results to return (1-20). |
| `max_tokens_per_page` | integer | No | Maximum tokens retrieved from each webpage (1-1000000). |
| `search_domain_filter` | array | No | Domains to restrict search results to (max 20). |
| `search_recency_filter` | string ("hour" | "day" | "week" | "month" | "year") | No | Filter for search recency. |
| `search_language_filter` | array | No | ISO 639-1 language codes to filter results (max 20, 2 chars each). |
| `search_after_date_filter` | string | No | Only include results published after this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |
| `last_updated_after_filter` | string | No | Only include results last updated after this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |
| `search_before_date_filter` | string | No | Only include results published before this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |
| `last_updated_before_filter` | string | No | Only include results last updated before this date (MM/DD/YYYY). Cannot be used with search_recency_filter. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
