Gemini API File Slicing: Stop Feeding the Model the Whole File
Google shipped native file slicing in the Gemini API on November 23, 2026. Your agent can now read only the pages, cells, or seconds it needs from a PDF, spreadsheet, video, or audio file, and you pay tokens only for what it inspects.
Amir Ali Liaqat · Founder & CEO, DesignsToDeploy

Google shipped native file slicing in the Gemini API on November 23, 2026, and it fixes a cost most AI apps pay without noticing: the model reads the whole file when it only needed one page. Until now, sending a 200-page PDF, a 40-tab workbook, or a two-hour recording to Gemini meant the model ingested all of it, and you paid tokens for all of it. With file slicing, your agent asks for the exact pages, cell ranges, or time intervals it needs, and Google slices, renders, and tokenizes that slice server-side. Tokens are billed only for the parts Gemini actually inspects. If you build AI features into products, here is what changed and how to use it.
What actually shipped
The launch covers the Gemini API in Google AI Studio and the Gemini platform, and it works across all Gemini 4 models. Two things arrive together. First, native file slicing controls: you pass a file once through the Files API and then request only the slice you need. Second, native upload support for Microsoft Office and OpenDocument formats, so Word documents, PowerPoint decks, and Excel workbooks go straight to the API alongside PDFs, images, audio, and video. No conversion step on your side, no flattening a document to plain text before the model can see it.
The controls differ by format, and each one maps to a real workflow. Documents and slides, PDF plus Office and OpenDocument, take a page range with start_page and end_page, a resolution of low, medium, or high, and a content layer of page_text or page_image. Spreadsheets, .xlsx, .xls, and .ods, take a worksheet tab by sheet_index, a cell range with visible_cells, a resolution, and a layer of data, formulas, or visuals. Video takes a time interval with start_offset and end_offset, an fps and resolution setting, and a layer of transcript, frames, or audio. Audio takes a start and end offset. When you omit the options, documents default to layout-preserving page images, and spreadsheets include evaluated values, formulas, and sheet names across all tabs. Existing file size and page limits still apply to the uploaded file.
Skim cheap, then zoom in
The pattern Google recommends is the one that saves the money: skim first, zoom in once. Upload a Word document to the Files API, skim every page cheaply as extracted text to find the right section, then reuse the same file URI to inspect a single page at high resolution. Google's own example does exactly this, skimming a quarterly report with gemini-4-hydrogen to find the revenue bridge chart, then re-reading page 3 at high resolution with gemini-4-neon. The file is uploaded once and the URI is reused across turns and tool calls, so a long document stays addressable for the whole session instead of being re-sent on every turn.
The same idea reaches inside agent workflows. The API lets the agent specify which parts of a file to inspect directly inside a function response, so a tool that returns a file reference can return only the matching tab, page interval, or video clip instead of flooding the context window. That is the change that matters for multi-step agents: they rarely need the whole archive up front, and now the slice can be decided at the moment the tool runs, not when the file is first uploaded.
What it saves
The launch post carries early numbers from two partners, and both are worth quoting with their attribution intact. Vercel reports that skimming a document page for text extraction used 14x fewer tokens than rendering the whole PDF. LiteLLM reports that slicing cut prompt tokens by 67% for a PDF and 33% for a workbook in its testing, and that the feature works through LiteLLM's Gemini routes with no extra setup. Treat these as partner results, not Google benchmarks, but the direction is unambiguous: when an agent needs one page out of two hundred, reading two hundred pages is pure waste.
The second saving is engineering time. When model APIs only ingested whole files, agent harnesses ended up running LibreOffice, PDF renderers, and ffmpeg inside the client to render and slice large files, which bloated memory, cluttered local disk with extracted frames, and forced enterprise platforms to maintain per-user sandboxes just to slice files. File slicing moves that work server-side: pass a Files API URI on a user turn or inside a function response, and the API slices, renders, and tokenizes each file the way the model was trained to see it. Your harness gets smaller, and the slicing logic stops being your problem.
What to do now
- TRY IT IN AI STUDIO: file slicing is live now in Google AI Studio and the Gemini platform, across all Gemini 4 models. No new SDK to install for the core flow.
- UPLOAD ONCE: send the file through the Files API and keep the URI. Reuse it across turns and tool calls instead of re-uploading.
- SLICE BY RANGE: use start_page and end_page for documents, sheet_index and visible_cells for spreadsheets, start_offset and end_offset for video and audio.
- PICK THE LAYER: page_text for a cheap skim, page_image for a chart or dense layout, data or formulas for a sheet, transcript or frames for a video. Spend high-resolution tokens only where they change the answer.
One habit to build alongside this: measure before and after. Log the prompt tokens on your heaviest file-reading agent flow today, then run the same flow with slicing and compare. The partner numbers suggest the gap will be large on long documents, and your own measurement is the one that decides whether the pattern is worth rolling out everywhere.
“Pay for the slice. Not the whole file.”
— DesignsToDeploy
File slicing is a small API change with a large billing consequence. The model reads what it needs, you pay for what it reads, and the glue code that used to slice files locally disappears from your harness. At DesignsToDeploy we build AI features into real products, and this is exactly the kind of capability we wire into client apps first: invisible to the end user, obvious on the invoice. If your product reads documents, spreadsheets, or recordings with AI, talk to us at designstodeploy.dev.
1 / 5Keep reading

Git 2.56: Safer Conflicts, a Tidier Repo, and Much Faster History
Git 2.56 landed in late September 2026 with one theme: stop the small mistakes that cost teams hours. Here is what changed, from git add --resolved and branch cleanup to merge-base speedups that turn minutes into milliseconds.
Read article
Node 26 Goes LTS: Patch First, Upgrade Smart
On October 28, 2026, Node.js 26 becomes the long-term support release your production apps should run on. Five days earlier, a security release patched Node 22, 24 and 26 together. Here is the timeline, the fixes, and the safe upgrade order.
Read article
VS Code 1.145: Coding Agents That Work While You Sleep
VS Code 1.145 shipped November 4, 2026, turning the editor into an agent host: remote agents you can preview in the Agents window, automations on a five-field cron schedule, and nested sessions that mix harnesses. What changed, what is still preview, and the four moves to set it up today.
Read article