Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Google - API - verified

Gemini Embedding 2 embeddings

Gemini Embedding 2 is a current embedding model from Google, called by API as gemini-embedding-2. It returns 3,072-dimension vectors by default and accepts up to 8,192 input tokens, for text, image, audio, video and PDF input. The first-party list price is $0.20 per 1M input tokens ($0.10 through the batch API).

CurrentModel id: gemini-embedding-2

Default dims
3,072
Max input
8,192 tok
Price / 1M
$0.20
Inputs
Text, Image, Audio, Video, PDF

Dimensions

Flexible output size
  • 3,072default
  • 1,536
  • 768

Default output: 3,072 dimensions.

Listed sizes: 3,072, 1,536 and 768.

Google documents shorter output vectors for this model (Matryoshka-style), so you can store smaller embeddings by asking for fewer dimensions instead of re-embedding with another model.

Pricing

Per 1M input tokens
$0.20
Batch, per 1M
$0.10

Gemini API paid tier text input; image $0.45, audio $6.50 and video $12.00 per 1M tokens (Batch is half), free tier available; Vertex AI lists the same rates labelled Preview.

Source: ai.google.dev/gemini-api/docs/pricing

Usage

Copied verbatim from the page linked below. Placeholders such as project ids and API keys are the source's own.

Python
from google import genai

client = genai.Client()

result = client.models.embed_content(
        model="gemini-embedding-2",
        contents="What is the meaning of life?"
)

print(result.embeddings)

Source: ai.google.dev/gemini-api/docs/embeddings

Worth knowing

The task_type parameter is not supported, so task instructions go in the prompt (for example task: search result | query: {content}), and its embedding space is incompatible with gemini-embedding-001.

Released . Multilingual: yes.

FAQ

How many dimensions does Gemini Embedding 2 output?

Default output: 3,072 dimensions. Listed sizes: 3,072, 1,536 and 768. Google documents shorter output vectors for this model (Matryoshka-style), so you can store smaller embeddings by asking for fewer dimensions instead of re-embedding with another model.

What is the max input length of Gemini Embedding 2?

8,192 tokens per input, per Google's documentation. Longer text has to be chunked before you embed it.

How much does Gemini Embedding 2 cost?

The first-party list price is $0.20 per 1M input tokens ($0.10 through the batch API). Gemini API paid tier text input; image $0.45, audio $6.50 and video $12.00 per 1M tokens (Batch is half), free tier available; Vertex AI lists the same rates labelled Preview. Source: https://ai.google.dev/gemini-api/docs/pricing.

What can Gemini Embedding 2 embed?

Text, image, audio, video and PDF input, per the provider. It is documented as multilingual.

Sources

Last verified from the pages below.

More Google embedding models

Default dimensions, max input tokens and list price per 1M tokens.

Google API modelsPrices per 1M tokens, context windows and specs for every Google model in the API registry.

All embedding models

Newsletter

New models, every week

One email per week. New model releases, embedding and retrieval updates and what they mean for what you build.