跳转到正文

列出输入条目 ​

列出已存储响应的输入条目,默认按从新到旧排序。未知 id 返回 404。

GET/v1/responses/{id}/input_items

查询参数:limit(1–100,默认 20)、order(asc/desc,默认 desc)、after (游标)、include。需要 API 密钥鉴权;没有 Redis 时返回 503 redis_not_available。

请求
bash
curl "http://localhost:8080/v1/responses/resp_9f2c…/input_items?limit=2&order=asc" \
  -H "Authorization: Bearer $LLM_PROXY_KEY"
请求 — OpenAI SDK
python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1", api_key="sk-your-proxy-key")
items = client.responses.input_items.list("resp_9f2c…", limit=2, order="asc")
for item in items.data:
    print(item.type)
响应
json
{
  "object": "list",
  "data": [
    {
      "id": "msg_9f2c…",
      "type": "message",
      "role": "user",
      "content": [{"type": "input_text", "text": "Hello!"}]
    },
    {
      "id": "msg_8b1d…",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {"type": "output_text", "text": "Hello! How can I help?", "annotations": []}
      ]
    }
  ],
  "first_id": "msg_9f2c…",
  "last_id": "msg_8b1d…",
  "has_more": false
}

include 取值 ​

include 接受:

  • file_search_call.results
  • web_search_call.results
  • web_search_call.action.sources
  • message.input_image.image_url
  • computer_call_output.output.image_url
  • code_interpreter_call.outputs
  • reasoning.encrypted_content
  • message.output_text.logprobs

存储的条目按存储时的内容返回。除非通过 include 显式请求,否则 reasoning.encrypted_content 会从已存储的推理条目中剔除。未知的 include 取值返回 400 invalid_include;after 指定的 ID 不是该响应的输入条目时返回 400invalid_cursor。

分页 ​

在 has_more 为 true 时,把上一页最后一条的 ID 作为 after 传入即可获取下一页。

相关内容 ​

请求
bash
curl "http://localhost:8080/v1/responses/resp_9f2c…/input_items?limit=2&order=asc" \
  -H "Authorization: Bearer $LLM_PROXY_KEY"
请求 — OpenAI SDK
python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1", api_key="sk-your-proxy-key")
items = client.responses.input_items.list("resp_9f2c…", limit=2, order="asc")
for item in items.data:
    print(item.type)
响应
json
{
  "object": "list",
  "data": [
    {
      "id": "msg_9f2c…",
      "type": "message",
      "role": "user",
      "content": [{"type": "input_text", "text": "Hello!"}]
    },
    {
      "id": "msg_8b1d…",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {"type": "output_text", "text": "Hello! How can I help?", "annotations": []}
      ]
    }
  ],
  "first_id": "msg_9f2c…",
  "last_id": "msg_8b1d…",
  "has_more": false
}

MIT 许可