TAU-HOME.COM
LOADING

Native File Slicing Introduced in Gemini API: Reducing Token Costs for PDF, Office, Audio/Video Partial Processing

Google Gemini API now features native file slicing, allowing developers to selectively process specific portions of PDF, spreadsheet, Office documents, audio, a

tau · November 24, 2026

#Gemini API #File Slicing #Token Cost Reduction #AI Development Tools #Google AI Studio #Vertex AI

Native File Slicing Introduced in Gemini API: Reducing Token Costs for PDF, Office, Audio/Video Partial Processing

On November 23, 2026, Google introduced native file slicing capabilities to the Gemini API. This new feature allows developers to selectively process specific pages of PDFs, cell ranges in spreadsheets, and time segments in audio and video files, paying token costs only for the portions actually inspected by the AI model. This offers a significant advantage in reducing the high token expenses typically associated with processing large files with AI.

Google blog image introducing Gemini API's file slicing feature, visually representing the selection and processing of specific parts from various documents and media files.

Image source: Google

With this update, developers can leverage this functionality across all Gemini 4 models within Google AI Studio and the Gemini platform. This is expected to be crucial for AI agents to focus on relevant information within vast datasets, thereby minimizing wasted costs from processing unnecessary data.

Introducing Native File Slicing in the Gemini API

File slicing is a technology that enables an AI model to process only specific ranges or sections of a file, which are sliced server-side, instead of loading the entire file at once. For instance, if only three specific pages from a 100-page PDF document are needed, the AI model will inspect and charge tokens only for those three pages, rather than processing and billing for the entire document.

This feature comes with the following key characteristics:

  • Selective Processing: Developers can specify page ranges for PDFs, cell ranges for spreadsheets, and time intervals for audio and video files for targeted processing.
  • Native File Support: Microsoft Office (Word, Excel, PowerPoint) and OpenDocument (ODT, ODS, ODP) formats can be uploaded and processed directly without requiring prior conversion.
  • Token Cost Reduction: Tokens are the units by which AI models process text or data, and their usage incurs costs. File slicing processes only the necessary parts, reducing unnecessary token consumption and overall costs.

This functionality is immediately available across all Gemini 4 models in Google AI Studio and the Gemini platform, empowering developers to build more efficient AI applications.

Practical Advantages for Developers

The file slicing feature in the Gemini API offers several significant benefits for AI development workflows.

1. Maximized Cost Efficiency

Previously, processing large documents meant incurring token costs for converting all content within the entire file. Now, by selecting and processing only the necessary parts, developers can significantly reduce unnecessary token usage and AI model operational costs. This is particularly effective for tasks such as document summarization, specific data extraction, and media content analysis.

2. Enhanced AI Agent Context Focus

When AI agents need to extract key information from vast amounts of data, file slicing helps by eliminating irrelevant information, allowing the model to work more accurately and efficiently. For example, if only a specific chart or table in a financial report needs analysis, only that section can be passed to the model, enabling a more focused use of the AI's 'context window'.

3. Streamlined Development Workflows

Before, developers often had to use external tools like LibreOffice or FFmpeg to pre-process or extract specific parts of large files before feeding them to an AI model. This process increased memory usage, cluttered local disks, and forced enterprise platforms to maintain per-user sandboxes just for file slicing. With the Gemini API now natively slicing and rendering files server-side, developers can bypass these complex pre-processing steps and build more streamlined workflows.

Supported Formats and Customization Options

The Gemini API's file slicing feature provides granular customization options across various media types. However, existing file size and page limits still apply to the uploaded file.

  • Documents and Slides (PDF, Office, and OpenDocument formats):
    • Select a page range (start page, end page).
    • Set resolution (low, medium, or high).
    • Choose content layers (page text or page image).
  • Spreadsheets (.xlsx, .xls, .ods):
    • Select a worksheet tab (sheet index) and cell range (visible cells).
    • Set resolution (low, medium, or high).
    • Select content layers (data, formulas, and visuals).
  • Video:
    • Clip time intervals (start offset, end offset).
    • Adjust frames per second (fps) and resolution (low, high).
    • Choose content layers (transcript, frames, or audio).
  • Audio:
    • Easily clip time intervals (start offset, end offset).

When processing options are omitted from API calls, documents default to layout-preserving page images, and spreadsheets include evaluated values, formulas, and sheet names across all tabs.

Use Cases and Early Adoption

The file slicing feature is already demonstrating immediate impact in real-world development environments. For example, a developer can upload a Word document once to the Files API, then cheaply skim the entire document as extracted text to locate the right section. Subsequently, the same URI can be reused to inspect a single page at high resolution, optimizing the workflow.

Early adoption partners have validated the efficiency of this feature. Vercel reported using 14x fewer tokens for skimming a document page for text extraction compared to rendering the whole PDF. LiteLLM highlighted that most of their users sending PDFs, slide decks, and spreadsheets only need a few pages or one sheet. They reported a 67% reduction in prompt tokens for a PDF and 33% for a workbook, noting that the feature works seamlessly through LiteLLM's Gemini routes without extra setup.

Native file slicing, content-layer controls, and expanded file support are available today via the API in Google AI Studio and the Gemini platform. Developers can refer to the official documentation to start building AI applications with this powerful new capability.

Sources


Impact-Site-Verification: 9b3ebd10-6c45-44cf-a014-5b8c19b7b285