Appearance
Chat Completions
Chat Completions 是最常用的对话接口。
text
POST https://api.xai.kg/v1/chat/completions1
流式请求示例
bash
curl -N https://api.xai.kg/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{ "role": "user", "content": "写三条接入建议。" }
],
"temperature": 0.7,
"stream": true
}'1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
参数说明
| 参数 | 说明 |
|---|---|
model | 模型名,必须是当前账户可用模型 |
messages | 对话消息数组 |
temperature | 随机性,数值越高越发散 |
stream | 当前请固定传 true |