Responses access

Use input and output items to correctly differentiate text, tools, and background tasks.

Create response

POST /v1/responses uses the Responses structure:

{
  "model": "MODEL_ID",
  "input": "用三句话解释 HTTP 缓存。"
}

Do not send the entire request body of Chat Completions directly to this address. Read the message and content chunks in output; the SDK’s output_text may be a convenience property and the original JSON does not necessarily contain a top-level field of the same name.

Events and Tools

Streaming request setup stream: true, handles literal increments, tool parameters, and completion events by actual event type. Tool calls and text belong to different output items, and you cannot read only the first array element.

Status and background mode

The gateway has a Responses query entry, but state saving, previous_response_id, background tasks and cancellation capabilities depend on specific channels, models and plug-in support. It cannot be assumed that all text requests can be queried afterwards. Media plugins may provide task results via Responses; enable background only if support has been confirmed.

Programming Assistant Verification

Test plain text first, then verify tool calls, multi-turn contexts, and long tasks. Extensions such as search and remote compression must be tested separately; a single success of Responses does not mean that all official platform functions are available.

Complete HTTP example

curl --fail-with-body https://dunduntoken.com/v1/responses   -H "Authorization: Bearer $DUNDUN_API_KEY"   -H "Content-Type: application/json"   -d '{"model":"MODEL_ID","input":"只回复 OK"}'

Read output items

Original response structure diagram:

{
  "id": "EXAMPLE_RESPONSE_ID",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "OK"
        }
      ]
    }
  ]
}

Traverse output and filter output_text in message. Tool items require additional processing. Check status and error or incomplete information; business tasks cannot be marked as successful just because they get the id.

Streaming request

Add stream: true to the request body, and curl uses -N. The text increment and final state are parsed according to SSE events, and unknown events are retained for compatible processing. A common text delta is response.output_text.delta, which cannot be read with Chat’s delta.content. After receiving the connection end, you should also check whether there is a protocol final state.

Multiple rounds are client compatible

When previous_response_id is required, first verify that the channel used is actually saved and can access the previous response. Otherwise, the application carries the necessary history according to the protocol and does not rely on unconfirmed state preservation. Codex’s compression, search, and WebSocket are independent capabilities that should be verified on a case-by-case basis and not successfully derived from the underlying text.

Codex Configuration · Streaming · Tool Call