Skip to content
GoogleEmbedding

Gemini Embedding 2

gemini-embedding-2-preview

Gemini Embedding 2 is Google's advanced text embedding model designed for high-accuracy semantic representation across large-scale retrieval and understanding tasks. It converts text into dense vector embeddings optimized for semantic search, retrieval-augmented generation (RAG), clustering, classification, and recommendation systems. Built for production use, it offers strong multilingual support, improved semantic similarity accuracy, and efficient embedding generation, making it well suited for large knowledge indexing pipelines and enterprise-scale retrieval applications.

Context
8.2K tokens
Endpoint

Get API KeyCompare

Pricing

Input$0.60 / 1M
Output$2.40 / 1M
Cache Write (5m)$0.60 / 1M
Cache Write (1h)$0.60 / 1M
Cache Read$0.60 / 1M

Quick Start

Select an endpoint and copy a working example for this model.

Endpoint
python
from openai import OpenAI client = OpenAI(    api_key="YOUR_API_KEY",    base_url="https://api.apertis.ai/v1") response = client.chat.completions.create(    model="gemini-embedding-2-preview",    messages=[        {"role": "user", "content": "Hello!"}    ],    max_tokens=1024,    temperature=0.7) print(response.choices[0].message.content) # Optional: Enable context compression to reduce token usage# response = client.chat.completions.create(#     model="gemini-embedding-2-preview",#     messages=[{"role": "user", "content": "Hello!"}],#     extra_body={"compression": {"enabled": True, "model": "gpt-4.1-mini"}}# )

Supported Parameters

API docs
Common4 params
modelinputencoding_formatdimensions
Extended1 param
user

Cursor IDE Model IDs

Use these namespaced identifiers in Cursor IDE to avoid conflicts with built-in models.

gemini-embedding-2-preview

Compare with Other Models

See how this model compares to others from the same provider.