Skip to Content

Multimodal models

Gemini can read photos, listen to audio and watch video because all of them become tokens in the same sequence as your text. Follow a photo, a voice note and a video into the model, and count their tokens.

8 minFree

Multimodal models
  1. Text
  2. Media
  3. Tokens
  4. Answer
FIG. AI-MULTIMODAL / 06 PARTSYoutext promptMedia fileimage, audio, videoFiles APIfor large filesMedia → tokenstiles, frames, audioContextone token sequenceGeminimultimodal model

Press Play to watch it run, or step through with ← →. Then switch to Practice and run it yourself.

00/05

Token count

No tokens yet. Press Play.

Background: the idea in plain words2 min read

Many chat tools take only typed text. But much of what people need help with is not text: a photo of a bill, a voice note, a video clip.

A multimodal model can take in more than one kind of input: text, images, audio, video and documents. Gemini is multimodal. You can send a photo with a question, a voice note with an instruction, or a video with a request, all in one prompt (the text and files you send to the model).

The trick is the same one you've seen for text (see Tokens and tokenizers). Each kind of media is turned into tokens (small pieces the model can work with), and those tokens go into the same sequence as your text. Then the transformer's attention, which lets each token look at the others (see Attention and transformers), works across all of them, so a word in your question can relate to a corner of a photo or a moment in a recording.

A tiny example. You send a photo of an electricity bill and ask "When is this bill due?" The photo becomes image tokens. The question becomes text tokens. The model reads both together and finds the due date printed on the bill.

Because media becomes tokens, it also uses your context window (the limit on how much fits in one request) and is billed like tokens. The Gemini docs give the counts.

InputHow it's counted (Gemini API)
Image258 tokens if both sides are 384 px or less. Larger images are tiled into 768×768 tiles, 258 tokens each.
Audio32 tokens per second (1,920 per minute).
VideoFrames sampled at 1 per second by default, plus the audio. About 100 tokens per second at the default (low) media resolution.

Press Play to follow a photo of a bill into the model. Then switch Try it to the voice note and the video, and compare the token counts in the log.

What to notice

  1. One sequence, one model. You don't call a separate image or speech service first. Media tokens and text tokens sit side by side, and the same model attends across them.
  2. Media is expensive in tokens. A one-line question is a few tokens. One photo is hundreds or thousands; a minute of video is thousands. Plan your context window and costs around that.
  3. Resolution is a trade-off. Gemini's media resolution setting controls the maximum tokens per image or video frame. Higher resolution helps read small text and fine detail, but costs more tokens and time.
  4. Video is sampled, not watched. At the default 1 frame per second, very fast action between frames can be missed. Timestamps (MM:SS) let you ask about, and check, specific moments.
  5. Big files go through the Files API. Inline data is limited to 20 MB for the whole request. For larger files, or files you'll reuse, upload them first and refer to them by URI.

Numbers change between models Token rates depend on the model and the media resolution you choose, and newer models add options (such as on-demand video processing). Use the API's count_tokens method, or the usage numbers in each response, rather than hard-coding these figures.

Go deeper

Words to know

1 min read
WordMeaning in simple words
MultimodalAble to take in more than one kind of input, such as text, images, audio and video
TokenA small piece the model works with. Text, images, audio and video are all turned into tokens
TileOne square piece of a large image. Each tile is counted as tokens
FrameOne still picture taken from a video
Media resolutionA setting for how many tokens each image or video frame may use
Files APIA way to upload a large file first and then point to it in your request

Check your understanding

1. How does Gemini handle a photo you send with a question?
2. Roughly how many tokens is a 2-minute audio clip in the Gemini API?
3. You need Gemini to read tiny print on a scanned form. What should you consider?
Sources: the official documentation4 links

Something wrong or unclear in this lesson? Tell us, it gets fixed.