Multimodal embedding API
Multimodal embedding models convert text, images, and videos into embeddings in a shared semantic space to enable cross-modal retrieval, content classification, and similarity search.
Core capabilities
- Cross-modal retrieval: Perform semantic searches across different content types, such as text-to-image, image-to-video, or image-to-image.
- Semantic similarity: Measure the semantic similarity between different content types in a unified embedding space.
- Content classification and clustering: Group, label, and cluster content based on semantic embeddings.
Key feature: Embeddings for all modalities (text, images, and video) share the same semantic space, enabling direct cross-modal matching and comparison using methods such as cosine similarity. See text and multimodal embedding for details on model selection and usage.
Embedding types
The multimodal embedding model supports two methods for generating embeddings:
-
Multimodal independent vectors: an independent vector is generated for each input (text, image, video, multiple images) in contents. For example, if you input 1 piece of text and 1 image, 2 independent vectors are returned. This is suitable for scenarios that compare different contents item by item, such as image-to-image search and text-to-image search.
-
Multimodal fused vectors: all inputs in contents are fused into 1 vector to achieve cross-modal comprehensive semantic representation. This is suitable for scenarios that require holistic understanding of multimodal content, such as fusing product images and description text into a unified representation for retrieval.
qwen3-vl-embeddingenables fusion mode by settingenable_fusion=true;tongyi-embedding-vision-plus-2026-03-06andtongyi-embedding-vision-flash-2026-03-06achieve fusion by placing text, image, and video in the same content object. Fused vectors support the following combinations:- Text + image fusion
- Text + video fusion
- Multiple images + text fusion (multiple image entries passed in)
- Image + video + text mixed fusion
qwen2.5-vl-embeddingsupports only fused embeddings, not independent embeddings.tongyi-embedding-vision-plusandtongyi-embedding-vision-flashsupport only independent embeddings.tongyi-embedding-vision-plus-2026-03-06andtongyi-embedding-vision-flash-2026-03-06support both independent embeddings and fused embeddings. You create fused embeddings by placing text, image, and video in the same content object.
For model introductions, selection guidance, and usage instructions, see Text and multimodal embedding.
Model overview
China (Beijing)
Model | Embedding dimensions | Text length limit | Image size limit | Video size limit | Price (per 1,000 tokens) | Free quota(Note) |
|---|---|---|---|---|---|---|
qwen3-vl-embedding | 2560 (default), 2048, 1536, 1024, 768, 512, 256 | 32,000 Token | Up to 10 MB per image | Up to 50 MB per video file | Image/Video: CNY 0.0018 Text: CNY 0.0007 | 1 million token This free quota is valid for 90 days from the date of Model Studio activation, model release, or application approval, whichever is later. |
qwen2.5-vl-embedding | 2048, 1024 (default), 768, 512 | Up to 5 MB per image | No free quota | |||
tongyi-embedding-vision-plus-2026-03-06 | 1152 (default), 1024, 512, 256, 128, 64 | 1,024 Token | Recommended: up to 5 MB per image; maximum: 10 MB. Supports up to 64 images. | Up to 50 MB per video file Video encoding must be H.264 or H.265. | CNY 0.0005 | No free quota |
tongyi-embedding-vision-flash-2026-03-06 | 768 (default), 512, 256, 128, 64 | CNY 0.00015 | No free quota | |||
tongyi-embedding-vision-plus | 1152 (default), 1024, 512, 256, 128, 64 | Up to 3 MB per image. Supports up to 8 images. | Up to 10 MB per video file | CNY 0.0005 | 1 million token This free quota is valid for 90 days from the date of Model Studio activation, model release, or application approval, whichever is later. | |
tongyi-embedding-vision-flash | 768 (default), 512, 256, 128, 64 | CNY 0.00015 | 1 million token This free quota is valid for 90 days from the date of Model Studio activation, model release, or application approval, whichever is later. | |||
multimodal-embedding-v1 | 1,024 | 512 Token | Up to 3 MB per image | Up to 10 MB per video file | Image/Video: CNY 0.0009 Text: CNY 0.0007 | No free quota |
Singapore
Model | Embedding dimensions | Text length limit | Image size limit | Video size limit | Price (per 1,000 tokens) |
|---|---|---|---|---|---|
tongyi-embedding-vision-plus | 1152 (default), 1024, 512, 256, 128, 64 | 1,024 Token | Up to 8 images, with each image no larger than 3 MB | Up to 10 MB per video file | CNY 0.0005 |
tongyi-embedding-vision-flash | 768 (default), 512, 256, 128, 64 | 1,024 Token | CNY 0.00015 |
Input formats and usage limits
| Fused multimodal models | ||||
|---|---|---|---|---|
| Model | Text | Image | Video | Request limit |
qwen3-vl-embedding | Supports 33 major languages, such as Chinese, English, Japanese, Korean, French, and German. All supported languages Chinese, Japanese, Korean, Indonesian, Vietnamese, Thai, English, French, German, Russian, Portuguese, Spanish, Italian, Swedish, Danish, Czech, Norwegian, Dutch, Finnish, Turkish, Polish, Swahili, Romanian, Serbian, Greek, Kazakh, Uzbek, Cebuano, Arabic, Urdu, Persian, Hindi / Devanagari, and Hebrew. | JPEG, PNG, WEBP, BMP, TIFF, ICO, DIB, ICNS, and SGI (URL or Base64 supported) | MP4, AVI, and MOV (URL only) | A single request can contain up to 20 content elements. This includes a maximum of 10 images and 1 video. |
qwen2.5-vl-embedding | Supports 11 major languages, such as Chinese, English, Japanese, Korean, French, and German. All supported languages Chinese, English, Japanese, Korean, French, German, Russian, Portuguese, Spanish, Italian, and Indonesian. | A single request can contain a maximum of one of each content type: image, text, video, and fused object. | ||
| Multimodal embedding models | ||||
| Model | Text | Image | Video | Request limit |
tongyi-embedding-vision-plus-2026-03-06 | Supports over 30 major languages, such as Chinese, English, Japanese, and Korean. All supported languages Chinese, Japanese, Korean, Indonesian, Vietnamese, Thai, English, French, German, Russian, Portuguese, Spanish, Italian, Swedish, Danish, Czech, Norwegian, Dutch, Finnish, Turkish, Polish, Swahili, Romanian, Serbian, Greek, Kazakh, Uzbek, Cebuano, Arabic, Urdu, Persian, Hindi / Devanagari, and Hebrew. | JPEG, PNG, WEBP, BMP, TIFF, ICO, DIB, ICNS, and SGI (URL or Base64 supported) | MP4, MPEG, MOV, MPG, WEBM, AVI, FLV, and MKV (URL only) | A single request can contain up to 20 content elements in total, with a maximum of 64 images and 8 videos. |
tongyi-embedding-vision-flash-2026-03-06 | ||||
tongyi-embedding-vision-plus | Chinese and English | JPG, PNG, and BMP (URL or Base64 supported) | MP4, MPEG, MOV, MPG, WEBM, AVI, FLV, and MKV (URL only) | No limit on the number of content elements. The total number of input tokens must not exceed the batch processing limit. |
tongyi-embedding-vision-flash | ||||
multimodal-embedding-v1 | Chinese and English | JPG, PNG, and BMP (URL or Base64 supported) | A single request is limited to 20 content elements. This limit is shared among a maximum of 1 image, 1 video, and 20 text elements. | |
All models accept text, image, and video inputs, individually or in combination.
tongyi-embedding-vision-plus,tongyi-embedding-vision-flash,tongyi-embedding-vision-plus-2026-03-06, andtongyi-embedding-vision-flash-2026-03-06models also supportmulti_imagesfor image sequences.
Model capabilities
Model | Default dimension | Vector type | Supported inputs | Description |
qwen3-vl-embedding | 2560 | Independent / Fusion | text, image, video, multiple images | Fusion mode, enabled with the |
qwen2.5-vl-embedding | 1024 | Fusion only | text、image、video | Always returns a single fused vector. Independent vectors and multi-image inputs are not supported. |
tongyi-embedding-vision-plus-2026-03-06 | 1152 | Independent / Fusion | text、image、video、multi_images | Based on the Qwen3 foundation model. Supports multiple resolutions, 30+ languages, and fused vectors. |
tongyi-embedding-vision-flash-2026-03-06 | 768 | |||
tongyi-embedding-vision-plus | 1152 | Independent only | Supports the multi_images multi-image sequence (up to 8 images) | |
tongyi-embedding-vision-flash | 768 | |||
multimodal-embedding-v1 | 1024 | text、image、video | The vector dimension is fixed at 1,024 and cannot be configured. |
Prerequisites
Obtain an API key and export the API key as an environment variable. If you use an SDK to make calls, install the DashScope SDK.
HTTP call
POST https://dashscope.aliyuncs.com/api/v1/services/embeddings/multimodal-embedding/multimodal-embedding
Request | Multimodal independent embedding
Multimodal fused embedding
2026-03-06 snapshot example
The following example shows how to use the 2026-03-06 version to generate a fused embedding. By placing text, image, and video in the same content object, the model combines all inputs into a single embedding of type |
Request headers | |
Content-Type The content type of the request. Must be | |
Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. | |
Request body | |
model The model name. Select a model from the Model overview. | |
input The input content. parameters Embedding processing parameters. For HTTP calls, you must wrap these parameters in the parameters object. For SDK calls, you can use these parameters directly. |
Response | Successful responseNoteThe
Note
Error responseThe following table lists common error codes for this API and troubleshooting suggestions. For the complete list of error codes, see Error codes.
| ||||||||||||||||||||||||||||||||
output Task output. | |||||||||||||||||||||||||||||||||
request_id Unique request identifier for tracing and troubleshooting. | |||||||||||||||||||||||||||||||||
code Error code. Returned only for failed requests. See Error codes. | |||||||||||||||||||||||||||||||||
message Detailed error message. Returned only for failed requests. See Error codes. | |||||||||||||||||||||||||||||||||
usage Statistics about token usage. |
SDK usage
The input parameter of the SDK corresponds to input.contents in the HTTP request body, and the two have inconsistent structures.
Code examples
Image embedding
Image URL
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 实际使用中请将url地址替换为您的图片url地址
image = "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
input = [{'image': image}]
try:
# 调用模型接口
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus",
input=input
)
# 向量结果:resp.embeddings[i].embedding 为向量数组,resp.embeddings[i].index 为输入序号
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
Local image
To generate an embedding from a local image, convert the image to a Base64 string:
import os
import base64
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 读取图片并转换为Base64,实际使用中请将xxx.png替换为您的图片文件名或路径
image_path = "xxx.png"
with open(image_path, "rb") as image_file:
# 读取文件并转换为Base64
base64_image = base64.b64encode(image_file.read()).decode('utf-8')
# 设置图像格式
image_format = "png" # 根据实际情况修改,比如jpg、bmp 等
image_data = f"data:image/{image_format};base64,{base64_image}"
# 输入数据
input = [{'image': image_data}]
try:
# 调用模型接口
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus",
input=input
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
Video embedding
Currently, the model only supports video input via URL. Local video files are not supported.
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 实际使用中请将url地址替换为您的视频url地址
video = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250107/lbcemt/new+video.mp4"
input = [{'video': video}]
try:
# 调用模型接口
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus",
input=input
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
Text embedding
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用阿里云百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
text = "通用多模态表征模型示例"
input = [{'text': text}]
try:
# 调用模型接口
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus",
input=input
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
Fused embedding
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 多模态融合向量:将文本、图片、视频融合成一个融合向量
# 适用于跨模态检索、图搜等场景
text = "这是一段测试文本,用于生成多模态融合向量"
image = "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
video = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250107/lbcemt/new+video.mp4"
# 输入包含文本、图片、视频,通过 enable_fusion 参数生成融合向量
input_data = [
{"text": text},
{"image": image},
{"video": video}
]
try:
# 使用 qwen3-vl-embedding 生成融合向量
resp = client.multimodal.embeddings.create(
model="qwen3-vl-embedding",
input=input_data,
enable_fusion=True,
# 可选参数:指定向量维度(支持 2560、2048、1536、1024、768、512、256,默认 2560)
# dimension=1024
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
Multi-image fused embedding
Use qwen3-vl-embedding to fuse multiple images and text into a single embedding. To fuse multiple images, pass multiple image items. This is ideal for semantic retrieval using multi-angle product images and a text description.
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 多图+文本融合向量:将多张商品图片和描述文本融合为 1 个向量
# 适用于商品多角度图片+描述文本的综合语义检索
text = "白色运动鞋,轻量透气,适合跑步和日常穿着"
image1 = "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
image2 = "https://img.alicdn.com/imgextra/i3/O1CN01rdstgY1uiZWt8gqSL_!!6000000006071-0-tps-1970-356.jpg"
# 传入多个 image 条目实现多图融合,enable_fusion=True 将所有输入融合为 1 个向量
input_data = [
{"text": text},
{"image": image1},
{"image": image2}
]
try:
resp = client.multimodal.embeddings.create(
model="qwen3-vl-embedding",
input=input_data,
enable_fusion=True
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
2026-03-06 snapshot example
This example shows how to use the
tongyi-embedding-vision-plus-2026-03-06model and itsres_level(resolution) andmax_video_frames(video frames) parameters. Built on the Qwen3 foundation, this model supports 30+ languages and generates both independent and fused embeddings.
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# tongyi-embedding-vision-plus-2026-03-06 示例
# 支持 res_level(多分辨率)和 max_video_frames(视频帧数)参数
image = "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
video = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250107/lbcemt/new+video.mp4"
text = "这是1个视觉多模态表征模型"
input_data = [
{"text": text},
{"image": image},
{"video": video}
]
try:
# 调用 2026-03-06 快照版本模型
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus-2026-03-06",
input=input_data,
dimension=1152, # 支持 1152/1024/512/256/128/64
res_level=1, # 分辨率档位:0/1/2/3,默认 1
max_video_frames=64 # 视频最大采样帧数,默认 8,最大 64
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
To generate a fused embedding with the 2026-03-06 version, place text, image, and video in the same content object. The model fuses all inputs into a single embedding with the type fused.
import os
import dashscope
from dashscope import DashScopeError
# 以下为华北2(北京)地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
client = dashscope.Client(
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx",
# 各地域的API Key不同。获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="cn-beijing",
)
# 融合向量:将 text/image/video 放在同一个 content 对象中
# 模型会将所有输入融合编码为 1 个向量,type 为 "fused"
text = "白色运动鞋,轻量透气,适合跑步和日常穿着"
image = "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
# 同一对象中的多模态内容会被融合为 1 个向量
input_data = [
{"text": text, "image": image}
]
try:
resp = client.multimodal.embeddings.create(
model="tongyi-embedding-vision-plus-2026-03-06",
input=input_data,
dimension=1152
)
print(resp.model_dump_json(indent=4))
except DashScopeError as e:
print(f"HTTP返回码:{e.status_code}")
print(f"错误码:{e.code}")
print(f"错误信息:{e.message}")
print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
dashscope CLI
export DASHSCOPE_API_KEY="your-api-key"
# 将 {WorkspaceId} 替换为业务空间ID;该模型仅在北京和新加坡地域提供,使用新加坡时将 cn-beijing 替换为 ap-southeast-1
export DASHSCOPE_HTTP_BASE_URL="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1"
dashscope multimodal-embedding create -m tongyi-embedding-vision-plus --text "你好世界"
ImportantThe SDK Expert interactive assistant can accomplish the same development and troubleshooting in natural language. See
DashScope SDK Expert.For the complete region table, see Base URL overview.
Output example
{
"request_id": "40532987-ba72-42aa-a178-bb58b52fb7f3",
"embeddings": [
{
"index": 0,
"embedding": [
-0.009490966796875,
-0.024871826171875,
-0.031280517578125,
...
],
"type": "text"
}
],
"usage": {
"input_tokens": 10,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 10
},
"output_tokens": 1,
"total_tokens": 11
}
}
Error codes
If the model call fails and returns an error message, see Error codes for resolution.