WARNING
⚠️ Chat only
This model currently supports chat requests only and has not yet been adapted for agent use. Connecting it to an agent may cause request errors or unexpected results.
The Gemini endpoint returns streaming results from streamGenerateContent. Function calling results appear in candidates[].content.parts[].functionCall.
Streaming Response Format:
parts[].functionCallthoughtSignature and usage informationcontents.googleSearch.functionDeclarations.generationConfig.thinkingConfig.contents as the primary input field.tools.googleSearch to enable Google Search.tools.functionDeclarations to define callable functions.generationConfig.thinkingConfig to control thought output and thinking level.Send your API key in the request header as Authorization: Bearer YOUR_API_KEY.
Errors are returned with HTTP 200 and a JSON body {"code": , "msg": ""}. Check code (200 = success) before reading choices/candidates.
curl --location 'https://api.kie.ai/gemini/v1/models/gemini-4-carbon:streamGenerateContent' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"stream": true,
"contents": [
{
"role": "user",
"parts": [
{
"text": "What is the weather in Beijing today?"
}
]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_weather_forecast",
"description": "Get the weather forecast for a given location",
"parameters": {
"type": "OBJECT",
"properties": {
"location": {
"type": "STRING",
"description": "The city name, e.g. Beijing"
}
},
"required": [
"location"
]
}
}
]
}
],
"generationConfig": {
"thinkingConfig": {
"includeThoughts": true,
"thinkingLevel": "medium"
}
}
}'{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Hello! How can I help you today?"
}
]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 5,
"candidatesTokenCount": 9,
"thinkingTokenCount": 0,
"totalTokenCount": 14
},
"credits_consumed": 0.01
}