Skip to main content

Responses API

OpenAI's next-generation stateful endpoint, with built-in support for tools, web search, file search, and multi-step tasks — gradually replacing Chat Completions.

Create a Response​

POST /v1/responses
RequestREQUEST
POSThttps://test.kailin.com.cn/v1/responses
ResponseRESPONSE
Fill in the request and hit Send — the response shows up here

Request​

curl https://test.kailin.com.cn/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "gpt-4o-mini",
"input": "Describe the Responses API in one sentence"
}'

Request Body​

ParameterTypeRequiredDescription
modelstringYesModel name
inputstring / arrayYesInput text, or an array of messages/content parts
streambooleanNoStream output (richer event types)
instructionsstringNoSystem-level instructions
previous_response_idstringNoPass the previous Response ID for multi-turn continuity without resending history
toolsarrayNoTools: function, web_search_preview, etc.
temperature / top_pnumberNoSampling parameters
max_output_tokensnumberNoMax output tokens
metadataobjectNoCustom key-value pairs (up to 16)
storebooleanNoWhether to store the result for previous_response_id reference

Example with an array input (including an image):

{
"model": "gpt-4o-mini",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Describe this image" },
{ "type": "input_image", "image_url": "https://example.com/cat.jpg" }
]
}
]
}

Response​

{
"id": "resp_abc123",
"object": "response",
"created_at": 1730000000,
"status": "completed",
"model": "gpt-4o-mini",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "The Responses API is OpenAI's next-generation stateful endpoint…",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 30,
"total_tokens": 42
}
}

To extract text, iterate output items with type: "message" and read content[].text; the SDK also offers the resp.output_text shortcut.

Retrieve a Response​

GET /v1/responses/{response_id}
curl https://test.kailin.com.cn/v1/responses/resp_abc123 \
-H "Authorization: Bearer sk-your-token"

Returns the full Response object. Responses created with store: false cannot be retrieved.

Compact Context​

POST /v1/responses/compact

Compacts a long conversation into a summary — useful for long-running agents to reduce token usage on subsequent requests:

curl https://test.kailin.com.cn/v1/responses/compact \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "gpt-4o-mini",
"input": [ ...long message array... ]
}'
ParameterTypeRequiredDescription
modelstringYesModel used for compaction
inputarrayYesMessage array to compact
instructionsstringNoCustom instructions for the summary

Returns the compacted summary object, which can be placed in the input of the next request.

note

WebSocket access (wss://.../v1/responses with response.create events) depends on gateway WS passthrough support — REST + SSE remains the primary client integration path and is not covered here.