逆向接口调用案例
开发中
POST
http://prod-cn.your-api-server.comhttps://api.quzhi.life/v1/chat/completions
请求参数
Header 参数
Content-Type
string
必需
示例值:
application/json
Authorization
string
必需
示例值:
Bearer YOUR KEY
Body 参数application/json
model
string
必需
messages
array [object {2}]
必需
role
string
必需
content
string
必需
示例
{
"model": "claude-3-5-sonnet-20241022",
"messages": [
{
"role": "system",
"content": "You are Claude, a large language model trained by Anthropic.\nKnowledge cutoff: 2024-04\nCurrent model: claude-3-5-sonnet-20241022\nCurrent time: 2025/2/12 21:10:29\nLatex inline: $x^2$\nLatex block: $$e=mc^2$$"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好"
}
]
}
],
"temperature": 0.5,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"max_tokens": 1024,
"stream": true
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.quzhi.life/v1/chat/completions' \
--header 'Authorization: Bearer YOUR KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-3-5-sonnet-20241022",
"messages": [
{
"role": "system",
"content": "You are Claude, a large language model trained by Anthropic.\nKnowledge cutoff: 2024-04\nCurrent model: claude-3-5-sonnet-20241022\nCurrent time: 2025/2/12 21:10:29\nLatex inline: $x^2$\nLatex block: $$e=mc^2$$"
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好"
}
]
}
],
"temperature": 0.5,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"max_tokens": 1024,
"stream": true
}'
返回响应
🟢200成功
application/json
Body
id
string
必需
model
string
必需
object
string
必需
created
integer
必需
choices
array [object {3}]
必需
index
integer
可选
message
object
可选
finish_reason
string
可选
usage
object
必需
prompt_tokens
integer
必需
completion_tokens
integer
必需
total_tokens
integer
必需
system_fingerprint
string
必需
示例
{
"id": "string",
"model": "string",
"object": "string",
"created": 0,
"choices": [
{
"index": 0,
"message": {
"role": "string",
"content": "string"
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
},
"system_fingerprint": "string"
}