x-ai/grok-4.7
Release date: 2026-09-22
500,000 context · $1.60/M input tokens · $4.80/M output tokens
Grok 4.7 is xAI’s reasoning model for coding, tool use, and knowledge work. It supports text and image input with a shared 500,000-token context window.
Pay-per-use
No upfront costs, pay only for what you use
Use the following code examples to integrate with our API:
import OpenAI from 'openai';
if (!process.env.WAVESPEED_API_KEY) throw new Error('Set WAVESPEED_API_KEY');
const client = new OpenAI({
apiKey: process.env.WAVESPEED_API_KEY,
baseURL: 'https://llm.wavespeed.ai/v1',
timeout: 120_000,
maxRetries: 2,
});
try {
const response = await client.chat.completions.create({
model: 'x-ai/grok-4.7',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0]?.message?.content ?? '');
} catch (error) {
console.error('LLM request failed:', error);
process.exitCode = 1;
}import OpenAI from 'openai';
if (!process.env.WAVESPEED_API_KEY) throw new Error('Set WAVESPEED_API_KEY');
const client = new OpenAI({
apiKey: process.env.WAVESPEED_API_KEY,
baseURL: 'https://llm.wavespeed.ai/v1',
timeout: 120_000,
maxRetries: 2,
});
try {
const response = await client.chat.completions.create({
model: 'x-ai/grok-4.7',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0]?.message?.content ?? '');
} catch (error) {
console.error('LLM request failed:', error);
process.exitCode = 1;
}Grok 4.7 supports text and image input, reasoning, function calling, and structured JSON output.
USD per million tokens:
| Input length | Input | Output | Cached input |
|---|---|---|---|
| Below 200,000 tokens | $1.60 | $4.80 | $0.40 |
| 200,000 tokens and above | $3.20 | $9.60 | $0.80 |
Web search, when used, costs $0.005 per search.
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://llm.wavespeed.ai/v1")
response = client.chat.completions.create(
model="x-ai/grok-4.7",
messages=[{"role": "user", "content": "Explain binary search in one sentence."}],
max_tokens=2048,
reasoning_effort="low",
)
print(response.choices[0].message.content)x-ai/grok-4.7
Grok 4.7 is xAI’s reasoning model for coding, tool use, and knowledge work. It supports text and image input with a shared 500,000-token context window.
Input
$1.6 /M
Output
$4.8 /M
Context
500K
Max Output
450K
Vision
Supported
Tool Use
Supported
Access Grok 4.7 through our unified API — OpenAI-compatible, no cold starts, transparent pricing.
Pricing on WaveSpeedAI: $1.60 per million input tokens and $4.80 per million output tokens. Prompt caching and batch processing are billed separately and reduce effective cost on long, repetitive workloads.
Grok 4.7 supports up to 500K tokens of context with up to 450K tokens of output per request.
WaveSpeedAI exposes Grok 4.7 at https://llm.wavespeed.ai/v1 through the OpenAI-compatible Chat Completions interface. Most OpenAI SDK clients work by changing the base URL and API key; optional fields depend on the selected model.
Sign in to WaveSpeedAI, create an API key in Access Keys, then send a request to https://llm.wavespeed.ai/v1/chat/completions with the model id shown above. Check the current model catalog for availability, capabilities, and pricing.