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]. Only complete, settled results explicitly saved with store=true are accessible to the same API Key for seven days. An empty query does not prove non-execution: never automatically refund or resend. store and metadata do not guarantee idempotency. Storage requires complete reported usage; streaming requests must set stream_options.include_usage=true.

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

    Controls storage. With true, GloopAPI stores the complete settled response and metadata for seven days, but not the original request messages.

    Default value
    false
  • 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.

  • metadataobjectOptional

    Up to 16 string key-value pairs; keys up to 64 characters.

    Maximum properties
    16
    metadata child fields (1)
    • [key]stringOptional
      Maximum length
      512
  • gloop_parametersobjectOptional

    Optional GloopAPI extensions for compatible chat models. Omitting the system prompt switch uses the configured platform prompts; other fields apply only when explicitly supplied. Unsupported channels return an error. null and unknown fields are invalid.

    Additional properties
    false
    gloop_parameters child fields (11)
    • Controls GloopAPI-added system instructions (shared identity and per-model prompts). false skips them; true or omission includes them. Caller instructions are always preserved. Does not control upstream default system prompts.

    • disable_thinkingbooleanOptional

      Request disabling thinking on models that support this control.

    • Request removal of thinking content from the response; independent of disable_thinking.

    • character_slugstringOptional

      Specify the public identifier of a published character. Applied only when explicitly supplied; character availability depends on the selected model service.

    • enable_e2eebooleanOptional

      Pass the end-to-end encryption option. This field alone does not establish an encrypted session; a compatible model and encryption request headers are still required. This API does not currently offer full encrypted transport.

    • enable_web_searchstringOptional

      Web search mode: auto lets the model decide, off disables it, and on requests enabling it. No platform default is set when omitted.

      Enum
      ["auto","off","on"]
    • enable_web_scrapingbooleanOptional

      Request fetching web links in the latest user message. Applied only when explicitly supplied.

    • enable_web_citationsbooleanOptional

      When web search is enabled, request source citations in the response.

    • Request including search results in the first chunk of the streaming response. Whether this takes effect depends on model support.

    • Request also returning search results as document tool calls. This does not mean that the caller’s tools have been executed.

    • enable_x_searchbooleanOptional

      Request native web and X search from a supported model. Additional search fees may apply; availability and pricing depend on the model configuration.

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