curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "embedding-3",
"input": "<string>"
}'
{
"model": "<string>",
"object": "list",
"data": [
{
"index": 123,
"object": "embedding",
"embedding": [
123
]
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}
使用 GLM 嵌入模型将文本转换为高维向量表示,用于语义相似性和搜索。支持多语种和多种模型,兼容 OpenAI Embedding API。
curl --request POST \
--url https://open.bigmodel.cn/api/paas/v4/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "embedding-3",
"input": "<string>"
}'
{
"model": "<string>",
"object": "list",
"data": [
{
"index": 123,
"object": "embedding",
"embedding": [
123
]
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}
使用以下格式进行身份验证:Bearer <your api key>
业务处理成功
文本嵌入响应对象,包含嵌入向量结果、模型信息和 tokens 统计。