Chat completions
curl --request POST \
--url https://api.xhuoapi.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepseek-v4-flash",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
'import requests
url = "https://api.xhuoapi.ai/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash",
"messages": [
{
"role": "user",
"content": "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: 'deepseek-v4-flash', messages: [{role: 'user', content: 'Hello'}]})
};
fetch('https://api.xhuoapi.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"choices": [
{}
],
"usage": {}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}接口
对话补全
OpenAI Chat Completions 格式,所有对话模型通用,支持流式输出、工具调用和 JSON 模式。
POST
/
chat
/
completions
Chat completions
curl --request POST \
--url https://api.xhuoapi.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepseek-v4-flash",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
'import requests
url = "https://api.xhuoapi.ai/v1/chat/completions"
payload = {
"model": "deepseek-v4-flash",
"messages": [
{
"role": "user",
"content": "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: 'deepseek-v4-flash', messages: [{role: 'user', content: 'Hello'}]})
};
fetch('https://api.xhuoapi.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"choices": [
{}
],
"usage": {}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}在调试面板里填入你的令牌即可发送真实请求,按正常调用计费。
授权
Token from https://api.xhuoapi.ai
请求体
application/json
Model ID. See the models page.
示例:
"deepseek-v4-flash"
Show child attributes
Show child attributes
示例:
[{ "role": "user", "content": "Hello" }]
Return server-sent events.
必填范围:
0 <= x <= 2OpenAI-style function tools.
e.g. {"type": "json_object"}