Skip to content

URL context

POST https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent

Official documentation: https://ai.google.dev/gemini-api/docs/url-context?hl=zh-cn

With the URL context tool, you can provide additional context to the model in the form of URLs. By adding URLs to your request, the model will access the content in these web pages (as long as they are not URL types listed in the restrictions section), providing information for responses and improving response quality.

The URL context tool is suitable for the following tasks:

Data extraction: Extract specific information such as prices, names, or key findings from multiple URLs.
Document comparison: Analyze multiple reports, articles, or PDFs to identify differences and track trends.
Synthesis and content creation: Combine information from multiple source URLs to generate accurate summaries, blog posts, or reports.
Code and documentation analysis: Point to GitHub repositories or technical documentation to explain code, generate setup instructions, or answer questions.

Request Parameters

Authorization

Add the Authorization parameter to the Header, with its value being the Token concatenated after Bearer

Example: Authorization: Bearer ********************

Query Parameters

ParameterTypeRequiredDescriptionExample
keystringRequired{{YOUR_API_KEY}}

Header Parameters

ParameterTypeRequiredDescriptionExample
Content-TypestringRequiredapplication/json

Body Parameters (application/json)

ParameterTypeRequiredDescription
contentsarray[object]Required
  └ partsarray[object]Optional

Request Example

json
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Interpreting this website https://www.youtube.com/watch?v=QCvF8mCPwdQ"
        }
      ]
    }
  ],
  "tools": [
    {
      "UrlContext": {}
    }
  ]
}

cURL Example

bash
curl --location -g --request POST 'https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent?key=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Interpreting this website https://www.youtube.com/watch?v=QCvF8mCPwdQ"
        }
      ]
    }
  ],
  "tools": [
    {
      "UrlContext": {}
    }
  ]
}'

Response

🟢 200 Success

Response Example

json
{}