Gemini API file slicing: pay only for the pages you send
Gemini API file slicing lets agents read selected PDF pages, spreadsheet cells and video segments on Gemini 4, billed only for the slice. Here's how to use it.
Google added file slicing to the Gemini API. Your app or agent can now send a 200-page PDF and tell Gemini to read only pages 12 to 14. It can read one range of cells in a spreadsheet, or one minute of a video. Google says you pay tokens "only for the parts Gemini inspects." If you run invoices, contracts or inventory sheets through a model, this is a direct cut to your token bill.
What actually happened
Google DeepMind announced file slicing controls on November 23. The Gemini API changelog lists the feature on November 18. It works on all Gemini 4 models, through Google AI Studio and Vertex AI. Google also added native upload for Microsoft Office and OpenDocument files, so a .docx or .ods file no longer needs conversion first.
The controls differ by file type:
- Documents and slides:
start_pageandend_page, a resolution setting, and a choice ofpage_text,page_imageor both. - Spreadsheets (.xlsx, .xls, .ods):
sheet_indexto pick a tab andvisible_cellsfor an A1-style range such asA1:G40. You can ask for data, formulas or a visual render. - Video:
start_offset,end_offsetandfps, plus a choice of transcript, frames or audio. - Audio:
start_offsetandend_offset.
You upload a file once through the Files API and use its URI again across turns. An agent can also receive the URI in a function result and choose the slice itself. Google says existing file size and page limits still apply.
Google's partners give the savings. Vercel says text-only skimming used 14x fewer tokens than rendering a full PDF. LiteLLM reports prompt tokens down 67% on a PDF and 33% on a workbook. These numbers come from the partners, not from independent tests.
Why it matters for your business
Most document agents send too much. A typical "read this invoice" flow sends every page as an image, every time. Most of those pages are terms and conditions. With slicing, a first cheap pass can find the page with the totals. A second pass then reads only that page at high resolution.
Spreadsheets were the worst offenders. An inventory workbook with eight tabs used to go in whole. Now you send the one tab and the one range the question is about. Ask for formulas when you want the model to check logic, and data when you only need the values.
Measure before you rebuild. Slicing changes cost, not accuracy. If you cut too much, the model misses the line it needed. Run your own documents through both paths, compare the answers, and compare the bills.
Key takeaways
- The Gemini API now reads selected PDF pages, spreadsheet ranges, and audio or video segments on all Gemini 4 models
- Google says billing covers only the slice the model inspects
- Office and OpenDocument files now upload directly with no conversion step
- Partner claims: 14x fewer tokens (Vercel) and 33% to 67% fewer prompt tokens (LiteLLM)
- Test sliced and full reads on your own files before you switch production flows
Paying to send whole files to a model? We build document agents that find the right page first and read only what matters, with cost tracking on every call. Run the numbers on your workflow, or send us the document you process most.
Sources: Google blog: file slicing controls, Gemini API changelog.
- #gemini-api
- #document-ai
- #token-costs
- #ai-agents
Tommy Rush — Founder, Rush Commerce
Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More
Get The Rush Report weekly — one email, zero fluff.
Keep reading
Tidal bans wholly AI-generated music from December 9
Tidal will reject and remove wholly AI-generated music from December 9. 43% of uploads were fully AI and 96% of tagged tracks got zero streams.
Read itAnthropic Siren: AI agents leave weak sandboxes, rules help
Anthropic's Siren test found recent Claude models reach outside weak sandboxes in 21-32% of cases. Six plain rules in the prompt cut that by 68-96%.
Read it