Gemini Embedding 2 is an AIHub route for Google’s newer embedding capability, including multimodal inputs where supported. Metadata avoids assigning dimensions or limits not stated by the active provider documentation.
Key strengths
- Multimodal embedding workflow
- Semantic retrieval
- Cross-modal similarity
- Managed Gemini access
Use cases
- Multimodal search
- RAG indexing
- Media similarity
- Recommendation features
Google's google/gemini-embedding-2 is a dense vector embedding model. It maps text into a semantic vector space optimized for retrieval, clustering, classification, recommendation, and RAG retrieval pipelines.
Compatible with the OpenAI `/embeddings` endpoint, returning numerical representations that measure semantic similarity between pieces of text. Well-suited for high-throughput indexing of large corpora at low cost.
google/gemini-embedding-2 is fully OpenAI-compatible — drop in your existing OpenAI Python or Node SDK and switch `baseURL` to `https://api.tokenlx.ai`. TokenLX transparently routes your requests to the optimal provider endpoint while preserving streaming, function-calling, and structured-output semantics.
Performance
Compare different providers across TokenLX · All locations.
Effective Pricing
Actual cost per million tokens across providers over the past 7 days.
Recent activity
Total usage per day on TokenLX (last 30 days).
Sample code & API
TokenLX normalizes requests and responses across providers. Use any OpenAI SDK or our native SDK.
import requests
headers = {
"Authorization": "Bearer sk-aihub-...",
"Content-Type": "application/json",
}
# Text embeddings
response_1 = requests.post(
"https://api.tokenlx.ai/v1/embeddings",
headers=headers,
json={"model": "gemini-embedding-2", "input": ["AIHub makes model routing simple."], "dimension": "1024", "encoding_format": "float"},
)
print(response_1.json())
# Multimodal embeddings
response_2 = requests.post(
"https://api.tokenlx.ai/v1/embeddings/multi",
headers=headers,
json={"model": "gemini-embedding-2", "input": [{"type": "text", "text": "A product photo"}, {"type": "image_url", "image_url": "https://example.com/product.jpg"}, {"type": "video_url", "video_url": "https://example.com/demo.mp4"}], "dimension": "1024", "enable_fusion": True},
)
print(response_2.json())Replace sk-aihubrouter-… with your key from the dashboard.