Gemini 生图(Chat 格式)
curl --request POST \
--url https://zero.cat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"stream": true,
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"contents": [
{
"role": "<string>",
"parts": [
{
"text": "<string>"
}
]
}
]
}
'import requests
url = "https://zero.cat/v1/chat/completions"
payload = {
"model": "<string>",
"stream": True,
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"contents": [
{
"role": "<string>",
"parts": [{ "text": "<string>" }]
}
]
}
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: '<string>',
stream: true,
messages: [{role: '<string>', content: '<string>'}],
contents: [{role: '<string>', parts: [{text: '<string>'}]}]
})
};
fetch('https://zero.cat/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"object": "<string>",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}图像
Gemini 生图(Chat 格式)
Gemini 图片生成
POST
/
v1
/
chat
/
completions
Gemini 生图(Chat 格式)
curl --request POST \
--url https://zero.cat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"stream": true,
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"contents": [
{
"role": "<string>",
"parts": [
{
"text": "<string>"
}
]
}
]
}
'import requests
url = "https://zero.cat/v1/chat/completions"
payload = {
"model": "<string>",
"stream": True,
"messages": [
{
"role": "<string>",
"content": "<string>"
}
],
"contents": [
{
"role": "<string>",
"parts": [{ "text": "<string>" }]
}
]
}
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: '<string>',
stream: true,
messages: [{role: '<string>', content: '<string>'}],
contents: [{role: '<string>', parts: [{text: '<string>'}]}]
})
};
fetch('https://zero.cat/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"object": "<string>",
"created": 123,
"choices": [
{
"index": 123,
"message": {
"role": "<string>",
"content": "<string>"
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}授权
ZeroCat API 密钥(sk- 开头),在控制台「API 密钥」页面创建。
格式:Authorization: Bearer sk-xxxxxx
请求体
application/json

