官方文档:https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn
POST
/v1beta/models/gemini-2.5-flash:generateContentgoogle search
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/v1beta/models/gemini-2.5-flash:generateContent \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "今天重庆天气如何?"}
]
}
],
"tools": [
{
"googleSearch": {}
}
]
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
key | Query | string | 是 | - | {{YOUR_API_KEY}} |
Content-Type | Header | string | 是 | - | application/json |
contents | JSON body | array<object> | 是 | - | - |
contents[].parts | JSON body | array<object> | 否 | - | - |
contents[].parts[].inline_data | JSON body | object | 否 | - | - |
contents[].parts[].inline_data.mime_type | JSON body | string | 是 | - | - |
contents[].parts[].inline_data.data | JSON body | string | 是 | - | - |
contents[].parts[].text | JSON body | string | 否 | - | - |
返回响应 (200)
此部分没有定义参数。
来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673458,
"name": "google search",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档:https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/v1beta/models/gemini-2.5-flash:generateContent",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"contents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"inline_data": {
"type": "object",
"properties": {
"mime_type": {
"type": "string"
},
"data": {
"type": "string"
}
},
"required": [
"mime_type",
"data"
],
"x-apifox-orders": [
"mime_type",
"data"
]
},
"text": {
"type": "string"
}
},
"x-apifox-orders": [
"inline_data",
"text"
]
}
}
},
"x-apifox-orders": [
"parts"
]
}
}
},
"required": [
"contents"
],
"x-apifox-orders": [
"contents"
]
},
"examples": [
{
"mediaType": "application/json",
"value": "{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\"text\": \"今天重庆天气如何?\"}\n ]\n }\n ],\n \"tools\": [\n {\n \"googleSearch\": {}\n }\n ]\n }",
"name": "示例"
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [
{
"id": "GsBYee3kKi",
"name": "key",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "{{YOUR_API_KEY}}"
}
],
"cookie": [],
"header": [
{
"id": "f9z3Ac0sW3",
"name": "Content-Type",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "application/json"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 109286303,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {},
"x-apifox-orders": []
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92749360,
"ordering": 84,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {}
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T14:40:23.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [
"BLANK.109286303"
],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}