Structured Output
Official Documentation: https://ai.google.dev/gemini-api/docs/structured-output?hl=zh-cn
Endpoint
POST http://v98store.com/v1beta/models/gemini-2.5-pro:generateContent cURL Command
curl -X POST 'http://v98store.com/v1beta/models/gemini-2.5-pro:generateContent' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -d '{ "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" ] } } } }' Parameters
| Name | In | Description | Required |
|---|---|---|---|
| key | query | Yes | |
| Content-Type | header | Yes |
Request Body
Example
{
"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"
]
}
}
}
} Responses
200 -
Example
undefined