API 參考

建立響應 (OpenAI Responses API)

POST/v1/responses

Responses 文字與工具呼叫介面;可選欄位和工具型別取決於模型支援。stream=true 返回帶 type 的 SSE 事件;previous_response_id 不保證持久儲存或可恢復。

鑑權與許可權

使用當前 GloopAPI Key。模型、功能與許可權以當前 Key 的目錄及介面說明為準。

Authorization: Bearer $GLOOP_API_KEY

鑑權方案: BearerAuth

請求

請求體 · application/json

型別
object
必填欄位
modelinput

請求體必填

  • modelstring必填
  • inputunion必填

    輸入內容,可以是字串或訊息陣列

    oneOf 分支 1

    型別: string

    oneOf 分支 2

    型別: array

    • []object選填
  • instructionsstring選填
  • max_output_tokensinteger選填
  • temperaturenumber選填

    取樣溫度 具體支援與限制取所選模型,不保證統一預設值。

  • top_pnumber選填

    核取樣引數 具體支援與限制取所選模型,不保證統一預設值。

  • streamboolean選填
  • toolsarray選填
    tools 子欄位(1)
    • []object選填
  • tool_choiceunion選填
    oneOf 分支 1

    型別: string

    oneOf 分支 2

    型別: object

  • reasoningobject選填
    reasoning 子欄位(2)
    • effortstring選填
      列舉
      ["low","medium","high"]
    • summarystring選填
  • truncationstring選填
    列舉
    ["auto","disabled"]
  • parallel_tool_callsboolean選填

    是否允許並行工具呼叫,取決於所選模型。Chat 接受布林值,Responses 接受相容協議的 JSON 值。

  • storeboolean選填

    是否允許儲存請求與響應,取決於所選模型和服務支援範圍;不代表提供通用對話儲存介面。

  • prompt_cache_keystring選填

    提示快取關聯標識;模型相關,不保證命中或支援。Chat 接受字串,Responses 接受相容協議 JSON 值。

  • 提示快取保留控制 JSON 值;模型相關,平臺不賦予統一列舉、預設值或快取保留保證。

  • service_tierstring選填

    請求服務層級,可能影響費用;預設忽略,僅在支援此引數時生效。支援值取決於所選模型。

  • textobject選填

    文字輸出配置,例如 format 指定結構化輸出;具體支援與限制取決於所選模型。

    text 子欄位(1)
    • formatobject選填

      文字與結構化輸出格式配置,取決於所選模型。

      format 子欄位(4)
      • typestring選填

        所選模型支援的輸出格式標識。

      • namestring選填

        結構化輸出名稱。

      • schemaobject選填

        用於結構化輸出的 JSON Schema,須符合所選模型要求。

        額外屬性
        true
      • strictboolean選填

        是否要求嚴格結構化輸出,取決於所選模型。

  • context_managementunknown選填

    上下文管理配置;取決於所選模型,不代表自動摘要或持久記憶。

  • stream_optionsobject選填

    Responses 流引數;與 stream=true 配合,僅支援的欄位生效。

    stream_options 子欄位(2)
    • include_usageboolean選填

      請求流式用量,是否返回取決於所選模型。

    • include_obfuscationboolean選填

      Responses 流混淆控制;預設忽略,僅在支援此引數時生效。

響應與錯誤

HTTP 200

成功建立響應

application/json

型別
object
額外屬性
false

text/event-stream

型別
string
說明
SSE 事件流,協議事件/用量/結束符取當前介面,錯誤可能在流內。
{
  "type": "string",
  "description": "SSE 事件流,协议事件/用量/结束符取当前接口,错误可能在流内。"
}

HTTP 401

Key 缺失、無效、過期或已撤銷。

application/json

型別
object
必填欄位
error

HTTP 403

IP、賬戶、模型或工具許可權不足。

application/json

型別
object
必填欄位
error

HTTP 429

請求/佇列限流。

application/json

型別
object
必填欄位
error

HTTP 500

鑑權或資料儲存內部失敗。

application/json

型別
object
必填欄位
error