Skip to main content
OpenAI Responses

List input items

List the input items used to generate the specified response

GET
https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1/responses/{response_id}/input_items
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
    # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
    base_url="https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1",
)

response = client.responses.input_items.list("resp_xxx")
print(response.data)
{
  "created_at": 1778674066000,
  "data": [
    {
      "content": [
        {
          "text": "Hello",
          "type": "input_text"
        }
      ],
      "id": "msg_8dac4972-fdba-42b5-bed9-280441ced8ea",
      "role": "user",
      "status": "completed",
      "type": "message"
    }
  ],
  "first_id": "msg_8dac4972-fdba-42b5-bed9-280441ced8ea",
  "has_more": false,
  "id": "resp_4ca7fa5e-6ff5-9787-bc18-af6ca5eff36c",
  "last_id": "msg_8dac4972-fdba-42b5-bed9-280441ced8ea",
  "model": "qwen-plus"
}

Authorizations

string
header
required

DashScope API key.

Path Parameters

string
required

The ID of the response whose input items you want to list, in the format resp_xxx. Only response IDs returned by requests created with store=true support this query.

Query Parameters

string

Returns the items that come after the specified item ID (in the format msg_xxx), in the order set by order. Item IDs come from output[].id in the create-response result, or from data[].id, first_id, and last_id returned by this API. Typical use is pagination: pass the last_id from the previous call as after to fetch the next page.

integer
default20

The maximum number of items to return. Value range: [1, 100]. Default: 20.

1 <= x <= 100
enum<string>
default"desc"

The sort order. Valid values: asc (ascending) and desc (descending). Default: desc.

asc,desc

Response

200-application/json
object[]

The list of input items. Each element is a message object. In a multi-turn conversation chained with previous_response_id, earlier user messages and model replies are included in chronological order.

string

The ID of the first item in the list.

string

The ID of the last item in the list.

boolean

Whether more items are available. When true, pass the last_id from this call as the after parameter of the next request to fetch the next page.

string

The corresponding response ID.

string

The name of the model used to generate the response.

integer

The Unix timestamp, in milliseconds, when the response was created. Note: this unit differs from the created_at returned by the create-response and retrieve-response APIs, which is in seconds.

string | null

Returned for multi-turn conversations. The response ID of the previous turn.