Skip to main content
POST
Create Message
Authenticate with your Perplexity API key. Both Authorization: Bearer and the Anthropic SDK’s default x-api-key header are accepted, so the stock SDK api_key parameter works unchanged. No anthropic-version header is required.
Honored: model, routing (only with model: "perplexity/auto"), max_tokens (required), messages, system, stream, temperature, top_p, top_k, stop_sequences, thinking, output_config.effort, tools, tool_choice, cache_control on content blocks and tools (ttl of 5m or 1h), and service_tier (auto or standard_only). Message content and tool_result.content accept text, image, document, and search_result blocks. Document sources can be base64 PDF, plain text, URLs, or text content blocks; all but base64 PDF require an anthropic/ model, as do title, context, and enabled citations. context_management requires the anthropic-beta: context-management-2025-06-27 header and is applied on anthropic/ models only.Accepted but not forwarded to the model: metadata.Rejected with a 400: service_tier values other than auto or standard_only, container, inference_geo, mcp_servers, fallbacks, a thinking type the model does not support, plus any unrecognized top-level field.Notes: thinking accepts {"type": "disabled"}, {"type": "enabled", "budget_tokens": N}, and {"type": "adaptive"}. Support for enabled and adaptive varies by model. For example, anthropic/claude-sonnet-5-5 requires adaptive with output_config.effort, and anthropic/claude-haiku-4-5 accepts enabled but not adaptive. Cache writes with a 1h TTL are billed at 2x the base input rate. A tool’s description is optional.
Set stream: true to receive typed server-sent events: message_start, then content_block_start, content_block_delta, and content_block_stop for each content block, interleaved with ping events, then message_delta with the stop reason and final usage, then message_stop. The stream ends after message_stop, with no [DONE] trailer.Errors detected before streaming begins, such as an unavailable model, return a normal JSON error response with the matching HTTP status.
Errors use the Anthropic envelope:
An overloaded model returns HTTP 429 with type overloaded_error and a Retry-After header. An unavailable model returns 404 with type not_found_error, and a missing or invalid API key returns 401. Requests that fail before producing output are not billed.

Authorizations

Authorization
string
header
required

Your Perplexity API key.

Body

application/json

Request body for POST /orchestrator/v1/messages.

model
string
required

A model id from the Orchestrator catalog, or perplexity/auto to select a model for each request. With Auto, omit routing to use the default policy or provide an inline routing object.

max_tokens
integer
required

Maximum number of tokens to generate. Required by the Messages API.

Required range: 1 <= x <= 2147483647
messages
object[]
required
system

System prompt as plain text or an array of text blocks.

temperature
number<float>
Required range: 0 <= x <= 1
top_p
number<float>
Required range: 0 <= x <= 1
top_k
integer

Restricts sampling to the K most likely tokens at each step. Must be at least 1.

stop_sequences
string[]
stream
boolean

When true, respond with server-sent events.

tools
object[]
tool_choice
object
metadata
object
thinking
object

Budget-based thinking. anthropic/ models receive budget_tokens as is; other models get a reasoning-effort level derived from it. Some models reject this type and require adaptive.

service_tier
enum<string>

Accepts auto or standard_only; other values return a 400. Neither value changes processing. anthropic/ responses report usage.service_tier as standard.

Available options:
auto,
standard_only
cache_control
object

Ephemeral cache breakpoint. Set ttl to 5m or 1h. Cache writes with a 1h TTL are billed at 2x the base input rate.

output_config
object
context_management
object

Requires the anthropic-beta: context-management-2025-06-27 request header; without it, the request returns a 400. On anthropic/ models, edits are applied and reported in the response's context_management.applied_edits. Other models accept the field without applying it.

container
any

Not supported. Requests that set it return a 400.

inference_geo
string

Not supported. Requests that set it return a 400.

mcp_servers
any

Not supported. Requests that set it return a 400.

speed
enum<string>

"standard" is inert; "fast" is rejected (no fast-mode routing).

Available options:
standard,
fast
fallbacks
any

Not supported. Requests that set it return a 400.

fallback_credit_token
string

Rejected by validation together with fallbacks.

routing
object

Inline routing for model: "perplexity/auto" only. Omit this field or set it to null to use the default policy. The serialized routing object must be at most 16384 bytes. Models must be available in the Orchestrator catalog. Routes incompatible with the request are excluded; if the default model is incompatible, the first compatible route model becomes the default. The request fails if no model is compatible.

Response

Successful response. JSON for non-streaming requests; a text/event-stream of typed events (message_start through message_stop) when stream is true.

Non-streaming response body and the message_start payload.

id
string
required
type
enum<string>
required
Available options:
message
role
enum<string>
required
Available options:
assistant
model
string
required

The model that served the request. With perplexity/auto, this is the selected model, not perplexity/auto. Billing uses the served model's rates.

content
object[]
required
stop_reason
enum<string> | null
required
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal,
model_context_window_exceeded
stop_sequence
string | null
required
usage
object
required