grok-4-latest vs claude-4-sonnet
更新于2026年11月27日。价格截至2026年12月4日 12:13(UTC)
grok-4-latest vs claude-4-sonnet on OpenCheap, from the same price book as the model pages. grok-4-latest is 9 % cheaper than claude-4-sonnet on a typical 1 : 3 input-to-output mix: $12.58 against $13.84 per 1M tokens.
grok-4-latest is 9 % cheaper than claude-4-sonnet on a typical 1 : 3 input-to-output mix: $12.58 against $13.84 per 1M tokens. A request with 10,000 input tokens and 1,000 output tokens costs about $0.047 on grok-4-latest and $0.052 on claude-4-sonnet. claude-4-sonnet has the larger context window: 200K tokens, against 128K for grok-4-latest. On OpenCheap, grok-4-latest is served by 1 provider and claude-4-sonnet by 1 provider. Both are called with one key at the same OpenAI-compatible endpoint, so switching is a change of the model id. Prices as of 2026-12-04 12:13 UTC.
并排
| 型号 | grok-4-latest xAI | claude-4-sonnet Anthropic |
|---|---|---|
| Input per 1M tokens | $3.14 (best) | $3.46 |
| Output per 1M tokens | $15.72 (best) | $17.30 |
| Cached input per 1M tokens | $3.14 (best) | $3.46 |
| On a 1 : 3 mix per 1M tokens, input to output | $12.58 (best) | $13.84 |
| One request 10,000 tokens in, 1,000 out | $0.047 (best) | $0.052 |
| 1,000 次请求 该规模的请求 | $47.16 (best) | $51.89 |
| Context window tokens in one request | 128K | 200K (best) |
| 服务提供商 在……上提供该服务OpenCheap | 1 | 1 |
| 模型 ID | opencheap/grok-4-latest 模特页面 → | opencheap/claude-4-sonnet 模特页面 → |
价格为各模型当前的起始价格(以美元计),该价格由当前接收请求的服务商提供。标价即该模型的官方公布价格。首个令牌、输出速度和正常运行时间均为各模型中运行速度最快的服务商的中位数,由OpenCheap 测得;每个模型页面均列出了所有服务商。绿色标记表示该行中性价比最高的服务商。
在它们之间切换
将 OpenAI SDK 指向 https://api.opencheap.si/v1 并使用您的OpenCheap 密钥。要调用 claude-4-sonnet 而不是 grok-4-latest, 将模型更改为 opencheap/claude-4-sonnet; 你的代码中其他部分保持不变。每个请求都会发送到你指定的模型中成本最低且状态正常的提供商,每个响应都会报告其成本为 使用成本.
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.opencheap.si/v1", api_key=os.environ["OPENCHEAP_API_KEY"])
r = client.chat.completions.create(model="opencheap/grok-4-latest",
messages=[{"role": "user", "content": "Hi"}])
print(r.choices[0].message.content)关于这两位模型
xAI's Grok 4 is a reasoning model trained with reinforcement learning to use tools such as a code interpreter and web browsing. It chooses its own search queries to pull in real-time information when answering difficult questions. All xAI models
claude-4-sonnet is a language model from Anthropic. It reads and writes text. All Anthropic models
问题
- Which is cheaper, grok-4-latest or claude-4-sonnet?
- grok-4-latest is 9 % cheaper than claude-4-sonnet on a typical 1 : 3 input-to-output mix: $12.58 against $13.84 per 1M tokens. Per 1M tokens, grok-4-latest costs $3.14 input and $15.72 output; claude-4-sonnet costs $3.46 input and $17.30 output.
- Which has the larger context window, grok-4-latest or claude-4-sonnet?
- claude-4-sonnet has the larger context window: 200K tokens, against 128K for grok-4-latest.
- Can I use grok-4-latest and claude-4-sonnet with the same API key?
- Yes. Both are called at https://api.opencheap.si/v1 with the OpenAI SDK or any OpenAI-compatible client: pass the model id opencheap/grok-4-latest or opencheap/claude-4-sonnet, and each request goes to the cheapest healthy provider of that model.