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]. 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_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.
storebooleanOptionalControls 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_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.
metadataobjectOptionalUp to 16 string key-value pairs; keys up to 64 characters.
- Maximum properties
16
metadata child fields (1)
[key]stringOptional- Maximum length
512
gloop_parametersobjectOptionalOptional 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)
include_provider_system_promptbooleanOptionalControls 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_thinkingbooleanOptionalRequest disabling thinking on models that support this control.
strip_thinking_responsebooleanOptionalRequest removal of thinking content from the response; independent of disable_thinking.
character_slugstringOptionalSpecify the public identifier of a published character. Applied only when explicitly supplied; character availability depends on the selected model service.
enable_e2eebooleanOptionalPass 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_searchstringOptionalWeb 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_scrapingbooleanOptionalRequest fetching web links in the latest user message. Applied only when explicitly supplied.
enable_web_citationsbooleanOptionalWhen web search is enabled, request source citations in the response.
include_search_results_in_streambooleanOptionalRequest including search results in the first chunk of the streaming response. Whether this takes effect depends on model support.
return_search_results_as_documentsbooleanOptionalRequest also returning search results as document tool calls. This does not mean that the caller’s tools have been executed.
enable_x_searchbooleanOptionalRequest 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
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_fingerprintstringOptionalmetadata child fields (1)
[key]stringOptional
gloop_billingobjectOptionalGloopAPI extension: stored response GET/list queries include the caller’s finalized USD charge. This is not an OpenAI standard field and generation responses may omit it. Missing billing does not mean zero cost.
gloop_billing child fields (3)
statusstringRequired- Enum
["settled"]
currencystringRequired- Enum
["USD"]
final_amountstringRequiredDecimal string of the caller’s finalized USD charge.
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