API 参考

创建可恢复文字执行

POST/v1/text-runs

Durable 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
    messages 子字段(1)
    • []object选填
      额外属性
      false
      [] 子字段(2)
      • rolestring必填
        枚举
        ["system","user","assistant"]
      • contentstring必填
        最短长度
        1
  • 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

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

HTTP 400

输入无效。

application/json

类型
object
必填字段
error

HTTP 401

Key 缺失、无效、过期或已撤销。

application/json

类型
object
必填字段
error

HTTP 403

IP、账户、模型或工具权限不足。

application/json

类型
object
必填字段
error

HTTP 404

未找到本人执行;不能据此判断未知生成没有计费。

application/json

类型
object
必填字段
error

HTTP 409

请求 ID 内容冲突,或在途执行不能删除。

application/json

类型
object
必填字段
error

HTTP 429

请求/队列限流。

application/json

类型
object
必填字段
error

HTTP 500

鉴权或数据存储内部失败。

application/json

类型
object
必填字段
error

HTTP 503

暂不可用;已提交结果不确定时查询原请求。

application/json

类型
object
必填字段
error