DeepInfra raises $107M Series B to scale the inference cloud — read the announcement

google logo

google/

embeddinggemma-2

$0.020

/ 1M tokens

EmbeddingGemma 2 is a 740M parameter multimodal embedding model from Google DeepMind that maps text (incl. code), images, video and audio, alone or interleaved, into a single 768-dimensional vector space, with task prompts and Matryoshka truncation to 512, 256 or 128 dimensions for search, retrieval, classification and clustering.

Public
Zero retention
8,192
Multimodal
google/embeddinggemma-2 cover image
demo

OpenAI-compatible HTTP API

DeepInfra supports the OpenAI embeddings API. This model embeds text, images, audio and video into one vector space: each item of input is a string, or a list of content parts that are embedded together in order.

curl "https://api.deepinfra.com/v1/openai/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPINFRA_API_KEY" \
  -d '{
    "model": "google/embeddinggemma-2",
    "input": [
      "Waterproof trail running shoes",
      [
        {"type": "text", "text": "Product photo:"},
        {"type": "image_url", "image_url": {"url": "https://example.com/shoe.jpg"}}
      ],
      [
        {"type": "audio_url", "audio_url": {"url": "https://example.com/clip.mp3"}}
      ]
    ],
    "task": "document",
    "dimensions": 768,
    "encoding_format": "float"
  }'
copy

Content parts: text, image_url, input_audio ({"data": "<base64>", "format": "wav"}), audio_url and video_url. URLs can be https:// or data:<mime>;base64,....

task selects the model's instruction for items that contain text: search_query, document, question_answering, fact_checking, code_retrieval, classification, clustering or sentence_similarity. Embed queries with search_query and the corpus with document. dimensions can be 768, 512, 256 or 128; vectors are always L2-normalized.

which will return one embedding per input item

{
  "object": "list",
  "data": [
    {"object": "embedding", "index": 0, "embedding": [-0.0105, -0.0026, ..., 0.0202]},
    {"object": "embedding", "index": 1, "embedding": [0.0123, -0.0311, ..., -0.0087]},
    {"object": "embedding", "index": 2, "embedding": [-0.0402, 0.0071, ..., 0.0158]}
  ],
  "model": "google/embeddinggemma-2",
  "usage": {"prompt_tokens": 362, "total_tokens": 362}
}
copy

Each image costs about 270 tokens, audio 25 tokens per second (clips up to 30 s), and video about 140 tokens per frame sampled at 1 frame per second (up to 32 frames). An item can hold up to 8,192 tokens.

Input fields

Input Schema

Output Schema