格式化输出
概览
- 方法: POST
- 地址: https://api.winfull.cloud-ip.cc/v1beta/models/gemini-2.5-pro:generateContent
- 简介: 官方文档:https://ai.google.dev/gemini-api/docs/structured-output?hl=zh-cn
认证
- Header: Authorization: Bearer
<token>
请求参数
- Header: Authorization: Bearer
<token> - Body 类型: application/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 --location -g --request POST 'https://api.winfull.cloud-ip.cc/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"
]
}
}
}
}'返回示例
🟢200成功 示例
{}最后更新:2025-12-01 17:06:13
