POST/v1beta/models/gemini-2.5-pro:generateContent
官方文档:https://ai.google.dev/gemini-api/docs/url-context?hl=zh-cn
借助网址上下文工具,您可以网址的形式向模型提供更多上下文。通过在请求中添加网址,模型将访问这些网页中的内容(只要不是限制部分中列出的网址类型),从而为回答提供信息并提高回答质量。
网址上下文工具适用于以下任务:
提取数据:从多个网址中提取价格、名称或关键发现等特定信息。
比较文档:分析多份报告、文章或 PDF,以找出差异并跟踪趋势。
综合和创建内容:结合多个来源网址中的信息,生成准确的摘要、博文或报告。
分析代码和文档:指向 GitHub 代码库或技术文档,以解释代码、生成设置说明或回答问题。
来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673460,
"name": "URL context",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档:https://ai.google.dev/gemini-api/docs/url-context?hl=zh-cn\n\n借助网址上下文工具,您可以网址的形式向模型提供更多上下文。通过在请求中添加网址,模型将访问这些网页中的内容(只要不是限制部分中列出的网址类型),从而为回答提供信息并提高回答质量。\n\n网址上下文工具适用于以下任务:\n\n提取数据:从多个网址中提取价格、名称或关键发现等特定信息。\n比较文档:分析多份报告、文章或 PDF,以找出差异并跟踪趋势。\n综合和创建内容:结合多个来源网址中的信息,生成准确的摘要、博文或报告。\n分析代码和文档:指向 GitHub 代码库或技术文档,以解释代码、生成设置说明或回答问题。",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/v1beta/models/gemini-2.5-pro: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": {
"text": {
"type": "string"
}
},
"x-apifox-orders": [
"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 {\n \"text\": \"Interpreting this website https://www.youtube.com/watch?v=QCvF8mCPwdQ\"\n }\n ]\n }\n ],\n \"tools\": [\n {\n \"UrlContext\": {}\n }\n ]\n}",
"name": "示例"
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [
{
"id": "b4inb5ENt1",
"name": "key",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "{{YOUR_API_KEY}}"
}
],
"cookie": [],
"header": [
{
"id": "fuFf2peRev",
"name": "Content-Type",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "application/json"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 108596060,
"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": 96,
"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": [],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}