◉ANTIGRAVITY LABJP
Articles/Integrations
⬡ Integrations/2026-04-24Advanced

Antigravity × Gemini File API: A Production Guide to Feeding Long-Form Media (Video, Audio, PDF) into Your Agents

Feed hour-long videos, podcasts, and book-length PDFs into your Antigravity agents with the Gemini File API. A practical, production-oriented pipeline with timestamped highlight extraction, idempotent uploads, cost accounting, and failure recovery.

Antigravity377Gemini File APIlong video AIaudio summarizationmultimodal7Python18

✦ Premium Article

"I want to summarize a three-hour meeting recording." "I need the timestamps for every slide transition in a two-hour lecture." If you're building agents in Antigravity, these requests land on your desk sooner than you'd think.

The first wall you hit is deceptively simple: how do you actually hand that much media to Gemini? You can't just base64-encode a movie and shove it into the prompt, and streaming isn't really a thing either. The answer is the Gemini File API — but the official docs describe what each endpoint does, not how to wire the whole thing together in a way that survives production.

I've rebuilt this pipeline in Antigravity more times than I care to admit over the past six months, feeding in my own studio recordings, performance archives, and ambient sound sources. Along the way I learned — the hard way — that treating the File API as a dumb uploader almost always ends badly, and that stable timestamped output is 90% a schema-design problem. This guide captures what I wish someone had handed me on day one.

What you'll build

The endgame is unassuming. You point one Python script at a local video, audio, or PDF file and it returns:

  • an overall summary (400 to 600 characters / ~100 words)
  • chapters, each with timestamps, title, and mini-summary
  • highlights — five to ten "you can't miss this" moments with timestamps
  • token usage and cost in USD and JPY

Wire this into an Antigravity agent and "watch this long video" becomes an agent task instead of a personal chore. I use it to auto-generate minutes from my weekend studio logs, but the same pipeline will carry a dozen other workflows.

Where the File API fits — and why you actually need it

Gemini accepts images, audio, and video in prompts through three different mechanisms:

  • Inline embedding — base64-encode the asset into the request itself. Fine for small images and clips under ~20 MB
  • File API — upload once to Google's storage, get a URI, reference it from as many prompts as you like. This is the only realistic path for hundreds of megabytes to multi-gigabyte media
  • Direct YouTube URL — a convenient shortcut, but only for public YouTube videos, not your own assets

Inline has a soft cap around 20 MB and will reject most hour-long audio outright. The File API, as of April 2026, accepts up to 2 GB, keeps the file for 48 hours, and lets you reference the same file across many inference calls. My rule of thumb: if the MP4 on disk is over 150 MB, don't think twice — use the File API.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦If you've been stuck trying to feed a 3-hour meeting recording into an AI because token limits and upload formats kept breaking, you'll walk away with a working pipeline you can run today
✦You'll learn the exact design patterns production code needs — timestamped highlight extraction, safe retries, idempotent uploads — not a toy demo
✦The pipeline transfers directly to real business use cases like meeting minutes, lecture indexing, and long-form content digests, so you can apply it to your own product immediately
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⬡ Integrations2026-09-20
antigravity-preview-05-2026 shuts down October 5: which setups need more than a string swap
The shutdown date for antigravity-preview-05-2026 is set for October 5, and the official page gives you the date and the successor name, nothing more. If you only read output_text, swapping the string is the whole migration. If you read steps, it is not.
⬡ Integrations2026-09-18
When a session starts with MCP tools missing, where do you stop?
When MCP initialization fails at startup, the agent quietly falls back to other means and keeps going. Here is a small script that asks your servers directly which tools they expose, plus the three branches I decided on in advance for when something is missing.
⬡ Integrations2026-08-03
I Measured Before Writing a Number: MCP Connect and Tool Calls Differed by 486x
Antigravity 2.4.3 lets you set a timeout per MCP server. To find a defensible number I built a stdio server, measured each boundary separately, and found why a single value cannot cover both.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links