xai/grok-4.7
xAI 旗舰 Grok 4.7。推理、Agent 编码、工具调用能力强,可读图,500K token 上下文,OpenAI 兼容协议接入。
缓存读 $0.075/M · 缓存写 —/M
| 档位 | 输入 | 缓存读 | 缓存写 | 输出 |
|---|---|---|---|---|
| Standard ≤200K | $0.3 | $0.075 | — | $0.9 |
| Standard >200K | $0.6 | $0.15 | — | $1.8 |
API 调用时用任一 ID 都可以。
xai/grok-4.7请求里的 model 可以直接使用这些名字。
把 ONEHOP_KEY 占位符替换为你的 API Key。 创建 →
from openai import OpenAI
client = OpenAI(
base_url="https://api.onehop.ai/v1",
api_key="<ONEHOP_KEY>",
)
completion = client.chat.completions.create(
model="xai/grok-4.7",
messages=[{"role": "user", "content": "What is the meaning of life?"}],
)
print(completion.choices[0].message.content)