API 參考
建立可恢復文字執行
/v1/text-runsDurable text execution using an ordinary GloopAPI Key. The messages form runs Chat Completions with optional SSE. The explicit protocol/input/quote_id form consumes a versioned public cost quote and dispatches directly to native Chat Completions or Responses; this form is text-only, excludes unbounded tools, and supports SSE through the outer stream flag for both protocols. Keep the quoted input unchanged; the service sets upstream streaming parameters. Provisional text.delta events are not settlement evidence; run.result contains the authoritative state and billing receipt. A repeated Key/request_id returns the original execution; changed content conflicts. Full wallet maximum is reserved before dispatch. Only authoritative reported usage and finalized settlement expose output and billing.final_amount in USD. Unknown or over-maximum accounting retains its hold and must be recovered by querying the original request; never regenerate to recover. Stored content expires after seven days while accounting and request identity remain.
鑑權與許可權
使用當前 GloopAPI Key。模型、功能與許可權以當前 Key 的目錄及介面說明為準。
Authorization: Bearer $GLOOP_API_KEY鑑權方案: BearerAuth
請求
請求體 · application/json
- 型別
- object
- 額外屬性
- false
- 必填欄位
request_idmodelmax_output_tokens
請求體必填
request_idstring必填- 匹配規則
"^[A-Za-z0-9_-]{1,128}$"
modelstring必填- 最長長度
128
messagesarray選填- 最少項數
1- 最多項數
256
max_output_tokensinteger必填- 最小值
1- 最大值
131072
streamboolean選填true 返回 SSE;僅改變響應形式,不改變 request_id 冪等身份。斷線查詢原請求,不重新生成。
- 預設值
false
protocolstring選填- 列舉
["chat_completions","responses"]
quote_idstring選填POST /v1/cost-quotes 返回的 quote_token;原生输入执行必填。
- 最長長度
8192
inputobject選填Exact quoted native text request. Its stream field must be omitted or false; use the outer stream flag to select SSE. The model/output limit must match the outer envelope.
@anyOf:0unknown選填@anyOf:1unknown選填
響應與錯誤
HTTP 200
非流式終態或流式事件傳輸;流式狀態以 run.result 為準。
application/json
- 型別
- object
- 必填欄位
idrequest_idmodelstateversionexpires_atresult_deleted
idstring必填request_idstring必填modelstring必填statestring必填- 列舉
["pending","unknown","succeeded","failed"]
versioninteger必填- 列舉
[1]
expires_atinteger必填結果正文到期的 Unix 秒時間;正文最多保留七天。
result_deletedboolean必填outputobject選填output 子欄位(4)
textstring必填input_tokensinteger必填output_tokensinteger必填usage_sourcestring必填- 列舉
["reported"]
billingobject選填billing 子欄位(5)
statusstring必填- 列舉
["settled","refunded"]
currencystring必填- 列舉
["USD"]
final_amountstring選填权威最终钱包实收;缺失不代表零费用。
pricing_versionstring選填quote_idstring選填
text/event-stream
- 型別
- string
- 說明
- 命名 SSE:text.delta 為臨時文字,run.result 為 TextRun 結果;缺失 run.result 必須查詢原請求。
{
"type": "string",
"description": "命名 SSE:text.delta 为临时文字,run.result 为 TextRun 结果;缺失 run.result 必须查询原请求。"
}HTTP 202
執行中或狀態待確認。
application/json
- 型別
- object
- 必填欄位
idrequest_idmodelstateversionexpires_atresult_deleted
idstring必填request_idstring必填modelstring必填statestring必填- 列舉
["pending","unknown","succeeded","failed"]
versioninteger必填- 列舉
[1]
expires_atinteger必填結果正文到期的 Unix 秒時間;正文最多保留七天。
result_deletedboolean必填outputobject選填output 子欄位(4)
textstring必填input_tokensinteger必填output_tokensinteger必填usage_sourcestring必填- 列舉
["reported"]
billingobject選填billing 子欄位(5)
statusstring必填- 列舉
["settled","refunded"]
currencystring必填- 列舉
["USD"]
final_amountstring選填权威最终钱包实收;缺失不代表零费用。
pricing_versionstring選填quote_idstring選填
HTTP 400
輸入無效。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 401
Key 缺失、無效、過期或已撤銷。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 403
IP、賬戶、模型或工具許可權不足。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 404
未找到本人執行;不能據此判斷未知生成沒有計費。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 409
請求 ID 內容衝突,或在途執行不能刪除。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 429
請求/佇列限流。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 500
鑑權或資料儲存內部失敗。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 503
暫不可用;已提交結果不確定時查詢原請求。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填