File slicing controls introduced in Gemini API

The Gemini API has introduced native file slicing controls, enabling developers to specify particular pages, sheet ranges, and media segments for server-side processing. This new feature is designed to lower token costs associated with large files.

Google DeepMind has announced the launch of these file slicing controls within the API for both Google AI Studio and the Gemini platform. Additionally, the update includes native file upload support for Microsoft Office and OpenDocument formats. Users can now upload PDFs, Office documents (such as Word, PowerPoint, and Excel files), as well as audio and video, directly to the Gemini API. They can then request specific pages, spreadsheet cells, media segments, and layers, ensuring that the context focuses only on the necessary portions of the file. As a result, billing tokens are required only for the parts of the file that Gemini analyzes.

In practical scenarios, knowledge work often involves handling dense PDFs, slide presentations, multi-tab spreadsheets, and lengthy recordings. The new server-side slicing feature eliminates the need to convert files to plain text or upload entire files initially. Users can slice documents, spreadsheets, and videos by range, layer, resolution, and frame rate to manage token usage more efficiently.

Traditionally, when model APIs require whole file ingestion, users might resort to tools like LibreOffice, PDF renderers, and ffmpeg to process and slice large files on the client side. This approach can consume a lot of memory, clutter local disks with extracted frames, and compel enterprise platforms to maintain user-specific sandboxes just for file slicing. The Gemini API addresses these challenges by allowing users to pass a Files API URI during a user session or within a function response. The API then slices, renders, and tokenizes each file server-side, aligning with the model’s training.

The native file slicing feature is supported across all Gemini 4 models, though existing file size and page limits still apply. Users can customize file processing across various media types. If processing options are not specified in API calls, documents and slides default to layout-preserving page images, and spreadsheets include evaluated values, formulas, and sheet names from all tabs.

An example use case involves uploading a Word document once to the Files API, then easily skimming each page as extracted text to find the relevant section. The same URI can then be reused to view a specific page at a high resolution.

Gateway and SDK partners tested and validated these controls before launch, demonstrating a reduction in prompt token expenditure in production environments. The native file slicing, content-layer controls, and expanded file support are now accessible via the API in Google AI Studio and the Gemini platform. Developers are encouraged to review the documentation to begin using these features.