鉴权与连接
- Base URL
https://backend:8000- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
grok-4.3-beta
接入协议
为什么选这个协议
适合已有 OpenAI SDK、Chat Completions 代码或统一网关接入的用户。
接口地址
POST/v1/chat/completions
Authorization: Bearer YOUR_API_KEYContent-Type: application/json请求 / 响应 JSON
// REQUEST
{
"model": "grok-4.3-beta",
"messages": [
{
"role": "user",
"content": "Hello from Mix API"
}
]
}// RESPONSE
{
"id": "chatcmpl_example",
"object": "chat.completion",
"created": 1710000000,
"model": "grok-4.3-beta",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello from Mix API"
},
"finish_reason": "stop"
}
]
}请求字段 / 响应字段
// INPUT SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| model | string | Y |
| messages | array | Y |
| messages[] | object | Y |
| messages[].role | string | Y |
| messages[].content | string | Y |
// RESPONSE SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| id | string | Y |
| object | string | Y |
| created | integer | Y |
| model | string | Y |
| choices | array | Y |
| choices[] | object | Y |
| choices[].index | integer | Y |
| choices[].message | object | Y |
| choices[].message.role | string | Y |
| choices[].message.content | string | Y |
| choices[].finish_reason | string | Y |
代码示例
cURLrequest.sh
curl -X POST "https://backend:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "grok-4.3-beta",
"messages": [
{
"role": "user",
"content": "Hello from Mix API"
}
]
}'