responses-api

Create response

Creates a model response for the given input.

This endpoint implements the Open Responses compatible API, providing enhanced capabilities including:

  • Reasoning models with controllable effort via reasoning parameter
  • Stateful conversations via previous_response_id for maintaining context across turns
  • Flexible input - accepts either a string or array of messages
  • Text output configuration via text parameter for structured outputs
  • Context window management via truncation parameter

Set stream: true to receive partial responses as server-sent events.

Open Responses API Reference →

post/responses

Request body

frequency_penaltynumber float nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far.

includestring nullable

Include encrypted reasoning content for rehydration on subsequent requests.

instructionsstring nullable

System instructions for the model.

max_output_tokensinteger nullable

The maximum number of tokens to generate in the response.

{"stackTrail":"components:schemas:ResponseRequest:properties:metadata","oasType":"schema","type":"unknown","description":"Developer-defined tags and values for organizing responses."}
modalitiesstring[] nullable

Output types that you would like the model to generate (e.g., ["text"], ["text", "audio"]).

modelstring required

ID of the model to use.

parallel_tool_callsboolean nullable

Whether to enable parallel function calling during tool use.

presence_penaltynumber float nullable

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far.

previous_response_idstring nullable

The ID of a previous response to continue from (for stateful conversations).

{"stackTrail":"components:schemas:ResponseRequest:properties:reasoning","oasType":"schema","type":"unknown","description":"Reasoning configuration for controlling reasoning behavior."}
reasoning_effortstring nullable

Constrains effort on reasoning. Supported values: "none", "minimal", "low", "medium", "high", "xhigh".

stopstring[] nullable

Up to 4 sequences where the API will stop generating further tokens.

storeboolean nullable

Whether to store this response for future reference.

streamboolean nullable

If set, partial message deltas will be sent as server-sent events.

{"stackTrail":"components:schemas:ResponseRequest:properties:stream_options","oasType":"schema","type":"unknown","description":"Options for streaming response."}
temperaturenumber float nullable

What sampling temperature to use, between 0 and 2.

{"stackTrail":"components:schemas:ResponseRequest:properties:text","oasType":"schema","type":"unknown","description":"Text output configuration."}
{"stackTrail":"components:schemas:ResponseRequest:properties:tool_choice","oasType":"schema","type":"unknown","description":"Controls which (if any) tool is called by the model."}
top_pnumber float nullable

An alternative to sampling with temperature, called nucleus sampling.

truncationstring nullable

How to handle context window overflow ("auto" or "disabled").

userstring nullable

A unique identifier representing your end-user.

Example request

{
  "input": "What is a doubleword?",
  "max_output_tokens": 256,
  "model": "deepseek-ai/DeepSeek-V4-Pro",
  "temperature": 0.7
}

Response

Response generated successfully. When streaming, returns a series of SSE events.

completed_atinteger required

The Unix timestamp of when the response was completed.

created_atinteger required

The Unix timestamp of when the response was created.

idstring required

A unique identifier for the response.

{"stackTrail":"components:schemas:ResponseObject:properties:metadata","oasType":"schema","type":"unknown","description":"Developer-defined tags and values."}
modelstring required

The model used for generating the response.

objectstring required

The object type, always "response".

statusstring required

The status of the response. Can be "completed", "incomplete", "cancelled", or "failed".

temperaturenumber float required

The temperature used for sampling (echoed from request).

top_pnumber float required

The nucleus sampling parameter used (echoed from request).

Example response

{
  "completed_at": 1703187205,
  "created_at": 1703187200,
  "id": "resp-abc123",
  "model": "deepseek-ai/DeepSeek-V4-Pro",
  "object": "response",
  "output": [
    {
      "content": "A doubleword is a data unit that is twice the size of a standard word in computer architecture.",
      "role": "assistant",
      "type": "message"
    }
  ],
  "status": "completed",
  "temperature": 0.7,
  "top_p": 1,
  "usage": {
    "completion_tokens": 25,
    "prompt_tokens": 10,
    "total_tokens": 35
  }
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.