API reference

Create a chat completion

POST/v1/chat/completions

OpenAI Chat Completions compatible text/tool endpoint. image_url is only available for models that support image input. Output is text/tools; capabilities, optional fields, and prices depend on the selected model. stream=true returns SSE, may include final usage, and ends with data: [DONE].

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
Required fields
modelmessages

Request body required

  • modelstringRequired

    Model ID

  • messagesarrayRequired

    List of conversation messages

    messages child fields (1)
    • []objectOptional
      [] child fields (6)
      • rolestringRequired

        Message role

        Enum
        ["system","user","assistant","tool","developer"]
      • contentunionRequired

        Message content

        oneOf branch 1

        Type: string

        oneOf branch 2

        Type: array

        • []objectOptional
          [] child fields (6)
          • typestringOptional
            Enum
            ["text","image_url","input_audio","file","video_url"]
          • textstringOptional
          • image_urlunionOptional

            Supports string URL/Base64 or object {url, detail} wire inputs. Available only to models supporting image input; this is not a guarantee that all models support vision.

            oneOf branch 1

            Image URL or Base64 data URL.

            Type: string

            oneOf branch 2

            Object input must provide at least url. Message.ParseContent normalizes omitted detail to high; support depends on the selected vision model.

            Type: object

            Required in this branch: url

            • urlstringRequired

              Image URL or base64

            • detailstringOptional
              Enum
              ["low","high","auto"]
          • input_audioobjectOptional
            input_audio child fields (2)
            • datastringOptional

              Base64-encoded audio data

            • formatstringOptional
              Enum
              ["wav","mp3"]
          • fileobjectOptional
            file child fields (3)
          • video_urlstringOptional

            The actual wire input read by Message.ParseContent is a video URL string, available only to models supporting video input. A {url: ...} object does not enter this parser's content/metering results and is not published as a usable contract.

      • namestringOptional

        Sender name

      • tool_callsarrayOptional
        tool_calls child fields (1)
        • []objectOptional
          [] child fields (3)
      • tool_call_idstringOptional

        Tool call ID (for tool-role messages)

      • reasoning_contentstringOptional

        Reasoning content

  • temperaturenumberOptional

    Sampling temperature. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • top_pnumberOptional

    Nucleus sampling parameter. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • nintegerOptional

    Number to generate. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • streambooleanOptional

    Whether to stream the response

    Default value
    false
  • stream_optionsobjectOptional

    Chat streaming usage options; support and whether usage is returned depend on the selected model.

    stream_options child fields (1)
  • stopunionOptional

    Stop sequences

    oneOf branch 1

    Type: string

    oneOf branch 2

    Type: array

    • []stringOptional
  • max_tokensintegerOptional

    Maximum generated token count. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • max_completion_tokensintegerOptional

    Maximum completion token count. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • presence_penaltynumberOptional

    Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • frequency_penaltynumberOptional

    Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • logit_biasobjectOptional
    logit_bias child fields (1)
  • userstringOptional
  • toolsarrayOptional
    tools child fields (1)
    • []objectOptional
      [] child fields (2)
  • tool_choiceunionOptional
    oneOf branch 1

    Type: string

    Enum: ["none","auto","required"]

    oneOf branch 2

    Type: object

    • typestringOptional
    • functionobjectOptional
      function child fields (1)
  • response_formatobjectOptional
    response_format child fields (2)
    • typestringOptional
      Enum
      ["text","json_object","json_schema"]
    • json_schemaobjectOptional

      JSON Schema definition

  • seedintegerOptional

    Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • reasoning_effortstringOptional

    Reasoning effort (for models that support reasoning). Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • modalitiesarrayOptional
    modalities child fields (1)
    • []stringOptional
      Enum
      ["text","audio"]
  • audioobjectOptional
    audio child fields (2)
  • parallel_tool_callsbooleanOptional

    Whether parallel tool calls are allowed depends on the selected model. Chat accepts a boolean; Responses accepts compatible protocol JSON values.

  • storebooleanOptional

    Whether requests and responses may be stored depends on the selected model and supported service capabilities. This does not provide a general conversation storage API.

  • prompt_cache_keystringOptional

    prompt cache correlation identifier; model dependent, with no guarantee of a cache hit or support. Chat accepts a string; Responses accepts compatible protocol JSON values.

  • prompt_cache_retentionunknownOptional

    prompt cache retention control as a JSON value; model dependent. The platform provides no uniform enum, default, or cache retention guarantee.

  • service_tierunknownOptional

    Requested service tier, which may affect charges. Ignored by default and effective only when supported. Accepted values depend on the selected model.

Responses and errors

HTTP 200

Response created successfully

application/json

Type
object
Additional properties
false

text/event-stream

Type
string
Description
SSE event stream. Protocol events, usage, and terminators depend on the current endpoint; errors may occur inside the stream.
{
  "type": "string",
  "description": "SSE 事件流,协议事件/用量/结束符取当前接口,错误可能在流内。"
}

HTTP 400

Invalid request parameters

application/json

Type
object
  • errorobjectOptional
    error child fields (4)
    • messagestringOptional

      Error message

    • typestringOptional

      Error type

    • paramstringOptionalAllows null

      Related parameters

    • codestringOptionalAllows null

      Error code

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 429

Request rate limit

application/json

Type
object
  • errorobjectOptional
    error child fields (4)
    • messagestringOptional

      Error message

    • typestringOptional

      Error type

    • paramstringOptionalAllows null

      Related parameters

    • codestringOptionalAllows null

      Error code

HTTP 500

Internal authentication or data storage failure.

application/json

Type
object
Required fields
error