Google adds file slicing controls to Gemini API for targeted token usage

·2026.11.24 01:12

Key point

The feature allows agents to inspect specific pages, cells, or media segments server-side, billing only for the inspected tokens.

1 / 3

Details

  • Gemini API introduces native file slicing controls and Office file support, letting developers specify targeted pages, sheet ranges, and media segments to reduce token costs.
  • Early adoption testing by LiteLLM showed prompt token reductions of 67% for PDFs and 33% for workbooks, while Vercel reported 14x fewer tokens for text extraction compared to full PDF rendering.
  • The feature works across all Gemini 4 models, allowing agents to reuse file URIs across turns and specify inspection parameters directly in function responses.
  • Supported formats include PDFs, Microsoft Office and OpenDocument files, audio, and video, with customization options for resolution, content layers, and time intervals.
  • Documents and slides default to layout-preserving page images, while spreadsheets include evaluated values, formulas, and sheet names across all tabs when processing options are omitted.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.