请先登录
立即登录RzenEmbed API
RzenEmbed 是一个兼容 OpenAI API 格式的多模态 Embedding 服务,支持将文本、图像、视频及图文混排内容转换为统一语义空间中的高维向量表示。
接入说明
- 仅支持
POST /v1/embeddings - 不支持
/models/interface - 模型名固定为
RzenEmbed - 与普通
/v1/embeddings模型的区别在于:输入内容通过texts、images、video、instruction、request_id等字段传入,而不是只依赖简单的input字符串 - 如果使用 OpenAI SDK,非标准字段需放在
extra_body中
请求地址
- Method:
POST - URL:
https://api.research.360.cn/v1/embeddings
请求头
| Header | 必填 | 说明 |
|---|---|---|
Authorization |
是 | Bearer <token> |
accept |
是 | 固定 application/json |
Content-Type |
是 | 固定 application/json |
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | 固定传 RzenEmbed |
input |
array | 否 | OpenAI SDK 占位参数,可传 [] |
dimensions |
int | 否 | 默认 2048,仅支持 256 / 512 / 768 / 1024 / 1536 / 2048 |
request_id |
string | 否 | 请求唯一标识,不传则自动生成 |
instruction |
string | 否 | 指令文本,默认 Represent the user's input. |
texts |
array[string] | 否 | 多模态文本输入,仅允许 1 条 |
images |
array[string] | 否 | 多模态图片输入,仅允许 1 张,支持 URL 或 Base64 |
video |
array[string] | 否 | 视频帧输入,支持 2 到 64 张图片,支持 URL 或 Base64 |
参数约束
texts、images、video至少提供一种texts最多 1 条images最多 1 张video需要 2 到 64 张图片帧- OpenAI SDK 调用时,
request_id、instruction、texts、images、video需通过extra_body传入
响应格式
响应遵循 OpenAI Embedding 对象结构,并额外返回 message、response_status、request_id 字段。
message = success表示请求正常response_status = 0表示服务成功request_id为本次请求唯一标识
{
"data": [
{
"embedding": [
-0.07196125388145447,
-0.0329570434987545,
0.0068786488845944405
],
"index": 0,
"object": "embedding"
}
],
"model": "RzenEmbed",
"object": "list",
"usage": {
"prompt_tokens": 1761,
"total_tokens": 1761
},
"message": "success",
"response_status": 0,
"request_id": "b978be6f-151d-4758-9fdc-b25e19019801"
}
调用示例
1. 单条文本 Embedding
curl --location 'https://api.research.360.cn/v1/embeddings' --header 'accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer your_key' --data '{
"model": "RzenEmbed",
"request_id": "5fe3f69f-e4df-47c9-8ceb-c5c3cbe65daf",
"dimensions": 2048,
"instruction": "Represent the user''s input.",
"texts": ["two apples"]
}'
import uuid
from openai import OpenAI
client = OpenAI(base_url="https://api.research.360.cn/v1", api_key="your_key")
response = client.embeddings.create(
model="RzenEmbed",
input=[],
dimensions=2048,
extra_body={
"request_id": str(uuid.uuid4()),
"texts": ["two apples"],
"instruction": "Represent the user's input."
}
)
print(response)
2. 单张图像 Embedding
curl --location 'https://api.research.360.cn/v1/embeddings' --header 'accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer your_key' --data '{
"model": "RzenEmbed",
"request_id": "5fe3f69f-e4df-47c9-8ceb-c5c3cbe65daf",
"dimensions": 2048,
"instruction": "Find me an everyday image that matches the given caption:",
"images": ["https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"]
}'
import uuid
from openai import OpenAI
client = OpenAI(base_url="https://api.research.360.cn/v1", api_key="your_key")
response = client.embeddings.create(
model="RzenEmbed",
input=[],
dimensions=2048,
extra_body={
"request_id": str(uuid.uuid4()),
"instruction": "Find me an everyday image that matches the given caption:",
"images": ["https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"]
}
)
print(response)
3. 单个视频 Embedding
curl --location 'https://api.research.360.cn/v1/embeddings' --header 'accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer your_key' --data '{
"model": "RzenEmbed",
"request_id": "5fe3f69f-e4df-47c9-8ceb-c5c3cbe65daf",
"dimensions": 2048,
"instruction": "Find me an everyday video that matches the given caption:",
"video": [
"https://p0.ssl.qhimg.com/d/inn/20b6511288e3/Catch_med_5/10000.jpg",
"https://p0.ssl.qhimg.com/d/inn/20b6511288e3/Catch_med_5/10001.jpg"
]
}'
import uuid
from openai import OpenAI
client = OpenAI(base_url="https://api.research.360.cn/v1", api_key="your_key")
response = client.embeddings.create(
model="RzenEmbed",
input=[],
dimensions=2048,
extra_body={
"request_id": str(uuid.uuid4()),
"instruction": "Find me an everyday video that matches the given caption:",
"video": [
"https://p0.ssl.qhimg.com/d/inn/20b6511288e3/Catch_med_5/10000.jpg",
"https://p0.ssl.qhimg.com/d/inn/20b6511288e3/Catch_med_5/10001.jpg"
]
}
)
print(response)
4. 图文混合 Embedding
curl --location 'https://api.research.360.cn/v1/embeddings' --header 'accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer your_key' --data '{
"model": "RzenEmbed",
"request_id": "5fe3f69f-e4df-47c9-8ceb-c5c3cbe65daf",
"dimensions": 2048,
"instruction": "Find me an everyday image that matches the given caption:",
"texts": ["two apples"],
"images": ["https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"]
}'
import uuid
from openai import OpenAI
client = OpenAI(base_url="https://api.research.360.cn/v1", api_key="your_key")
response = client.embeddings.create(
model="RzenEmbed",
input=[],
dimensions=2048,
extra_body={
"request_id": str(uuid.uuid4()),
"instruction": "Find me an everyday image that matches the given caption:",
"texts": ["two apples"],
"images": ["https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"]
}
)
print(response)
单条文本 Embedding
单张图像 Embedding
单个视频 Embedding
图文混合 Embedding
复制
Response
复制