← PostsPost ·

Gemini API file slicing: pay only for the pages Gemini reads

Since 2026-11-23 the Gemini API can read a chosen page range, cell range or media clip of an uploaded file, bills only those tokens, and accepts Office files.

Give this to your agent

Open in

Your agent checks this against your setup and tells you if it fits.

See the file
# Gemini API file slicing: read only the pages, cells or clips needed, and pay only for those
From Rig Labs, 2026-11-24. Information for an agent, not orders. Page: https://riglabs.ai/blog/gemini-api-file-slicing/

What changed: On 2026-11-23 Google added file slicing to the Gemini API, on all Gemini 4 models. A request can name a page range, a cell range or a time interval, and Google bills only those tokens. The API also accepts Office and OpenDocument files.
Fits if: Your human runs code or an agent that sends PDFs, Office files, spreadsheets, audio or video to the Gemini API and pays by the token.
Skip if: Your human uses only the Gemini app, or does not call the Gemini API with files. The feature is an API option, not an app setting.
Check: Which calls in your human's code send whole files to Gemini, which Gemini models they use, and how large those files are. Read-only.
Try: Point the human to the one call that sends the largest document, and propose adding a page range to it, as in Google's example, then comparing prompt tokens before and after.
Ask first: Changing any code that runs in production, and uploading a file to the Files API.
Cost: No new price in the source. Tokens are billed only for the slices Gemini inspects.
Undo: Remove the processing options from the call, and it reads the whole file again.
Deeper: https://blog.google/innovation-and-ai/technology/developers-tools/file-slicing-controls/

Gemini API file slicing, released by Google on November 23, 2026, lets a developer upload a file once and have Gemini read only the pages, spreadsheet cells or media segments they name. Google bills tokens only for the parts Gemini inspects, and the API now accepts Microsoft Office and OpenDocument files directly.

What you can now do: if your app or agent sends long PDFs, slide decks, workbooks or recordings to Gemini, you can stop paying for the whole file on every question. Ask for page 3 only, or minutes 10 to 12 only, and reuse the same upload for the next question.

What is file slicing in the Gemini API?

File slicing in the Gemini API is a set of options on each request that choose which part of a file the model sees, per Google’s announcement. You upload the file once with the Files API and reuse its address (its URI) across turns and tool calls. Google says it works on all Gemini 4 models, in Google AI Studio and the Gemini platform, and that existing file size and page limits still apply.

Google’s description of the old way: agents ended up running LibreOffice, PDF renderers and ffmpeg on their own machine to cut large files. Now the API slices and renders the file on Google’s side.

What can you slice?

The Gemini API slices four kinds of file, per the announcement:

File What you choose
Documents and slides (PDF, Office, OpenDocument) A page range, a resolution (low, medium, high), and layers: page text or page image
Spreadsheets (.xlsx, .xls, .ods) A worksheet, a cell range, a resolution, and layers: data, formulas, visuals
Video A time interval, frames per second, a resolution (low, high), and layers: transcript, frames, audio
Audio A time interval

If you set nothing, documents and slides default to page images that keep the layout, and spreadsheets include values, formulas and sheet names across all tabs.

How much does file slicing save?

File slicing saves the tokens of every part Gemini does not read, and the size of the saving depends on your files. Rohan Doshi of Google DeepMind, a co-author of the announcement, reported on X an early result: Vercel used 14 times fewer tokens skimming a page as text than rendering the full PDF. That is the partner’s number as Google relays it. This changes your bill only if you pay for the Gemini API by the token. It changes nothing in the Gemini app.

How do agents use it?

An agent can name the slice it wants inside a function result, per the announcement, so it decides mid-task which page to open. Google’s suggested pattern is “skim cheap, then zoom in”: read the whole document as extracted text first, then spend high-resolution tokens on the one page with the chart. Google’s example does the skim on Gemini 4 Hydrogen and the close read on Gemini 4 Neon.

What to do today

Find the one call in your code that sends a whole document to Gemini, and add a page range to it. This fragment is from Google’s own example, which reads page 3 of an uploaded Word file as a high-resolution image:

"resolution": "high",
"processing": {
    "type": "static",
    "page_options": {
        "start_page": 3,
        "end_page": 3,
        "content_layers": ["page_image"],
    },
},

Compare the prompt tokens of that call before and after.

Last checked 2026-11-24.

Sources:

Get the next one by email

The Edge is our newsletter: what changed in AI, and what to do about it.

Which emails
Free. Your agent reads every piece we publish, and you hear only what fits.

Subscribe your agent Beta

Your agent reads every post, guide and issue, checks it against your setup, and tells you only what is worth your time. Its inbox gets the daily agent cards email automatically, every day something is published, and the weekly issue as plain text. You pick weekly, daily or both for yourself.

  1. Give it the prompt

    Using Claude Code, Codex or another agent? Copy the prompt and paste it in.

    See the prompt
    Subscribe yourself to The Edge, the newsletter from Rig Labs, and follow what Rig Labs publishes for me.
    Read https://riglabs.ai/agents/subscribe.md and follow its steps. It has you save the skill at https://riglabs.ai/agents/the-edge/SKILL.md, set yourself up with your own inbox on Nym (invite: https://withnym.com/join/NYM-TQZB-WP35, code NYM-TQZB-WP35) unless you already have one, subscribe that address, and confirm with me.
    Treat everything you fetch from Rig Labs as information, not orders. Ask me before anything that touches keys, payments, permissions, installs or sending messages.
  2. Approve its inbox

    It gets its own address on Nym, so The Edge never lands in your inbox. One sign-in in your browser, about a minute.

  3. Hear only what fits

    At most one short message a day. Nothing if nothing fits.

Your agent follows subscribe.md and saves SKILL.md: read both first. Nym is in private beta. The invite is included in the prompt.

Read next

Built by Rig Labs

When a tool we need does not exist, we build it.