Create Chat Completion
Send a conversation to any Orchestrator API model using the OpenAI Chat Completions schema. Set stream: true to receive server-sent events; add stream_options: {"include_usage": true} to get token usage in the final chunk.
400 naming the parameter.Parameter support
Parameter support
model, routing (only with model: "perplexity/auto"), messages, stream, stream_options.include_usage, max_completion_tokens, max_tokens, temperature, top_p, stop, reasoning_effort, service_tier (auto, default, flex, priority), response_format (text, json_schema, json_object), tools, tool_choice (including allowed_tools), parallel_tool_calls, prompt_cache_key, prompt_cache_options, and message-part prompt_cache_breakpoint fields.Accepted but not forwarded to the model: user, safety_identifier, metadata.Accepted only at their default values: n (1), logprobs (false), store (false), presence_penalty (0), frequency_penalty (0).Rejected with a 400: seed, logit_bias, top_logprobs, functions (use tools), function_call (use tool_choice), modalities, audio, prediction, web_search_options, moderation, verbosity, prompt_cache_retention (use prompt_cache_options.ttl), stream_options.include_obfuscation set to true, plus any unrecognized top-level field.Notes: When reasoning_effort is omitted, the model’s default applies; supported values and defaults vary by model. response_format.json_schema always runs in strict mode. Assistant messages and streamed deltas can include reasoning_content; replay it in an assistant message to preserve reasoning context across requests. A tool’s description is optional. temperature accepts 0 to 1 on Anthropic models and 0 to 2 on other models. prompt_cache_options.ttl accepts 30m or 1h; 1h works on Anthropic models only.Streaming
Streaming
stream: true to receive chat.completion.chunk objects as server-sent events. A successful stream ends with data: [DONE]. With stream_options: {"include_usage": true}, the last chunk before [DONE] has an empty choices array and reports usage for the whole request.Errors detected before streaming begins, such as an unavailable model, return a normal JSON error response with the matching HTTP status.Errors
Errors
type is invalid_request_error for validation errors (400) and for an unavailable model (404), invalid_api_key for a missing or invalid API key (401), rate_limit_error for 429 (rate limited or model overloaded; retry after the Retry-After interval), and server_error for 5xx. Requests that fail before producing output are not billed.Body
The conversation so far, as an array of message objects with role and content. The leading system or developer message is applied as the system prompt.
1- Developer message
- System message
- User message
- Assistant message
- Tool message
- Function message
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.
- Option 1
- Option 2
Response
Successful response. JSON for non-streaming requests; a text/event-stream of chat completion chunks terminated by data: [DONE] when stream is true.