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选填