from openai import OpenAIclient = OpenAI( base_url="https://gateway.vlm.run/openai", api_key="<VLMRUN_API_KEY>",)response = client.embeddings.create( model="qwen/qwen3-vl-embedding-2b", input="Extract a vector representation for this text.",)print(len(response.data[0].embedding))
import OpenAI from "openai";const client = new OpenAI({ baseURL: "https://gateway.vlm.run/openai", apiKey: process.env.VLMRUN_API_KEY,});const response = await client.embeddings.create({ model: "qwen/qwen3-vl-embedding-2b", input: "Extract a vector representation for this text.",});console.log(response.data[0].embedding.length);
vlmrun gw embed -t "Extract a vector representation for this text." \ -m qwen/qwen3-vl-embedding-2b
curl https://gateway.vlm.run/openai/embeddings \ -X POST \ -H "Authorization: Bearer $VLMRUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen/qwen3-vl-embedding-2b", "input": "Extract a vector representation for this text." }'
OpenAI-compatible text, image, video, audio, and PDF inputs
POST
/
openai
/
embeddings
from openai import OpenAIclient = OpenAI( base_url="https://gateway.vlm.run/openai", api_key="<VLMRUN_API_KEY>",)response = client.embeddings.create( model="qwen/qwen3-vl-embedding-2b", input="Extract a vector representation for this text.",)print(len(response.data[0].embedding))
import OpenAI from "openai";const client = new OpenAI({ baseURL: "https://gateway.vlm.run/openai", apiKey: process.env.VLMRUN_API_KEY,});const response = await client.embeddings.create({ model: "qwen/qwen3-vl-embedding-2b", input: "Extract a vector representation for this text.",});console.log(response.data[0].embedding.length);
vlmrun gw embed -t "Extract a vector representation for this text." \ -m qwen/qwen3-vl-embedding-2b
curl https://gateway.vlm.run/openai/embeddings \ -X POST \ -H "Authorization: Bearer $VLMRUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen/qwen3-vl-embedding-2b", "input": "Extract a vector representation for this text." }'
Omit the Authorization header for anonymous access.Per-tier quotas are on Rate Limits. This route shares those quotas with chat completions.Model ids are on Models.
Request parameters
Field
Type
Default
Description
model
string
required
Embedding model id, e.g. qwen/qwen3-vl-embedding-2b or google/embeddinggemma-2.
input
string, array of strings, array of token ids, or array of content parts
required
Text, or text / image_url / video_url / audio_url / input_audio / document_url / file content parts. A list of lists is a batch. See below.
encoding_format
string
float
float or base64.
dimensions
integer
model default
Truncate the output vector to fewer dimensions, if the model supports it.
Pages of a document_url part to read: indices, or [start, stop] ranges.
document_max_pages
integer
model cap
Pages one document may add to an input.
truncate_prompt_tokens
integer
null
Truncate long inputs to this many tokens instead of erroring.
user
string
null
Opaque end-user identifier, accepted for OpenAI SDK compatibility.
Each model lists the extra fields it reads in supported_parameters on GET /openai/models.
Text input
from openai import OpenAIclient = OpenAI( base_url="https://gateway.vlm.run/openai", api_key="<VLMRUN_API_KEY>",)response = client.embeddings.create( model="qwen/qwen3-vl-embedding-2b", input="Extract a vector representation for this text.",)print(len(response.data[0].embedding))
import OpenAI from "openai";const client = new OpenAI({ baseURL: "https://gateway.vlm.run/openai", apiKey: process.env.VLMRUN_API_KEY,});const response = await client.embeddings.create({ model: "qwen/qwen3-vl-embedding-2b", input: "Extract a vector representation for this text.",});console.log(response.data[0].embedding.length);
vlmrun gw embed -t "Extract a vector representation for this text." \ -m qwen/qwen3-vl-embedding-2b
curl https://gateway.vlm.run/openai/embeddings \ -X POST \ -H "Authorization: Bearer $VLMRUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen/qwen3-vl-embedding-2b", "input": "Extract a vector representation for this text." }'
qwen/qwen3-vl-embedding-2b accepts one image_url part and one video_url part per input. It reads 8 frames sampled from the video.google/embeddinggemma-2 accepts image_url and video_url parts. Its own processor samples the video. video_fps and video_max_frames set its sampling.Image and video vectors share the text vector space.google/embeddinggemma-2 also accepts audio_url, input_audio, and document_url parts. The model reads at most the first 30 seconds of each audio part. A PDF’s pages pool into one vector. All parts in one input share one 8,192-token window. An input past the window is a 400 that names it. Nothing is truncated.Check capabilities.supported_input_types on GET /openai/models before using a modality.Not every embedding model accepts images or video.
google/embeddinggemma-2 is trained with a short prefix on text inputs. Set it with prompt_name. Unset, or none, adds no prefix, so the vectors match the same model run elsewhere with no prompt. A wrong prefix still returns a vector, at lower precision. An unknown name is a 400.
prompt_name
Task
Pair with
SearchQuery
Web and document search
Document
QuestionAnswering
Question answering
Document
FactChecking
Fact checking
Document
CodeRetrieval
Code search
Document
Classification
Text classification
itself
Clustering
Clustering
itself
SentenceSimilarity
Semantic similarity
itself
dimensions takes 768, 512, 256, or 128. The shorter vector is re-normalized. Queries and documents must share one value.
from openai import OpenAIclient = OpenAI( base_url="https://gateway.vlm.run/openai", api_key="<VLMRUN_API_KEY>",)response = client.embeddings.create( model="google/embeddinggemma-2", input="What causes the northern lights?", dimensions=256, extra_body={"prompt_name": "SearchQuery"},)print(len(response.data[0].embedding))
A 200 debits your organization by usage.cost. The cost is usage.prompt_tokens multiplied by the model’s prompt price per 1M tokens, rounded to six decimals.
Model
Prompt price
Minimum per call
google/embeddinggemma-2
$0.018 / 1M tokens
$0.000005
qwen/qwen3-vl-embedding-2b
$0.02 / 1M tokens
None
usage.prompt_tokens counts every token the model read, media included. On google/embeddinggemma-2, an image or a PDF page reads 220 to 268 tokens and a video frame 78 to 133, by aspect ratio. For example, 1,000 images at 268 tokens each are 268,000 tokens, which is about $0.0048. A short text input on qwen/qwen3-vl-embedding-2b can show "cost": 0.0, as in the first example. Prices per model are on Models.A free-plan organization with a negative balance, or an organization with an overdue payment, gets a 402, as on chat completions. Calls without an API key count toward the same daily anonymous spend cap as chat.
Related
Models
Available embedding models.
Supported Inputs
Content part types shared across chat and embeddings.
Authorizations
Authorization
string
header
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
OpenAI-compatible embeddings request.
The input field is intentionally polymorphic to match both
OpenAI's API (string / list-of-strings / list-of-token-ids) and
vLLM's multimodal extension (list of content parts). The router
normalises everything to a list of items before handing it to the
backend, so individual backends only see one shape.