Gemini API Now Slices Files So You Pay Only for What It Reads
Google has added file slicing controls to the Gemini API, letting developers send only the pages, cells or media segments a model actually needs. The controls work across all Gemini 4 models, and Google says tokens are billed only for the parts Gemini inspects.
What Changed
The launch covers Google AI Studio and the Gemini platform, and it arrives with native upload support for Microsoft Office and OpenDocument formats. Developers can pass PDFs, Word documents, slides, spreadsheets, audio and video straight to the API without converting them first.
A file is uploaded once through the Files API, and its reference can be reused across turns and tool calls. The agent can then ask for a narrower slice in a later turn, or inside a function response, without uploading the file again. Reuse keeps context small and costs down.
How Slicing Works
For documents and slides, developers pick a page range, a resolution and a content layer, choosing extracted text, page images or both. Spreadsheets can be narrowed to one worksheet tab and a cell range, with data, formulas or visuals as the layer.
Video can be clipped to a time interval with a chosen frame rate and resolution, plus transcript, frames or audio layers. Audio takes the same treatment, with start and end offsets only. When options are omitted, documents default to layout-preserving page images.
Existing limits still apply to the uploaded file itself: 50 megabytes per file, 1,000 pages per PDF, and 50,000 cells per spreadsheet sheet. Files API uploads are stored for 48 hours, and the Files API itself carries no charge where the Gemini API is available.
What It Costs
Google prices the feature by what Gemini inspects, not by what is uploaded. Its example puts a low-resolution page image at about 280 tokens, medium at 560 and high at 1,120. Skimming a document as extracted text first can cut the bill sharply.
Early partners put numbers on the saving. Vercel says skimming a page for text used 14 times fewer tokens than rendering the whole PDF. LiteLLM reports slicing cut prompt tokens by 67 percent for a PDF and 33 percent for a workbook in its tests. Both are production figures.
Our Read
This is plumbing, but it is plumbing that changes what agents can afford to do. Whole-file ingestion made long documents a tax on every turn; slicing turns the file into a database the agent queries. That matters most for document-heavy work, where one chart hides in a 400-page manual.
The risk is subtler. Billing by slice rewards careful prompts and punishes sloppy ones, so costs become harder to predict for teams that let agents choose freely. Google’s own example, skim cheap then zoom in, is the discipline the pricing now demands. Open-ended agent access makes it worse.
Why It Matters
For developers, the win is concrete: lower token bills, no local rendering stack, and agents that can reach into files mid-task. For Google, it tightens the Gemini API’s grip on agentic workflows, where rivals still make teams convert and slice files themselves.
Background
The controls build on the Files API, which already let developers upload a file once and reuse it. They follow a busy month for Gemini’s developer surface, including the Decisions API for structured choices and new Gemini 4 models aimed at coding and long-horizon work.
Source: Google’s announcement


0 Comments