from openai import OpenAI
client = OpenAI(
base_url="https://gateway.vlm.run/v1/openai",
api_key="<VLMRUN_API_KEY>",
)
response = client.embeddings.create(
model="<embedding-model-id>",
input="Extract a vector representation for this text.",
)
print(len(response.data[0].embedding))
curl https://gateway.vlm.run/v1/openai/embeddings \
-X POST \
-H "Authorization: Bearer $VLMRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<embedding-model-id>",
"input": "Extract a vector representation for this text."
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.vlm.run/v1/openai",
apiKey: process.env.VLMRUN_API_KEY,
});
const response = await client.embeddings.create({
model: "<embedding-model-id>",
input: "Extract a vector representation for this text.",
});
console.log(response.data[0].embedding.length);
{
"model": "<string>",
"data": [
{
"index": 123,
"embedding": [
123
],
"object": "embedding"
}
],
"id": "<string>",
"object": "list",
"created": 123,
"served_model_id": "<string>",
"backend": "<string>",
"usage": {
"prompt_tokens": 0,
"total_tokens": 0
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}API Reference
Embeddings
OpenAI-compatible embeddings for text and image inputs
POST
/
v1
/
openai
/
embeddings
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.vlm.run/v1/openai",
api_key="<VLMRUN_API_KEY>",
)
response = client.embeddings.create(
model="<embedding-model-id>",
input="Extract a vector representation for this text.",
)
print(len(response.data[0].embedding))
curl https://gateway.vlm.run/v1/openai/embeddings \
-X POST \
-H "Authorization: Bearer $VLMRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<embedding-model-id>",
"input": "Extract a vector representation for this text."
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.vlm.run/v1/openai",
apiKey: process.env.VLMRUN_API_KEY,
});
const response = await client.embeddings.create({
model: "<embedding-model-id>",
input: "Extract a vector representation for this text.",
});
console.log(response.data[0].embedding.length);
{
"model": "<string>",
"data": [
{
"index": 123,
"embedding": [
123
],
"object": "embedding"
}
],
"id": "<string>",
"object": "list",
"created": 123,
"served_model_id": "<string>",
"backend": "<string>",
"usage": {
"prompt_tokens": 0,
"total_tokens": 0
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Send
Authorization: Bearer vlmrun for anonymous access. See
Rate Limits for per-tier quotas, which this route shares
with chat completions. For available embedding models, see Models.
Request parameters
| Field | Type | Default | Description |
|---|---|---|---|
model | string | required | Embedding model id, e.g. qwen/qwen3-vl-embedding-2b. |
input | string, array of strings, or array of content parts | required | Text, or text / image_url / video_url content parts for multimodal embeddings. 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. |
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. |
Text input
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.vlm.run/v1/openai",
api_key="<VLMRUN_API_KEY>",
)
response = client.embeddings.create(
model="<embedding-model-id>",
input="Extract a vector representation for this text.",
)
print(len(response.data[0].embedding))
curl https://gateway.vlm.run/v1/openai/embeddings \
-X POST \
-H "Authorization: Bearer $VLMRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<embedding-model-id>",
"input": "Extract a vector representation for this text."
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.vlm.run/v1/openai",
apiKey: process.env.VLMRUN_API_KEY,
});
const response = await client.embeddings.create({
model: "<embedding-model-id>",
input: "Extract a vector representation for this text.",
});
console.log(response.data[0].embedding.length);
Multimodal input
Vision-language embedding models such asqwen/qwen3-vl-embedding-2b also
accept image_url and video_url content parts in input, so you can embed
images or sampled video frames into the same vector space as text, for example
to build visual search or image-to-text retrieval. Confirm accepted input types
in a model’s capabilities.supported_input_types on
GET /v1/openai/models before relying
on a modality, since not every embedding model on the catalog accepts images
or video.
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.vlm.run/v1/openai",
api_key="<VLMRUN_API_KEY>",
)
response = client.embeddings.create(
model="qwen/qwen3-vl-embedding-2b",
input=[
{
"type": "image_url",
"image_url": {
"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg"
},
}
],
)
print(len(response.data[0].embedding))
curl https://gateway.vlm.run/v1/openai/embeddings \
-X POST \
-H "Authorization: Bearer $VLMRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-vl-embedding-2b",
"input": [
{
"type": "image_url",
"image_url": {
"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg"
}
}
]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://gateway.vlm.run/v1/openai",
apiKey: process.env.VLMRUN_API_KEY,
});
const response = await client.embeddings.create({
model: "qwen/qwen3-vl-embedding-2b",
input: [
{
type: "image_url",
image_url: {
url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg",
},
},
],
});
console.log(response.data[0].embedding.length);
Related
Models
Available embedding models.
Multimodal Inputs
Content part types shared across chat and embeddings.
Authorizations
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.
input
stringstring[]integer[]integer[][]EmbeddingContentPart · object[]EmbeddingContentPart · object[][](string | EmbeddingContentPart · object[])[]
required
Available options:
float, base64 Response
Successful Response
OpenAI-compatible embeddings response with audit extras
(served_model_id and backend).
Allowed value:
"list"