Grok 模型
POST /v1/chat/completions
Grok 文本模型使用 OpenAI Chat Completions 兼容格式调用。你只需要把 base_url 指向 Crazyrouter,并在 model 中填写 Grok 模型 ID。
模型可用性会随渠道、令牌权限和 pricing 页面配置变化。正式上线前建议先用 GET /v1/models 确认当前 API Key 是否能看到目标模型。
常用模型
以下是当前常见的 Grok 文本模型写法:
| 模型 | 说明 |
|---|
grok-4 | Grok 4 主模型 |
grok-4-fast | Grok 4 fast 变体 |
grok-4-fast-non-reasoning | Grok 4 fast 非推理变体 |
grok-4-fast-reasoning | Grok 4 fast 推理变体 |
grok-4.1 | Grok 4.1 |
grok-4.1-fast | Grok 4.1 fast |
grok-4.1-thinking | Grok 4.1 thinking |
grok-4.2 | Grok 4.2 |
grok-4-0709 | Grok 4 日期版本 |
旧的 grok-2 / grok-3 系列可能仍被历史调用或兼容配置引用,但当前公开 pricing 主要保留 grok-4* 系列。新接入优先选择 grok-4、grok-4.1、grok-4.2 或 fast/reasoning 变体。
最小请求
curl https://crazyrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "grok-4",
"messages": [
{
"role": "user",
"content": "Reply with one short sentence: what is Grok?"
}
],
"temperature": 0.7,
"max_tokens": 120
}'
流式输出
设置 stream: true 即可使用 SSE 流式输出。
curl https://crazyrouter.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "grok-4-fast",
"stream": true,
"messages": [
{
"role": "user",
"content": "Write a concise API migration checklist."
}
]
}'
推理变体
对于名称中包含 reasoning 或 thinking 的 Grok 模型,建议保持请求参数简单:
{
"model": "grok-4-fast-reasoning",
"messages": [
{
"role": "user",
"content": "Compare two implementation options and explain the tradeoffs."
}
],
"max_tokens": 800
}
不同上游渠道对推理字段、搜索字段或实验参数的支持可能不同。跨渠道稳定接入时,优先使用标准 OpenAI Chat 字段:model、messages、temperature、top_p、max_tokens、stream。
相关图片模型
Grok 图片生成不走 Chat Completions。请使用:
POST /v1/images/generations
图片模型参数请看 Grok 图片模型。