注册

Gemini 原生 URL 上下文

POST https://api.quickrouter.ai/v1beta/models/gemini-2.5-flash:generateContent 在线调试 →
Authorization

在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token

示例: Authorization: Bearer ********************

官方文档:https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn

请求参数

Query 参数
key string
必需
示例: YOUR_API_KEY
Header 参数
Content-Type string
必需
示例: application/json
Body 参数 application/json
contents array [object]
必需
parts array [object]
可选
{ "contents": [ { "role": "user", "parts": [ {"text": "https://www.freqtrade.io/en/stable/ Explain the content of this website"} ] } ], "tools": [ { "urlContext": {} } ] } 请求
示例
{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "https://www.freqtrade.io/en/stable/   Explain the content of this website"
                }
            ]
        }
    ],
    "tools": [
        {
            "urlContext": {}
        }
    ]
}

请求示例代码

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "你好"
        }
      ]
    }
  ]
}
curl --location -g --request POST 'https://api.quickrouter.ai/v1beta/models/gemini-2.5-flash:generateContent?key=' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "https://www.freqtrade.io/en/stable/   Explain the content of this website"
        }
      ]
    }
  ],
  "tools": [
    {
      "urlContext": {}
    }
  ]
}'
"var myHeaders = new Headers();\nmyHeaders.append(\"Authorization\", \"Bearer YOUR_API_KEY\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"contents\": [\n      {\n         \"role\": \"user\",\n         \"parts\": [\n            {\n               \"text\": \"https://www.freqtrade.io/en/stable/   Explain the content of this website\"\n            }\n         ]\n      }\n   ],\n   \"tools\": [\n      {\n         \"urlContext\": {}\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.quickrouter.ai/v1beta/models/gemini-2.5-flash:generateContent\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
"import http.client\nimport json\n\nconn = http.client.HTTPSConnection(\"api.quickrouter.ai\")\npayload = json.dumps({\n   \"contents\": [\n      {\n         \"role\": \"user\",\n         \"parts\": [\n            {\n               \"text\": \"https://www.freqtrade.io/en/stable/   Explain the content of this website\"\n            }\n         ]\n      }\n   ],\n   \"tools\": [\n      {\n         \"urlContext\": {}\n      }\n   ]\n})\nheaders = {\n   'Authorization': 'Bearer YOUR_API_KEY',\n   'Content-Type': 'application/json'\n}\nconn.request(\"POST\", \"/v1beta/models/gemini-2.5-flash:generateContent\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))"

返回响应

响应参数 🟢 200 OK · application/json
object
可选
{}
示例
{}