models

Google: Gemini Embedding 2

Markdown · JSON

Google: Gemini Embedding 2

Gemini Embedding 2 maps text, images, audio, video and PDF into a shared numerical space. Its vectors support cross-modal search, retrieval, classification and clustering, with flexible dimensions and an 8,192-token input limit.

About the model

This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.

Gemini Embedding 2 is Google’s multimodal embedding model for numerical representation of text, images, video, audio and PDF. It maps the different media types into a shared space so that an application can compare meaning across them. The result is a vector of numbers, useful for semantic search, document retrieval, recommendation, classification or clustering; it is not a written answer or a generated media file. Google documents semantic coverage across more than 100 languages.

For a knowledge base, create vectors for the source passages, compare a user’s query with them and retrieve the relevant material. A separate text model can then compose an answer using those sources. For a media collection, a textual description can search for related images or video; an image can also supply the query. Preserve each vector’s connection to the original content, including a page or clip reference, so the retrieved result can be inspected and shown in its original context.

The overall input limit is 8,192 tokens. The stable model’s guide allows up to six PNG or JPEG images, up to 180 seconds of MP3 or WAV audio, and up to 120 seconds of MP4 or MOV video. Documented video codecs are H264, H265, AV1 and VP9. Video processing uses at most 32 frames: clips of up to 32 seconds are sampled at one frame per second, while longer clips are sampled uniformly to 32 frames. A video’s audio track is not processed in that video input; embed its sound separately when it matters to retrieval.

PDF input accepts one file with at most six pages. Google recommends one page per PDF for the best quality. Divide a larger source into meaningful pages or sections and retain their relationship to the original document. Choose an excerpt that represents what should be retrievable rather than combining unrelated materials only because they fit the limit. The shared token boundary still applies to a mixed-media request. Each PDF page consumes 258 visual tokens in addition to its extracted text tokens. In Google’s documented workflow, content exceeding the shared 8,192-token limit is truncated without an error.

Output dimensionality is flexible from 128 to 3,072, with 3,072 as the default and 768, 1,536 and 3,072 recommended sizes. The model uses Matryoshka Representation Learning, so prefixes of the vector remain useful at smaller dimensions. Its guide documents automatic normalisation for both the default and shortened vectors. Choose a consistent dimension for the records and queries that your application compares; the requested size changes the numerical representation, not the source content itself.

For text-only tasks, include the purpose in the text rather than using the older task_type field. Google distinguishes asymmetric retrieval from symmetric comparison. A search query uses “task: search result | query: {content}”, while a source document uses “title: {title} | text: {content}”; use “title: none” if it has no title. Question-answer, fact-checking and code-retrieval tasks have their own query prefixes. For classification, clustering or sentence similarity, use the same task format consistently for both sides. The guide generally advises against adding a task prefix to the text portion of a combined multimodal representation.

Input structure determines whether the result represents one combined object or separate items. Multiple parts supplied together create an aggregated embedding; separate Content objects create separate embeddings for each entry. For a post containing text and a picture, a combined representation can capture their relationship. For independently searchable records, keep them separate. This choice affects retrieval granularity: one vector for a whole post is different from one for each passage or image.

The guide states that vectors from Gemini Embedding 001 and Gemini Embedding 2 occupy incompatible spaces and cannot be compared directly. A collection migrated from the older model needs to be re-embedded for the new space. Keep model choice and dimensions consistent with the vectors being compared, and retain original text and media separately from the numerical index. An embedding’s similarity is a retrieval signal, rather than a factual explanation of why a document answers the user’s question.

For a practical catalogue, embed a product photograph together with its approved description when the pair should be retrieved as one object. For a document collection, embed focused passages and compare them with a purpose-formatted query, then present the source passages alongside the search result. For audio or video, choose the episode that describes the searchable event and retain its original time range. The useful deliverable is a numerical representation linked to source evidence for the application’s next search or analysis step.

Ailoot Ultra · Embeddings POST /v1/embeddings google/gemini-embedding-2

google/gemini-embedding-2

Google /google/gemini-embedding-2

Overview

Gemini Embedding 2 maps text, images, audio, video and PDF into a shared numerical space. Its vectors support cross-modal search, retrieval, classification and clustering, with flexible dimensions and an 8,192-token input limit.

Accepted inputs
Text · token_ids
Results
embedding

Available in Ailoot · inputs & methods

Ailoot Ultra · Embeddings POST /v1/embeddings
Input types
text, token_ids
Output types
embedding
Context
8,192 tokens
Output format
json
FieldTypeRequirementValues & limitsDefault
FieldmodelTypestringRequirementRequiredValues & limits
google/gemini-embedding-2
Default—
FieldinputTypestring|string[]|integer[]|integer[][]RequirementRequiredValues & limits
Minimum items: 1
Conditions: Nonempty homogeneous batch. Token IDs are nonnegative integers.
Input budget: Maximum: 8,192 · Text unit: UTF8 bytes · Token unit: token-array elements
Default—
Fieldencoding_formatTypestringRequirementOptionalValues & limits
float
Defaultfloat
FielddimensionsTypeintegerRequirementNot supportedValues & limits
Minimum: 1
Default—
FielduserTypejson_valueRequirementOptionalValues & limits
Conditions: Source allows this JSON metadata field; exact upstream semantics are model-specific.
Default—
Fieldsession_idTypejson_valueRequirementOptionalValues & limits
Conditions: Source allows this JSON metadata field; exact upstream semantics are model-specific.
Default—
FieldtraceTypejson_valueRequirementOptionalValues & limits
Conditions: Source allows this JSON metadata field; exact upstream semantics are model-specific.
Default—
FieldproviderTypeobjectRequirementOptionalValues & limits
Conditions: provider.options rejected
Default—
Input material combinations

text_to_embedding

Method parameters and lifecycle
ParameterContract
Parametercontent_typeContractapplication/json
ParameterrequiredContractmodel, input
Parameterinput_shapesContractstring, string[], nonnegative_integer_token_array, nonnegative_integer_token_array[]
Parameterencoding_formatContractfloat
Parameterdimensions_overrideContractfalse
Parametermax_input_budget_unitsContract8192
Parametermultimodal_objectsContractfalse
Parametermaterial_typesContracttext, token_ids

Lifecycle: synchronous_json

Keep every vector index and dimension.

Multimodal model name does not admit image objects on this exact path.

Pricing

Tariff references do not add request options. Supported parameters are listed for the selected method.

Fast mode
Standard rate When fast mode is selected
Flex mode
Standard rate When flex mode is selected
Maximum reasoning effort
Standard rate When maximum reasoning effort uses the default adjustment

Ailoot rates

Prices by configuration

ConfigurationRate scheduleCharge
ConfigurationBase token ratesRate scheduleBase rateCharge
Input · Input tokens $0.0004 / 1K tokens
Output · Output tokens $0 / 1K tokens
Input · Cache read — / 1K tokens
Input · Cache write — / 1K tokens
Input · Cache write, 1 hour — / 1K tokens

Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →

Example requests

Ailoot Ultra · Embeddings

curlPython SDK
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "google/gemini-embedding-2", "input": ["First document", "Second document"]}')

Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/embeddings \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
r=json.loads(Path("result.json").read_text())
for x in r.get("data",[]): print(json.dumps({"index":x.get("index"),"embedding":x.get("embedding")}))
PY_RESULT
from openai import OpenAI
import os

client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.embeddings.create(model='google/gemini-embedding-2',input=["First document","Second document"])
print(result)
for item in result.data:print(item.index,item.embedding)

Receive and save results

Ailoot Ultra · Embeddings

json

Keep all completed results

Keep every complete returned response, file and content part.

Keep every vector with its index. Vector count must equal input count; dimensions must be consistent.

If the original response needs checking

No embedding job endpoint is introduced.

Response fields
FieldType
FieldobjectTypestring
FieldmodelTypestring
Fielddata[].indexTypeinteger
Fielddata[].embeddingTypefinite float[]
FieldusageTypeobject
Errors and next steps
ResponseConditionNext step
Response400 · invalid_request_errorConditionInvalid required fields, material representation or parameter valueNext stepCorrect the indicated fields before a new creation request.

Aliases

Model aliases

Ailoot Ultra google/gemini-embedding-2

Method path aliases

Use the method paths shown above.

Related caller IDs

google/gemini-embedding-2

FAQ · Google: Gemini Embedding 2
What inputs and results are available?

POST /v1/embeddings · google/gemini-embedding-2: text, token_ids → embedding

Which fields does the request use?

POST /v1/embeddings · google/gemini-embedding-2: model, input, encoding_format, provider

What limits apply?

POST /v1/embeddings · google/gemini-embedding-2: ctx: 8192; input.budget.maximum: 8192 (UTF8 bytes); input.min_items: 1

More details

Connect Ailoot to Claude Code, OpenCode, Hermes or your own app.

The company and its project portfolio

The company and its project portfolio: millions of customers; monthly sales in the billions.

Buy tokens at a discount.

Subscription discounts for regular use. Promo codes offer up to 50% off token purchases.

Subscription
Choose a discounted plan for your regular requests.
Promo code: up to 50% off
Enter your code at checkout. The price updates to reflect the current promotion.
Spending in your history
The model, tokens and amount are recorded for each request.

Choose a subscription · View model prices

Connect the API to a product you sell.

Use Ailoot in SaaS, apps and bots under its official service offer and licence agreement. Request a reseller licence for resale.

Commercial application
Add text, image, video and audio generation to paid features in your service.
Reseller licence
Send a description of your project and how you provide access. Request written terms for use and resale.
Documents on the website
The service offer, licence agreement and data processing policy are available before you connect.

Request a reseller licence · Service offer and licence agreement