Introduction
Google Gemini Embedding 2 maps multilingual text and documents into 3,072-dimensional dense vectors for semantic search and clustering.
| Field | Value |
|---|---|
| Input | Text |
| Output | Structured data |
| Dimensions | 3072 |
| Batch limits | 128 items · 300K tokens |
Key features & highlights
Dense 3072-dimensional representations
Gemini Embedding 2 from Google outputs floating-point vectors of 3072 dimensions ready for cosine similarity search, clustering, and reranking pipelines.
Single-text or homogeneous batch requests
Send Gemini Embedding 2 one passage or a batch of up to 128 strings or token arrays synchronously, preserving each vector's original input index.
Request parameters
| Parameter | Required | Description |
|---|---|---|
embedding_input | Yes | Pass a single string, a batch of up to 128 strings, or token ID arrays for Gemini Embedding 2; each returned vector keeps its input index. |
Pricing
$0.00017 / 1M input tokens
Gemini Embedding 2 is billed by measured input tokens.
Use cases
Semantic search and RAG indexing
Index knowledge bases and technical collections with Gemini Embedding 2 to retrieve relevant passages before passing context to a generation model.
Clustering and duplicate detection
Compare 3072-dimensional vectors from Gemini Embedding 2 to group similar tickets, articles, or code snippets.
Prompt guide & pro tips
Prompt guide & Pro tips
Use Gemini Embedding 2 for both document indexing and query embedding, keeping each Gemini Embedding 2 call within 128 items and 300,000 tokens and re-embedding when text changes.
Introduction
Google Gemini Embedding 2 maps multilingual text and documents into 3,072-dimensional dense vectors for semantic search and clustering.
Key features
Gemini Embedding 2 from Google outputs floating-point vectors of 3072 dimensions ready for cosine similarity search, clustering, and reranking pipelines.
Send Gemini Embedding 2 one passage or a batch of up to 128 strings or token arrays synchronously, preserving each vector's original input index.
Use cases
Index knowledge bases and technical collections with Gemini Embedding 2 to retrieve relevant passages before passing context to a generation model.
Compare 3072-dimensional vectors from Gemini Embedding 2 to group similar tickets, articles, or code snippets.
Usage tips
Use Gemini Embedding 2 for both document indexing and query embedding, keeping each Gemini Embedding 2 call within 128 items and 300,000 tokens and re-embedding when text changes.
API quick start
# Generate the idempotency key once; reuse it when retrying after a lost response.
export SPICY_IDEMPOTENCY_KEY="${SPICY_IDEMPOTENCY_KEY:-$(uuidgen)}"
curl -X POST https://api.spicyapi.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SPICY_IDEMPOTENCY_KEY" \
-d '{
"model": "google/gemini-embedding-2/embedding",
"input": {
"embedding_input": "The customer asks for a refund after being billed twice."
}
}'
# Copy data.taskId from the response into TASK_ID, then poll the status.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.spicyapi.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"
See the API reference for authentication, the complete schema, polling, and error handling.















