聊天补全
POST
/v1/chat/completions
Chat
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://router.shengsuanyun.com/api/v1/chat/completions' \
--header 'HTTP-Referer: https://www.postman.com' \
--header 'X-Title: Postman' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "deepseek/deepseek-v3",
"stream": true,
"messages": [
{
"role": "user",
"content": "你好"
}
],
"stream_options": {
"include_usage": true
}
}'
响应示例响应示例
200 - 非流式响应
{
"id": "20250410143202432620157mDT6DvdC",
"provider": "OpenRouter",
"model": "anthropic/claude-3.7-sonnet",
"object": "chat.completion",
"created": 1744266722,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I don't have the ability to check real-time weather information for Shanghai or any other location. To get accurate and current weather information for Shanghai, you could:\n\n1. Check a weather website or app such as Weather.com, AccuWeather, or a local Chinese weather service\n2. Search for \"上海天气\" (Shanghai weather) on a search engine\n3. Look at the weather function on your smartphone\n4. Check local Shanghai news websites\n\nIf you need current weather information, these sources will provide you with accurate forecasts, temperature, precipitation chances, and other relevant weather data for Shanghai today."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 16,
"completion_tokens": 133,
"total_tokens": 149
}
}
请求参数
Header 参数
HTTP-Referer
string
可选
示例值:
https://www.postman.com
X-Title
string
可选
示例值:
Postman
Body 参数application/json
返回响应
修改于 2025-05-29 08:52:02