Embeddings APIs Compared: OpenAI, Gemini, and Anthropic Guidance

Compare vector embedding APIs across OpenAI, Gemini, and Anthropic recommendation Voyage AI. Learn request shapes, context limits, dimensions, and task types.

By ailog · Published Oct 12, 2026 · 6 min read · How we work
In short
  • OpenAI provides text-embedding-3-small and text-embedding-3-large with native dimension truncation down to custom sizes.
  • Google provides gemini-embedding-001 and gemini-embedding-2, which unifies text, audio, images, video, and PDF documents into one vector space.
  • Anthropic does not offer its own embedding model and directs users to Voyage AI models hosted via MongoDB Atlas or AWS Marketplace.
  • Task prefixes and input roles significantly affect retrieval accuracy across both Gemini and Voyage AI implementations.

Embedding Providers at a Glance: Architectures and Core Models

Selecting an embedding provider shapes your entire vector retrieval pipeline, from chunk storage footprint to nearest-neighbor search speed. While OpenAI and Google offer first-party proprietary embedding APIs directly within their standard SDKs, Anthropic takes a distinct architectural route: it does not maintain an in-house embedding endpoint. Instead, Anthropic documentation directs developers toward external specialists, specifically recommending Voyage AI by MongoDB for retrieval tasks alongside Claude.

Across these three ecosystems, developers choose between general-purpose text representations, multimodal vectorization, and specialized domain models. OpenAI standardizes on its third-generation offerings: text-embedding-3-small and text-embedding-3-large, alongside the legacy text-embedding-ada-002. Google maintains gemini-embedding-001 for purely text workloads while offering gemini-embedding-2 as a unified multimodal embedding engine. Voyage AI provides a broad roster spanning voyage-4, voyage-4-large, voyage-4-lite, code-specific voyage-code-4, context-preserving voyage-context-4, and specialized options such as voyage-law-2 and voyage-finance-2.

Provider / Service Core Models Context Limit (Tokens) Default Dimensions Supported Modalities
OpenAI text-embedding-3-small, text-embedding-3-large 8192 1536 (small) / 3072 (large) Text
Google Gemini gemini-embedding-001, gemini-embedding-2 8192 3072 Text (001); Text, Image, Audio, Video, PDF (2)
Voyage AI (Anthropic Recommended) voyage-4, voyage-4-large, voyage-4-lite 32000 1024 Text, Code, Multimodal, Contextualized Chunks

Request Schemas and API Interaction Patterns

The mechanics of requesting an embedding differ substantially across client libraries. OpenAI routes requests through its embeddings endpoint, accepting an input string or list of strings and returning an array of floating-point numbers. Google requires calling embedContent via the genai client, processing payloads inside structured content blocks. Voyage AI provides a dedicated Python client that exposes the embed method or accepts HTTP POST payloads directed at the MongoDB Atlas endpoint at ai.mongodb.com.

For batch processing, behavioral differences emerge immediately. While text-embedding-3-small accepts an array of strings and outputs individual vectors per item, gemini-embedding-2 produces an aggregated vector across multiple inputs unless individual calls or batch workflows are configured. Voyage AI handles lists of strings natively within its client, returning a structured list of embedding vectors matched to original document indexes.

from openai import OpenAI

client = OpenAI()
response = client.embeddings.create(
    input="Your text string goes here",
    model="text-embedding-3-small"
)
vector = response.data[0].embedding
from google import genai

client = genai.Client()
result = client.models.embed_content(
    model="gemini-embedding-2",
    contents="What is the meaning of life?"
)
vector = result.embeddings
import voyageai

vo = voyageai.Client()
result = vo.embed(
    ["Sample text 1", "Sample text 2"],
    model="voyage-4",
    input_type="document"
)
vectors = result.embeddings

Context Limits, Dimensionality, and Matryoshka Truncation

Context length limits define chunking strategies. Both OpenAI third-generation models and Google Gemini embedding models enforce a maximum context input limit of 8192 tokens. In contrast, Voyage AI general-purpose models such as voyage-4, voyage-4-large, and voyage-4-lite provide a 32000 token context window. Specialized variants like voyage-context-4 extend this boundary to 120000 tokens when setting enable_auto_chunking to true, allowing extensive contextualized document chunking without external metadata stitching.

Vector dimensionality directly controls RAM consumption and search index storage costs. OpenAI models utilize Matryoshka-style representations, permitting developers to pass the dimensions parameter to truncate output vectors without losing concept-representing properties. For example, text-embedding-3-large defaults to 3072 dimensions but can be reduced to 1024 or 256. Manual slicing requires L2 vector normalization. On the MTEB evaluation benchmark, text-embedding-3-large reaches 64.6%, text-embedding-3-small scores 62.3%, and text-embedding-ada-002 records 61.0%.

Google also incorporates Matryoshka Representation Learning (MRL) across gemini-embedding-001 and gemini-embedding-2. Setting output_dimensionality to 768, 1536, or 3072 yields strong performance. Benchmark evaluations on MTEB for gemini-embedding-001 demonstrate 68.16 at 2048 dimensions, 68.17 at 1536 dimensions, 67.99 at 768 dimensions, 67.55 at 512 dimensions, 66.19 at 256 dimensions, and 63.31 at 128 dimensions. Gemini Embedding 2 automatically renormalizes truncated vectors, whereas gemini-embedding-001 requires manual L2 normalization. Voyage AI supports discrete dimensions including 1024, 256, 512, and 2048 for voyage-4, voyage-4-large, and voyage-4-lite, while normalizing output embeddings to unit length 1 by default.

Task Prefixes and Asymmetric Retrieval Optimization

Retrieval accuracy often degrades when engines cannot distinguish between queries and indexed passages. OpenAI does not require task labels or instruction prefixes during embedding generation, treating text inputs symmetrically. Conversely, both Gemini and Voyage AI emphasize asymmetric tuning to improve dense vector representations.

For gemini-embedding-001, Google exposes a dedicated task_type configuration field supporting values such as SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING, RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, CODE_RETRIEVAL_QUERY, QUESTION_ANSWERING, and FACT_VERIFICATION. In gemini-embedding-2, Google deprecates the task_type parameter in favor of explicit prompt formatting strings. Asymmetric search queries must be prefixed with task instruction text, while documents follow title and text demarcations.

  • Gemini asymmetric query format: task: search result | query: {content}
  • Gemini asymmetric document format: title: {title} | text: {content} (or title: none if unassigned)
  • Gemini question answering query format: task: question answering | query: {content}
  • Gemini symmetric classification format: task: classification | query: {content}
  • Voyage AI query prefix: prepends ’Represent the query for retrieving supporting documents: ’ when input_type=‘query’
  • Voyage AI document prefix: prepends ’Represent the document for retrieval: ’ when input_type=‘document’

Voyage AI manages this mechanism through its mandatory input_type parameter. Passing input_type=‘query’ or input_type=‘document’ automatically prepends standardized retrieval instructions to the underlying text before vectorization, generating specialized dense representations that outperform unparameterized calls.

Handling non-text assets requires evaluating distinct architectural approaches. OpenAI models are strictly limited to text strings. Developers requiring cross-modal search must consider Google Gemini or Voyage AI multimodal endpoints.

Google gemini-embedding-2 maps text, image, audio, video, and PDF documents into an identical vector space across over 100 languages under an aggregate token boundary of 8192 tokens. Requests can contain up to 6 PNG or JPEG images, up to 180 seconds of MP3 or WAV audio, up to 120 seconds of MP4 or MOV video (processed at up to 32 frames uniformly or 1 fps for clips under 32 seconds, excluding audio tracks), or a PDF document capped at 1 file with up to 6 pages. When using multimodal inputs, task prefix instructions are generally discouraged as they can diminish output consistency.

Voyage AI provides voyage-multimodal-3.5 with a 32000 token context window, supporting interleaved text, images, and video. It is invoked via multimodal_embed() rather than standard embed() calls. Voyage AI also offers the older voyage-multimodal-3 for text and content-rich images like PDF screenshots, slides, tables, and figures, as well as standalone rerankers like rerank-3 and rerank-3-lite for two-stage retrieval architectures.

Pricing Details and Infrastructure Implementation Checklist

Embedding workloads are billed based on input tokens. OpenAI measures consumption per input token, noting that $1 covers approximately 62,500 pages of text under text-embedding-3-small or 9,615 pages under text-embedding-3-large (assuming roughly 800 tokens per page), while the older text-embedding-ada-002 yields approximately 12,500 pages per dollar. To plan broader generation pipelines alongside embeddings, compare downstream generation costs on the /tools/llm-api-pricing/ table or calculate token budgets using /tools/llm-api-cost-calculator/.

Voyage AI offers its models via MongoDB Atlas model API keys, with Python library support in voyageai version 0.3.7 or later, TypeScript support pointing to ai.mongodb.com, and deployments through MongoDB seller profiles on AWS Marketplace. Developers seeking self-hosted open-weight alternatives can download voyage-4-nano under an Apache 2.0 license directly from Hugging Face.

  • Normalize vectors to unit length 1 before calculating similarity; dot-product search matches cosine similarity on normalized outputs.
  • Verify dimensionality targets: select 256, 768, 1024, or 1536 to balance vector index memory with retrieval accuracy.
  • Always include task_type or prefix instructions when executing asymmetric searches in gemini-embedding-2 or Voyage AI.
  • Evaluate chunk sizes against model context windows: 8192 tokens for OpenAI and Gemini, versus 32000 tokens for Voyage AI general models.
  • Confirm multi-tenant authentication setup: export OPENAI_API_KEY, GEMINI_API_KEY, or VOYAGE_API_KEY as appropriate.
Sources
  1. Embeddings
  2. Vector embeddings
  3. https://ai.google.dev/gemini-api/docs/embeddings

Related