Press Enter to search · Esc to close

Gemini API adds file slicing to cut token costs

Gemini API adds file slicing to cut token costs
Gemini API file slicing

Image: Google

Google's Gemini API can now read only the parts of a file a developer asks for. The new file slicing controls let a request name a page range in a PDF, a tab and cell range in a spreadsheet, or a time clip in audio and video, and the API loads that slice server-side. Google says it bills tokens only for the parts Gemini inspects, and announced it on X and in a blog post.

PDFs and slides take a page range, resolution and a choice of text or page images. Spreadsheets take a sheet index and cell range, with data, formulas and visuals as layers. Video adds time clips, frame rate and a choice of transcript, frames or audio.

The workflow suits agents. Upload a file once through the Files API, reuse the URI across turns, and let the agent request a slice inside a function response. Google suggests skimming a document cheaply as text, then spending high-resolution tokens on the one page that matters. That also spares local LibreOffice or ffmpeg setup.

Early partner numbers are promising. LiteLLM said slicing cut prompt tokens by 67 percent for a PDF and 33 percent for a workbook, and Vercel said extracting text from a page used 14 times fewer tokens than rendering the whole PDF. Those are partner claims, not independent tests.

It works across all Gemini 4 models, in AI Studio and the Gemini platform. Defaults matter: omit the options and documents load as full page images, while spreadsheets include every tab. TechcityAuthority has also covered Google's voice editing API.

Comments