2025-08-19 - https://ai.google.dev/gemini-api/docs/url-context

The URL context tool in the Gemini API allows users to provide URLs to supply additional context to AI models. When included in requests, the model fetches and uses content from specified URLs (excluding certain unsupported types) to enhance responses. This tool supports tasks like extracting specific data, comparing documents, synthesizing content from multiple sources, and analyzing code or documentation. It operates with a two-step retrieval process using a cache and live fetch to balance speed and freshness. The URL context tool can be combined with other tools, such as Google Search, for enhanced information retrieval and analysis. The API response includes metadata on URL retrieval status, useful for verification. The tool has best practices and limitations, including a request limit of 20 URLs per request, content size limits, and supported content types. Usage incurs token costs based on the model used. The documentation also includes code examples for Python, JavaScript, and REST, guidance on safety checks, token counting, and supported Gemini models.