stream: true is set in the request, the API returns responses as server-sent events (SSE) with Content-Type: text/event-stream. This allows for progressive response delivery, where message deltas are sent incrementally as they are generated. Each event contains partial message content, enabling real-time display of responses in your application.text/event-streamdata: followed by JSONfinish_reasonmessages array share the exact same JSON structure:type field is fixed as "image_url"image_url key name remains unchanged for all file typesurl value points to your specific media filetools parameter is an optional array that allows you to define functions the model can call. The array can contain multiple objects. When using function calling, you can define multiple functions in the array.Google SearchFunction Callingresponse_format parameter is an optional JSON Schema object that defines the structure of the response. When provided, the model will generate responses that conform to this schema.response_format parameter and Function Calling (tools) are mutually exclusive.response_format for structured JSON output (e.g., JSON Mode).curl --location --request POST 'https://api.kie.ai/gemini-2.5-pro/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1759055072437dqlsclj2.png"
}
}
]
}
],
"tools": [
{
"type": "function",
"function": {
"name": "googleSearch"
}
}
],
"stream": true,
"include_thoughts": true,
"reasoning_effort": "high",
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "structured_output",
"strict": true,
"schema": {
"type": "object",
"properties": {
"response": {
"type": "string"
}
}
}
}
}
}'{
"id": "chatcmpl-example-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gemini-2.5-pro",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}