← All models
xAI
Grok 4
xAI's flagship model with real-time X data.
chatreasoningreal-time
Input price
$3.60
per 1M tokens (with markup)
Output price
$18.00
per 1M tokens (with markup)
Context window
256,000
tokens max input
About Grok 4
Grok 4 from xAI — strong reasoning with real-time context from X (formerly Twitter).
Capabilities
✓Streaming
✓Tool calling / function calls
—Vision input
—JSON mode
Use it through OneAPIKey
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ONEAPIKEY_API_KEY,
baseURL: "https://oneapikey.app/v1",
});
const res = await client.chat.completions.create({
model: "grok-4",
messages: [{ role: "user", content: "Hello!" }],
});