Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID to use for the request
Value: hy4
messages array required
Conversation history, with up to 960K input tokens; input and output must fit within the 1024K token context window
role
stringrequiredMessage role
Options:
system,user,assistant,tool
content
string | array | nullText string or an array of text and image content parts; assistant messages containing tool calls may use
nulltype
stringrequiredContent part type
Options:
text,image_urltext
stringText content, required when
typeistextimage_url
objectImage input, required when
typeisimage_urlSupports PNG, JPEG, WEBP, and non-animated GIF images, with up to10 MBper decoded image and600images per request, including history Recommended image dimensions are approximately128×128to2048×2048; larger images are downscaled, and images exceeding5500×5500are rejectedurl
stringrequiredPublicly accessible image URL or a base64 data URL such as
data:image/png;base64,...detail
stringImage processing detail level
Default:
autoOptions:
auto,low,high
reasoning_content
stringReasoning text from a previous assistant message; preserve the returned value when continuing a reasoning conversation, especially across tool calls
tool_calls
arrayTool calls from a previous assistant message; preserve the returned tool call objects in conversation history
id
stringrequiredTool call identifier
type
stringrequiredValue:
functionfunction
objectrequiredCalled function
name
stringrequiredFunction name
arguments
stringrequiredFunction arguments encoded as a JSON string
tool_call_id
stringRequired for
toolmessages; matches the identifier of the tool call whose result is provided incontent
max_tokens integer
Maximum output token budget, including reasoning tokens; reserve sufficient tokens for both reasoning and the final answer
Range: 1-64K
temperature number
Sampling temperature; higher values increase randomness. Usually adjust either temperature or top_p
Range: 0.0-2.0
top_p number
Nucleus sampling probability threshold
Range: (0.0, 1.0]
thinking object
Controls deep thinking; reasoning is returned in reasoning_content separately from the final answer in content
type
stringrequiredThinking switch
Default:
enabledOptions:
enabled,disabled
reasoning_effort string
Reasoning effort; no_think disables reasoning
Default: high
Options: high, no_think
stream boolean
Return incremental Server-Sent Events (SSE); chunks use chat.completion.chunk and expose generated content through choices[].delta, ending with data: [DONE]
Default: false
Options: true, false
stream_options object
Streaming options, used with stream: true
include_usage
booleanRequest a final usage chunk before
[DONE]; that chunk may contain an emptychoicesarray
tools array
Function tools available to the model; your application executes returned tool calls and supplies results as tool messages before the next request
type
stringrequiredValue:
function
function
objectrequiredFunction definition
name
stringrequiredFunction name
description
stringDescription of the function and when to use it
parameters
objectFunction input schema in JSON Schema format
tool_choice string | object
Tool selection strategy; auto lets the model decide, none disables tool calls, and required forces a tool call
To select a function, use {"type":"function","function":{"name":"FUNCTION_NAME"}}
Disable thinking with thinking.type: disabled when using required or selecting a specific function
Default: auto
Options: auto, none, required, a function selection object
response_format object
Output format constraint; when requesting json_object, explicitly instruct the model to produce JSON in messages
type
stringrequiredOutput format
Default:
textOptions:
text,json_object,json_schema
json_schema
objectRequired when
typeisjson_schemaname
stringrequiredSchema name
schema
objectrequiredJSON Schema describing the expected output structure
stop string | array
Stop generation when a matching sequence is encountered; accepts up to 4 stop sequences
Response Format
id string
Unique identifier for the completion
object string
Object type
Value: chat.completion
created integer
Unix timestamp of response creation in seconds
model string
Model used for the completion
choices array
Completion choices
index
integerChoice index
message
objectGenerated assistant message
role
stringValue:
assistantcontent
string | nullFinal answer text; may be
nullwhen a tool call is returnedreasoning_content
stringReasoning text when thinking is enabled
tool_calls
arrayTool calls to execute; each item contains
id,type: function, andfunctionwithnameand JSON-encodedarguments
finish_reason
stringReason generation ended, such as
stop,length,tool_calls, orcontent_filter
usage object
Token usage statistics
prompt_tokens
integerInput token count
completion_tokens
integerOutput token count, including reasoning tokens
total_tokens
integerTotal input and output token count
prompt_tokens_details
objectOptional input token details
cached_tokens
integerInput tokens served from cache
completion_tokens_details
objectOptional output token details
reasoning_tokens
integerTokens consumed by reasoning