API reference
Create a chat completion
/v1/chat/completionsOpenAI 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_KEYAuthentication schemes: BearerAuth
Request
Request body · application/json
- Type
- object
- Required fields
modelmessages
Request body required
modelstringRequiredModel ID
messagesarrayRequiredList of conversation messages
messages child fields (1)
[]objectOptional[] child fields (6)
rolestringRequiredMessage role
- Enum
["system","user","assistant","tool","developer"]
contentunionRequiredMessage 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"]
textstringOptionalimage_urlunionOptionalSupports 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
input_audioobjectOptionalfileobjectOptionalvideo_urlstringOptionalThe 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.
namestringOptionalSender name
tool_callsarrayOptionaltool_call_idstringOptionalTool call ID (for tool-role messages)
reasoning_contentstringOptionalReasoning content
temperaturenumberOptionalSampling temperature. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
top_pnumberOptionalNucleus sampling parameter. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
nintegerOptionalNumber to generate. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
streambooleanOptionalWhether to stream the response
- Default value
false
stream_optionsobjectOptionalChat streaming usage options; support and whether usage is returned depend on the selected model.
stream_options child fields (1)
include_usagebooleanOptional
stopunionOptionalStop sequences
oneOf branch 1
Type: string
max_tokensintegerOptionalMaximum generated token count. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
max_completion_tokensintegerOptionalMaximum completion token count. Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
presence_penaltynumberOptionalSpecific support and limits depend on the selected model; no uniform defaults are guaranteed.
frequency_penaltynumberOptionalSpecific support and limits depend on the selected model; no uniform defaults are guaranteed.
logit_biasobjectOptionallogit_bias child fields (1)
[key]numberOptional
userstringOptionaltoolsarrayOptionaltools child fields (1)
[]objectOptional[] child fields (2)
typestringOptionalfunctionobjectOptionalfunction child fields (3)
namestringOptionaldescriptionstringOptionalparametersobjectOptionalParameter definition in JSON Schema format
tool_choiceunionOptionaloneOf branch 1
Type: string
Enum:
["none","auto","required"]response_formatobjectOptionalresponse_format child fields (2)
typestringOptional- Enum
["text","json_object","json_schema"]
json_schemaobjectOptionalJSON Schema definition
seedintegerOptionalSpecific support and limits depend on the selected model; no uniform defaults are guaranteed.
reasoning_effortstringOptionalReasoning effort (for models that support reasoning). Specific support and limits depend on the selected model; no uniform defaults are guaranteed.
modalitiesarrayOptionalmodalities child fields (1)
[]stringOptional- Enum
["text","audio"]
audioobjectOptionalparallel_tool_callsbooleanOptionalWhether parallel tool calls are allowed depends on the selected model. Chat accepts a boolean; Responses accepts compatible protocol JSON values.
storebooleanOptionalWhether 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_keystringOptionalprompt 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_retentionunknownOptionalprompt cache retention control as a JSON value; model dependent. The platform provides no uniform enum, default, or cache retention guarantee.
service_tierunknownOptionalRequested 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
idstringOptionalobjectstringOptionalcreatedintegerOptionalmodelstringOptionalchoicesarrayOptionalchoices child fields (1)
[]objectOptional- Additional properties
false
[] child fields (3)
indexintegerOptionalmessageobjectOptional- Additional properties
false
message child fields (5)
rolestringRequired- Enum
["assistant"]
Text response content.
tool_callsarrayOptional
finish_reasonstringOptional- Enum
["stop","length","tool_calls","content_filter"]
usageobjectOptionalusage child fields (5)
prompt_tokensintegerOptionalPrompt token count
completion_tokensintegerOptionalCompletion token count
total_tokensintegerOptionalTotal token count
prompt_tokens_detailsobjectOptionalprompt_tokens_details child fields (4)
cached_tokensintegerOptionaltext_tokensintegerOptionalaudio_tokensintegerOptionalimage_tokensintegerOptional
completion_tokens_detailsobjectOptionalcompletion_tokens_details child fields (3)
text_tokensintegerOptionalaudio_tokensintegerOptionalreasoning_tokensintegerOptional
system_fingerprintstringOptional
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
HTTP 401
The key is missing, invalid, expired, or revoked.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 403
Insufficient IP, account, model, or tool permissions.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 429
Request rate limit
application/json
- Type
- object
errorobjectOptional
HTTP 500
Internal authentication or data storage failure.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional