curl --request POST \
--url https://api.aihubmax.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "用 Python 写一个快速排序算法"
}
]
}
'{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1757165031,
"model": "<string>",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 50,
"total_tokens": 70
}
}{
"error": {
"message": "请求参数无效",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "请求参数无效",
"type": "invalid_request_error"
}
}{
"error": {
"message": "访问被拒绝",
"type": "permission_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}调用工具
OpenAI 格式 - 调用工具对话
- 适用于所有兼容 OpenAI 格式模型的通用 Chat Completions API(含工具调用)
- 工具调用:支持 Function Calling,定义模型可调用的工具
- 结构化输出:支持 JSON Object / JSON Schema 格式
- 多模态输入:支持文本 + 图像混合输入
- 支持流式和非流式响应
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://api.aihubmax.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "用 Python 写一个快速排序算法"
}
]
}
'{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1757165031,
"model": "<string>",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 50,
"total_tokens": 70
}
}{
"error": {
"message": "请求参数无效",
"type": "invalid_request_error"
}
}{
"error": {
"message": "API密钥无效",
"type": "authentication_error"
}
}{
"error": {
"message": "请求参数无效",
"type": "invalid_request_error"
}
}{
"error": {
"message": "访问被拒绝",
"type": "permission_error"
}
}{
"error": {
"message": "请求频率超限",
"type": "rate_limit_error"
}
}{
"error": {
"message": "服务器内部错误",
"type": "server_error"
}
}授权
所有接口均需要使用Bearer Token进行认证
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
模型名称,如 gpt-5.4、deepseek-chat 等
示例:
"gpt-5.4"
对话消息列表
Show child attributes
Show child attributes
是否流式返回响应
采样温度 (0-2)
必填范围:
0 <= x <= 2最大生成token数
核采样参数 (0-1)
必填范围:
0 <= x <= 1频率惩罚 (-2 到 2)
必填范围:
-2 <= x <= 2存在惩罚 (-2 到 2)
必填范围:
-2 <= x <= 2可用工具列表
Show child attributes
Show child attributes
工具选择策略
可用选项:
none, auto, required 响应格式
Show child attributes
Show child attributes
停止序列
生成数量