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)