Gemini

gemini-embedding-2

GoogleToken-based
Alias:gemini-embedding-2-preview
Create API Key

Google 的向量模型,用于将输入内容转换为数值向量,支持语义检索和相似度计算。

textimageaudiovideofileembeddingscontext:8192
Starting price
Input / Output · 1M
Context
8.2K
Maximum input window
Modalities
→
Released
Apr 2026

Pricing by Supplier

Google AI Studio
谷歌官方接口
Input$0.2/ 1M
Output$0.8/ 1M
Image$0.45/ 1M
Audio In$6.5/ 1M
Google Vertex
谷歌官方接口
Input$0.22/ 1M
Output$0.88/ 1M
Image$0.495/ 1M
Audio In$7.15/ 1M

Capabilities / Supported modalities

Embeddings
Input
Output

Provider & data privacy

Provider
GoogleDocs
Tokenizer
SentencePiece (Gemini)
License
Proprietary (commercial)Proprietary
Data retention72 daysNot used for upstream training by default

Performance

About gemini-embedding-2

Google 的向量模型,用于将输入内容转换为数值向量,支持语义检索和相似度计算。

Use cases and prompting

Starting points for evaluation; supported inputs and options are listed in API access.

Use cases to explore

  • Evaluate semantic search with representative queries and documents.
  • Compare retrieval quality on your own knowledge base before connecting a downstream assistant.

Practical tips

Check whether the endpoint returns embeddings or reranks documents. Keep indexing and query preprocessing consistent.

API access

Code samples

RequestPOST/v1beta/models/gemini-embedding-2:generateContent
Example request
Parameters
ParameterTypeDefault / rangeDescription
inputrequired
string—Text or array of texts to embed
dimensions
integer>= 1Truncate embeddings to this many dimensions
encoding_format
enum
=float
Wire encoding for the embedding vectors
user
string—End-user identifier for abuse monitoring

Replace <YOUR_API_KEY> with the API key from your token settings.

Authentication

All requests must include Authorization: Bearer <TOKEN> header. Anthropic-formatted endpoints accept the x-api-key header instead.

Generate tokens from the Tokens page; you can scope them to specific models, groups, IPs, and rate-limits.

Supported parameters

Generation parameters
ParameterTypeDefault / rangeDescription
inputrequired
string—Text or array of texts to embed
dimensions
integer>= 1Truncate embeddings to this many dimensions
encoding_format
enum
=float
Wire encoding for the embedding vectors
user
string—End-user identifier for abuse monitoring

Rate limits

SupplierRPMTPMRPD
Google AI Studio4.4K875K88K
Google Vertex9.1K1.8M181K

RPM = requests per minute, TPM = tokens per minute, RPD = requests per day. Limits apply per token group.

Frequently asked questions about gemini-embedding-2

What is gemini-embedding-2?

Google 的向量模型,用于将输入内容转换为数值向量,支持语义检索和相似度计算。

How do I call gemini-embedding-2?

Create an API key with access to gemini-embedding-2, then use the exact model ID and a supported endpoint from the API access section. Request fields depend on the selected endpoint.

How is gemini-embedding-2 priced?

Pricing depends on the selected provider group and the model billing unit. The current input, output, request, or media prices are shown on this page before sign-up.

What is the context window of gemini-embedding-2?

The model catalog lists a context window of 8192 tokens. Check the selected endpoint for request limits.

How should I evaluate gemini-embedding-2 for my project?

Check whether the endpoint returns embeddings or reranks documents. Keep indexing and query preprocessing consistent.