Embeddings
curl --request POST \
--url https://zero.cat/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-ada-002",
"input": "<string>",
"encoding_format": "float",
"dimensions": 123
}
'import requests
url = "https://zero.cat/v1/embeddings"
payload = {
"model": "text-embedding-ada-002",
"input": "<string>",
"encoding_format": "float",
"dimensions": 123
}
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-ada-002',
input: '<string>',
encoding_format: 'float',
dimensions: 123
})
};
fetch('https://zero.cat/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}嵌入
Embeddings
将文本转换为向量嵌入
POST
/
v1
/
embeddings
Embeddings
curl --request POST \
--url https://zero.cat/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-ada-002",
"input": "<string>",
"encoding_format": "float",
"dimensions": 123
}
'import requests
url = "https://zero.cat/v1/embeddings"
payload = {
"model": "text-embedding-ada-002",
"input": "<string>",
"encoding_format": "float",
"dimensions": 123
}
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-ada-002',
input: '<string>',
encoding_format: 'float',
dimensions: 123
})
};
fetch('https://zero.cat/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}授权
ZeroCat API 密钥(sk- 开头),在控制台「API 密钥」页面创建。
格式:Authorization: Bearer sk-xxxxxx
请求体
application/json

