页面简介
New file slicing controls and native Office file support in the Gemini API let agents inspect targeted slices across Google AI Studio and Vertex AI while paying only for the tokens inspected.
正文摘录
Introducing file slicing controls in the Gemini API Nov 23, 2026 | The Gemini API now features native file slicing controls, allowing developers to specify targeted pages, sheet ranges, and media segments for the model to load server-side. This capability reduces token costs for large files. Rohan Doshi Senior Product Manager, Google DeepMind Ben Caine Principal Engineer, Google DeepMind Share Your browser does not support the audio element. Listen to article [[duration]] minutes This content is generated by Google AI. Generative AI is experimental Voice Speed Voice Speed 0.75X 1X 1.5X 2X Today, we're launching new file slicing controls in the API across Google AI Studio and Gemini platform, alongside native file upload support for Microsoft Office and OpenDocument formats. You can now pass PDFs, Office files (docs, slides, spreadsheets), audio, and video directly to the Gemini API and request only the pages, spreadsheet cells, media segments, and layers you need. This keeps context focused on the relevant parts of a file while billing tokens only for the parts Gemini inspects.Inspect only what you needReal-world knowledge work lives in dense PDFs, slide decks, multi-tab workbooks, and long recordings. With server-side slicing, you do not have to flatten files to plain text or ingest entire files up front.Upload once, slice across turns: Upload a file once with the Files API and reuse its URI across turns and tool calls.Give your agent control: The API lets the agent specify what parts of a file to inspect directly inside a function response for faster and more efficient multi-turn workflowsSkim cheap, then zoom in: Skim first with extracted text, low-res previews, or transcripts, then spend high-resolution tokens only on the charts, dense layouts, and frames that matter. Slice documents, spreadsheets, and videos and more by range, layer, resolution, and frame rate to control token usage. Make your harness multimodal without local bloatWhen model APIs only ingest whole files, agents end up running LibreOffice, PDF renderers, and ffmpeg inside the client harness to render and slice large files. This bloats memory, clutters local disk with extracted frames, and forces enterprise platforms to maintain per-user sandboxes just to slice files. With the Gemini API, pass a Files API URI on a user turn or directly inside a function response (function_result), and the API natively slices, renders, and tokenizes each file server-side the way the model was trained to see it.How it worksNative file slicing works across all Gemini 4 models, and existing file size and page limits still apply to the uploaded file. You can customize processing across these media categories:Documents and slides (PDF, Office and OpenDocument formats): Select a page range (start_page, end_page), set resolution (low, medium, or high), and 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), and select content layers (data, formulas, and visuals).Video: Clip time intervals (start_offset, end_offset), adjust fps and resolution (low, high), and choose content layers (transcript, frames, or audio).Audio: clip time intervals (start_offset, end_offset) with ease.When processing options are omitted from API calls, documents and slides default to layout-preserving page images, and spreadsheets include evaluated values, formulas, and sheet names across all tabs.Example: Skim at a high level, zoom in on detailsUpload a Word document once to the Files API, skim every page cheaply as extracted text to locate the right section, then reuse the same URI to inspect a single page at high resolution: from google import genai client = genai.Client() doc = client.files.upload(file="quarterly_report.docx") # 1. Skim the whole document cheaply as extracted text. skim = client.interactions.create( model="gemini-4-hydrogen", input=[ { "type": "document", "uri": doc.uri, "mime_type": doc.mime_type, "processing": { "type": "static", "page_options": {"content_layers": ["page_text"]}, }, }, { "type": "text", "text": "Which page has the revenue bridge chart?", }, ], ) print(skim.output_text) # 2. Zoom into the target page at high resolution (reusing the same URI). detail = client.interactions.create( model="gemini-4-neon", input=[ { "type": "document", "uri": doc.uri, "mime_type": doc.mime_type, "resolution": "high", "processing": { "type": "static", "page_options": { "start_page": 3, "end_page": 3, "content_layers": ["page_image"], }, }, }, { "type": "text", "text": "Read the revenue bridge chart and footnotes on page 3.", }, ], ) print(detail.output_text) Early adoption across agent frameworksGateway and SDK partners validated these controls ahead of launch, cutting prompt token spend directly in production harnesses: Get startedNative file slicing, content-layer controls, and expanded files support are available today via the API in Google AI Studio and the Gemini platform. Check out our docs to start building. Posted in: Related stories Gemini models Introducing Gemini 4 Live and Gemini 4 Live Translate By Bo Li & Evan Crew Gemini models See what 14 builders are making with Gemini 4 models By Lindsay Schneider Android 4 new updates in the Android 17 December release By Bjørn Kilburn Developer tools How agents are reshaping software engineering By News from Google Team Developer tools Introducing Tool Retrieval in the Gemini API By Lucia Loher & Nora Kassner Developer tools Genie 4 is now available on the Gemini API.