文本系列
Grok
- Grok 模型,可通过 OpenAI 兼容的 Chat Completions API 调用。
- 基址为
https://api.apiko.app/v1。下方模型列表是当前目录出售的模型;GET /v1/models返回你的 Key 可以调用的模型。
POST
鉴权
发送
Authorization: Bearer <API_KEY>。在控制台 → API 密钥创建 Key。Routes
string
POST /v1/chat/completions— OpenAI 兼容的 Chat Completions;默认返回 JSON,设"stream": true时返回 SSE
请求体
application/json
model
enum<string>必填
公共模型 ID。请严格按列表中的值填写。
可选值:
grok-4.6, grok-4.7示例:
"grok-4.7"messages
object[]必填
Chat Completions 格式的对话消息。
stream
booleandefault:false
设为
true 以使用 Server-Sent Events。调用 Chat Completions 时加入 "stream_options": {"include_usage": true},即可在最后一个事件中获取 Token 用量。other fields
object
工具、响应格式、temperature 和推理控制遵循所调用路由的上游 API。
推理档位:Chat Completions 接受
reasoning_effort(例如 low);它对思考量的影响因模型而异。不要依赖
max_tokens 或 max_completion_tokens 限制 Grok 模型的思考量或费用:思考 Token 会超出上限生成并照常计费,常常是上限的数倍,可见回答仍可能被截断。实际计费以 usage.completion_tokens 为准。响应
200 - application/json
JSON response
object
Chat Completions 返回
choices[0].message.content 和 usage。返回思考内容时,位于
choices[0].message.reasoning_content。响应里的
model 可能是上游带版本号的名称,而不是你发送的 ID;请按你发送的 ID 记录和对账。SSE response
text/event-stream
对于 Chat Completions 流式响应,一直读到
data: [DONE],并在每个 choices 非空的事件中拼接 choices[0].delta.content。开启 include_usage 后,用量在带 finish_reason 的事件之后单独一个事件返回,该事件的 choices 为空。思考内容通过
delta.reasoning_content 流式返回,常常先于 delta.content 出现。