Skip to main content
POST
cURL
Parameters not listed here are outside the documented surface, some OpenAI parameters may be accepted, but their behavior isn’t guaranteed. Per-model parameter support is listed in supported_sampling_parameters on GET /models.
Error bodies and retry guidance are in the Inference API overview.

Authorizations

Authorization
string
header
required

Bearer followed by an inference API key (sk-prl-infapi-). Create keys on the API Keys page. Management keys (sk-prl-mgmt-) cannot call models.

Body

application/json
model
string
required

A catalog model ID, e.g. deepseek-ai/DeepSeek-V4-Pro-0813, the id field from GET /models.

messages
object[]
required

The conversation, oldest first. Roles: system, developer, user, assistant, tool. A user message's content is a string, or an array of text / image_url parts on vision models (images as base64 data URIs only, see Vision).

max_tokens
integer

Cap on generated tokens, on reasoning models the thinking counts against it. Hitting the cap sets finish_reason: "length". Per-model ceilings are the max_output_length on GET /models.

temperature
number

Sampling temperature, 0 to 2. Lower is more deterministic.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling mass, 0 to 1.

Required range: 0 <= x <= 1
top_k
integer

Sample only from the k most likely tokens (0 to 1024). A Pearl extension, pass via extra_body in the OpenAI SDKs.

Required range: 0 <= x <= 1024
min_p
number

Drop tokens below this probability relative to the top token (0 to 1). Extension via extra_body; not all models, check supported_sampling_parameters.

Required range: 0 <= x <= 1
frequency_penalty
number

−2 to 2. Positive values discourage token repetition by frequency.

Required range: -2 <= x <= 2
presence_penalty
number

−2 to 2. Positive values discourage reusing tokens that already appeared.

Required range: -2 <= x <= 2
repetition_penalty
number

Alternative repetition control (0 to 2, 1 is off), used by some model families instead of the frequency/presence pair. Extension via extra_body; not all models, check supported_sampling_parameters.

Required range: 0 <= x <= 2
stop
string[]

Up to 4 non-empty sequences that end generation when produced.

Maximum array length: 4
Minimum string length: 1
seed
integer

Best-effort determinism for repeated sampling, not a reproducibility guarantee.

stream
boolean

Stream the response as server-sent events, see Streaming and the chunk shape below.

response_format
object

{"type": "text"} (default) or {"type": "json_object"} for JSON mode. The stricter json_schema type is not available.

tools
object[]

Function tool definitions ({"type": "function", "function": {…}}) the model may call, see Function calling.

reasoning
object

The one reasoning control on reasoning models: {"enabled": bool, "effort": string}, both optional. Effort is none | minimal | low | medium | high | xhigh | max, resolved per model against supported_efforts in its GET /models reasoning block: a served level applies as is, any other rounds up to the next served level (or to the highest one past the top), and none is the disable control, not a rung. {"effort": "none"} (or enabled: false) disables thinking only on models not marked mandatory in that block (GLM-5.3 and GLM-5.3-Flash are, and reject the disable with 400). A max_tokens member returns 400 on every model today (supports_max_tokens: false); bound thinking with the effort or the top-level max_tokens. Omission keeps the model's default_effort, max on GLM-5.3. Via extra_body in the OpenAI Python SDK. Provider-native switches (thinking, chat_template_kwargs.enable_thinking, and their siblings) return 400 on key presence.

reasoning_effort
enum<string>

OpenAI's flat spelling of reasoning.effort, with the same values and rounding. Sending both returns 400.

Available options:
none,
minimal,
low,
medium,
high,
xhigh,
max
n
integer
default:1

Number of choices to generate, 1 to 8. Defaults to 1.

Required range: 1 <= x <= 8
stream_options
object

{"include_usage": bool}. Streams always end with a usage chunk unless you set include_usage: false.

Response

The completion, or an event stream when streaming.

id
string

Completion ID, log it for request-level forensics.

object
enum<string>

chat.completion, or chat.completion.chunk when streaming.

Available options:
chat.completion,
chat.completion.chunk
created
integer

Unix timestamp (seconds).

model
string

The model that served the request.

choices
object[]
usage
object

prompt_tokens, completion_tokens, total_tokens, what you're billed on. Worker-dependent details: prompt_tokens_details.cached_tokens and completion_tokens_details.reasoning_tokens.