Embeddings
curl --request POST \
--url https://api.xhuoapi.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-3-small",
"input": "Hello"
}
'import requests
url = "https://api.xhuoapi.ai/v1/embeddings"
payload = {
"model": "text-embedding-3-small",
"input": "Hello"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-3-small', input: 'Hello'})
};
fetch('https://api.xhuoapi.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));接口
向量嵌入
OpenAI Embeddings 格式。text-embedding-3-small 返回 1536 维向量。
POST
/
embeddings
Embeddings
curl --request POST \
--url https://api.xhuoapi.ai/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-3-small",
"input": "Hello"
}
'import requests
url = "https://api.xhuoapi.ai/v1/embeddings"
payload = {
"model": "text-embedding-3-small",
"input": "Hello"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-3-small', input: 'Hello'})
};
fetch('https://api.xhuoapi.ai/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));在调试面板里填入你的令牌即可发送真实请求,按正常调用计费。
授权
Token from https://api.xhuoapi.ai
响应
Embedding vectors