Chat Completions
curl --request POST \
--url https://zero.cat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
}
],
"temperature": 1,
"top_p": 1,
"n": 1,
"stream": false,
"stream_options": {
"include_usage": true
},
"stop": "<string>",
"max_tokens": 123,
"max_completion_tokens": 123,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {},
"user": "<string>",
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"response_format": {
"json_schema": {}
},
"seed": 123,
"modalities": [],
"audio": {
"voice": "<string>",
"format": "<string>"
}
}
'import requests
url = "https://zero.cat/v1/chat/completions"
payload = {
"model": "gpt-4",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
}
],
"temperature": 1,
"top_p": 1,
"n": 1,
"stream": False,
"stream_options": { "include_usage": True },
"stop": "<string>",
"max_tokens": 123,
"max_completion_tokens": 123,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {},
"user": "<string>",
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"response_format": { "json_schema": {} },
"seed": 123,
"modalities": [],
"audio": {
"voice": "<string>",
"format": "<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: 'gpt-4',
messages: [
{
content: '<string>',
name: '<string>',
tool_calls: [
{
id: '<string>',
type: 'function',
function: {name: '<string>', arguments: '<string>'}
}
],
tool_call_id: '<string>',
reasoning_content: '<string>'
}
],
temperature: 1,
top_p: 1,
n: 1,
stream: false,
stream_options: {include_usage: true},
stop: '<string>',
max_tokens: 123,
max_completion_tokens: 123,
presence_penalty: 0,
frequency_penalty: 0,
logit_bias: {},
user: '<string>',
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
response_format: {json_schema: {}},
seed: 123,
modalities: [],
audio: {voice: '<string>', format: '<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>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"text_tokens": 123,
"audio_tokens": 123,
"image_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}聊天
Chat Completions
根据对话历史创建模型响应。支持流式和非流式响应。
兼容 OpenAI Chat Completions API。
POST
/
v1
/
chat
/
completions
Chat Completions
curl --request POST \
--url https://zero.cat/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
}
],
"temperature": 1,
"top_p": 1,
"n": 1,
"stream": false,
"stream_options": {
"include_usage": true
},
"stop": "<string>",
"max_tokens": 123,
"max_completion_tokens": 123,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {},
"user": "<string>",
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"response_format": {
"json_schema": {}
},
"seed": 123,
"modalities": [],
"audio": {
"voice": "<string>",
"format": "<string>"
}
}
'import requests
url = "https://zero.cat/v1/chat/completions"
payload = {
"model": "gpt-4",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
}
],
"temperature": 1,
"top_p": 1,
"n": 1,
"stream": False,
"stream_options": { "include_usage": True },
"stop": "<string>",
"max_tokens": 123,
"max_completion_tokens": 123,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {},
"user": "<string>",
"tools": [
{
"type": "function",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {}
}
}
],
"response_format": { "json_schema": {} },
"seed": 123,
"modalities": [],
"audio": {
"voice": "<string>",
"format": "<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: 'gpt-4',
messages: [
{
content: '<string>',
name: '<string>',
tool_calls: [
{
id: '<string>',
type: 'function',
function: {name: '<string>', arguments: '<string>'}
}
],
tool_call_id: '<string>',
reasoning_content: '<string>'
}
],
temperature: 1,
top_p: 1,
n: 1,
stream: false,
stream_options: {include_usage: true},
stop: '<string>',
max_tokens: 123,
max_completion_tokens: 123,
presence_penalty: 0,
frequency_penalty: 0,
logit_bias: {},
user: '<string>',
tools: [
{
type: 'function',
function: {name: '<string>', description: '<string>', parameters: {}}
}
],
response_format: {json_schema: {}},
seed: 123,
modalities: [],
audio: {voice: '<string>', format: '<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>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"message": {
"role": "system",
"content": "<string>",
"name": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_call_id": "<string>",
"reasoning_content": "<string>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"text_tokens": 123,
"audio_tokens": 123,
"image_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}授权
ZeroCat API 密钥(sk- 开头),在控制台「API 密钥」页面创建。
格式:Authorization: Bearer sk-xxxxxx
请求体
application/json
模型 ID
示例:
"gpt-4"
对话消息列表
Show child attributes
Show child attributes
采样温度
必填范围:
0 <= x <= 2核采样参数
必填范围:
0 <= x <= 1生成数量
必填范围:
x >= 1是否流式响应
Show child attributes
Show child attributes
停止序列
最大生成 Token 数
最大补全 Token 数
必填范围:
-2 <= x <= 2必填范围:
-2 <= x <= 2Show child attributes
Show child attributes
Show child attributes
Show child attributes
可用选项:
none, auto, required Show child attributes
Show child attributes
推理强度 (用于支持推理的模型)
可用选项:
low, medium, high 可用选项:
text, audio Show child attributes
Show child attributes

