Theme
Formatted Output
POST
https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent
Official Documentation: https://ai.google.dev/gemini-api/docs/structured-output?hl=zh-cn
Request Parameters
Authorization
Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.
Example: Authorization: Bearer ********************
Query Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key | string | Required | {{YOUR_API_KEY}} |
Header Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json |
Body Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array[object] | Required | |
└ parts | array[object] | Optional | |
generationConfig | object | Required | |
└ responseModalities | array[string] | Required |
Request Example
json
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "List a few popular cookie recipes, and include the amounts of ingredients."
}
]
}
],
"generationConfig": {
"responseMimeType": "application/json",
"responseSchema": {
"type": "ARRAY",
"items": {
"type": "OBJECT",
"properties": {
"recipeName": {
"type": "STRING"
},
"ingredients": {
"type": "ARRAY",
"items": {
"type": "STRING"
}
}
},
"propertyOrdering": [
"recipeName",
"ingredients"
]
}
}
}
}cURL Example
bash
curl --location -g --request POST 'https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent?key=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "List a few popular cookie recipes, and include the amounts of ingredients."
}
]
}
],
"generationConfig": {
"responseMimeType": "application/json",
"responseSchema": {
"type": "ARRAY",
"items": {
"type": "OBJECT",
"properties": {
"recipeName": {
"type": "STRING"
},
"ingredients": {
"type": "ARRAY",
"items": {
"type": "STRING"
}
}
},
"propertyOrdering": [
"recipeName",
"ingredients"
]
}
}
}
}'Response
🟢 200 Success
Response Example
json
{}