对话 (Chat Completions)
curl --request POST \
--url https://api.senseaudio.cn/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "senseaudio-s2",
"messages": [
{
"role": "system",
"content": "你是一个严谨的人工智能助手。"
},
{
"role": "user",
"content": "你好,请解释一下什么是黑洞?"
}
],
"temperature": 0.7,
"stream": false
}
'import requests
url = "https://api.senseaudio.cn/v1/chat/completions"
payload = {
"model": "senseaudio-s2",
"messages": [
{
"role": "system",
"content": "你是一个严谨的人工智能助手。"
},
{
"role": "user",
"content": "你好,请解释一下什么是黑洞?"
}
],
"temperature": 0.7,
"stream": False
}
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: 'senseaudio-s2',
messages: [
{role: 'system', content: '你是一个严谨的人工智能助手。'},
{role: 'user', content: '你好,请解释一下什么是黑洞?'}
],
temperature: 0.7,
stream: false
})
};
fetch('https://api.senseaudio.cn/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.senseaudio.cn/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'senseaudio-s2',
'messages' => [
[
'role' => 'system',
'content' => '你是一个严谨的人工智能助手。'
],
[
'role' => 'user',
'content' => '你好,请解释一下什么是黑洞?'
]
],
'temperature' => 0.7,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.senseaudio.cn/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.senseaudio.cn/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-1234567890",
"object": "chat.completion",
"created": 1700000000,
"model": "senseaudio-s2",
"system_fingerprint": "fp_xxxxxx",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "黑洞是宇宙中存在的一种天体,其引力极强..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 105,
"total_tokens": 133
}
}文本生成
对话 (Chat) API
标准化多轮对话接口,兼容 OpenAI 规范,支持 Function Calling 与多模态输入
POST
/
v1
/
chat
/
completions
对话 (Chat Completions)
curl --request POST \
--url https://api.senseaudio.cn/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "senseaudio-s2",
"messages": [
{
"role": "system",
"content": "你是一个严谨的人工智能助手。"
},
{
"role": "user",
"content": "你好,请解释一下什么是黑洞?"
}
],
"temperature": 0.7,
"stream": false
}
'import requests
url = "https://api.senseaudio.cn/v1/chat/completions"
payload = {
"model": "senseaudio-s2",
"messages": [
{
"role": "system",
"content": "你是一个严谨的人工智能助手。"
},
{
"role": "user",
"content": "你好,请解释一下什么是黑洞?"
}
],
"temperature": 0.7,
"stream": False
}
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: 'senseaudio-s2',
messages: [
{role: 'system', content: '你是一个严谨的人工智能助手。'},
{role: 'user', content: '你好,请解释一下什么是黑洞?'}
],
temperature: 0.7,
stream: false
})
};
fetch('https://api.senseaudio.cn/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.senseaudio.cn/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'senseaudio-s2',
'messages' => [
[
'role' => 'system',
'content' => '你是一个严谨的人工智能助手。'
],
[
'role' => 'user',
'content' => '你好,请解释一下什么是黑洞?'
]
],
'temperature' => 0.7,
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.senseaudio.cn/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.senseaudio.cn/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.senseaudio.cn/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"senseaudio-s2\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"你是一个严谨的人工智能助手。\"\n },\n {\n \"role\": \"user\",\n \"content\": \"你好,请解释一下什么是黑洞?\"\n }\n ],\n \"temperature\": 0.7,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-1234567890",
"object": "chat.completion",
"created": 1700000000,
"model": "senseaudio-s2",
"system_fingerprint": "fp_xxxxxx",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "黑洞是宇宙中存在的一种天体,其引力极强..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 105,
"total_tokens": 133
}
}说明
提供标准化的对话接口,兼容主流规范,支持多轮对话、工具调用 (Function Calling) 及多模态输入。- 接口地址:
POST https://api.senseaudio.cn/v1/chat/completions - Content-Type:
application/json - 鉴权方式:Bearer Token,详见 快速接入
- 流式输出:
stream: true以 SSE 协议逐块返回;收到data: [DONE]标识流结束 - 模型列表:见 模型列表
- 计费:按输入 / 输出 token 计费,详见 计费说明
Authorizations
string
必填
Bearer 鉴权头,格式为
Bearer SENSEAUDIO_API_KEY。Body
application/jsonenum<string>
默认值:"senseaudio-s2"
必填
用于补全你提示词的模型。可用选项:
senseaudio-s2,senseaudio-s2-flash,senseaudio-s2-lite,sensenova-6.8-flash-lite,deepseek-v4.1-flash,deepseek-v4-flash-0731,glm-5.3-flash,qwen3.8-27b,qwen3.6-35b-a3b示例:"senseaudio-s2"object[]
必填
object[]
string | object
默认值:"auto"
控制模型调用工具的行为:
none / auto / required,或指定函数对象 {type: 'function', function: {name: 'my_func'}}。boolean
默认值:"false"
是否开启流式响应,开启后通过 SSE 协议逐块返回。
object
流式响应选项(仅
stream=true 时有效)。显示 child attributes
显示 child attributes
boolean
默认值:"false"
若为
true,会在终止块 [DONE] 前返回包含 usage 的最后一个 chunk。object
输出格式:
{type: 'text'}(默认)、{type: 'json_object'}(强制 JSON)。integer
限制生成的最大 token 数量。不设置则直至自然生成完毕或达到模型上限。
number
默认值:"1.0"
采样温度,范围
[0.0, 2.0]。值越高输出越随机,建议与 top_p 二选一调整。number
默认值:"1.0"
核采样概率阈值,范围
[0.0, 1.0]。integer
默认值:"1"
为每条输入消息生成的回复选项数量。
string | string[]
停止词序列(最多 4 个)。
number
默认值:"0.0"
频率惩罚系数,范围
[-2.0, 2.0]。number
默认值:"0.0"
存在惩罚系数,范围
[-2.0, 2.0]。object
调整特定 token 出现的概率。键为 Token ID,值为偏差
[-100, 100]。boolean
默认值:"false"
是否返回输出 token 的对数概率。
integer
返回在每个位置最可能的 N 个 token 的概率(需开启
logprobs,范围 [0, 20])。integer
随机种子,用于尽可能的确定性采样。
string
最终用户的唯一标识,可用于协助监控及防滥用。
Response
200 — application/json
string
本次请求的唯一标识符。
string
对象类型。非流式为
"chat.completion";流式为 "chat.completion.chunk"。integer
生成成功的 Unix 时间戳(秒)。
string
实际响应的模型名称。
string
模型运行的后端配置系统指纹。
object[]
流式响应示例
开启stream: true 时,基于 SSE 协议逐块返回:
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1700000000,"model":"senseaudio-s2","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1700000000,"model":"senseaudio-s2","choices":[{"index":0,"delta":{"content":"黑洞"},"finish_reason":null}]}
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1700000000,"model":"senseaudio-s2","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
错误处理
错误时返回非 200 状态码,响应体包含error 对象:
object
相关指南
授权
格式:Bearer <API_KEY>
请求体
application/json
可用选项:
senseaudio-s2, senseaudio-s2-flash, senseaudio-s2-lite, sensenova-6.8-flash-lite, deepseek-v4.1-flash, deepseek-v4-flash-0731, glm-5.3-flash, qwen3.8-27b, qwen3.6-35b-a3b 示例:
"senseaudio-s2"
Show child attributes
Show child attributes
字段推断自素材文档
示例:
1024
示例:
0.7
示例:
1