API reference

Create a recoverable text execution

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.

Authentication and permissions

Use your current GloopAPI key. Available models, capabilities and permissions depend on its catalog and the endpoint documentation.

Authorization: Bearer $GLOOP_API_KEY

Authentication schemes: BearerAuth

Request

Request body · application/json

Type
object
Additional properties
false
Required fields
request_idmodelmax_output_tokens

Request body required

  • request_idstringRequired
    Pattern
    "^[A-Za-z0-9_-]{1,128}$"
  • modelstringRequired
    Maximum length
    128
  • messagesarrayOptional
    Minimum items
    1
    Maximum items
    256
    messages child fields (1)
    • []objectOptional
      Additional properties
      false
      [] child fields (2)
      • rolestringRequired
        Enum
        ["system","user","assistant"]
      • contentstringRequired
        Minimum length
        1
  • max_output_tokensintegerRequired
    Minimum
    1
    Maximum
    131072
  • streambooleanOptional

    true returns SSE. This changes only the response format, not the request_id idempotency identity. After disconnection, query the original request without generating again.

    Default value
    false
  • protocolstringOptional
    Enum
    ["chat_completions","responses"]
  • quote_idstringOptional

    quote_token returned by POST /v1/cost-quotes. Required for native input execution.

    Maximum length
    8192
  • inputobjectOptional

    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:0unknownOptional
  • @anyOf:1unknownOptional

Responses and errors

HTTP 200

Non-streaming terminal response or streaming event transport; run.result determines the streaming state.

application/json

Type
object
Required fields
idrequest_idmodelstateversionexpires_atresult_deleted

text/event-stream

Type
string
Description
Named SSE events: text.delta carries provisional text and run.result carries the TextRun result. If run.result is missing, query the original request.
{
  "type": "string",
  "description": "命名 SSE:text.delta 为临时文字,run.result 为 TextRun 结果;缺失 run.result 必须查询原请求。"
}

HTTP 202

Execution is pending or requires confirmation.

application/json

Type
object
Required fields
idrequest_idmodelstateversionexpires_atresult_deleted

HTTP 400

Invalid input.

application/json

Type
object
Required fields
error

HTTP 401

The key is missing, invalid, expired, or revoked.

application/json

Type
object
Required fields
error

HTTP 403

Insufficient IP, account, model, or tool permissions.

application/json

Type
object
Required fields
error

HTTP 404

Your execution was not found; this does not prove an uncertain generation was not billed.

application/json

Type
object
Required fields
error

HTTP 409

Request ID content conflicts, or an in-flight execution cannot be deleted.

application/json

Type
object
Required fields
error

HTTP 429

Request/queue rate limit.

application/json

Type
object
Required fields
error

HTTP 500

Internal authentication or data storage failure.

application/json

Type
object
Required fields
error

HTTP 503

Temporarily unavailable; query the original request if its submitted result is uncertain.

application/json

Type
object
Required fields
error