POST /v1/chat/completions. Use model ID grok-4.6.
The upstream xAI specification lists a 500,000-token context window, text and image input, and text output.
When to use Grok 4.6
- Long-running coding and agentic tasks
- Multi-step knowledge work and complex analysis
- Visual understanding with text and image inputs
Quick example
Image input
Send image URLs through the OpenAI-compatible multimodal message format:Reasoning behavior
Set the top-levelreasoning_effort field:
Core request fields
Response and streaming
For non-streaming requests, read the final answer fromchoices[0].message.content. For streaming requests, concatenate the text deltas received from the SSE stream.
usage.completion_tokens_details.reasoning_tokens reports the reasoning-token count. These tokens are included in usage.total_tokens; the final answer remains in choices[0].message.content.
This page documents the core AnyFast Chat Completions interface. xAI-native Responses API features such as server-side web search, X search, code execution, conversation storage, and encrypted reasoning are not implied by this endpoint.
API Reference
View the Grok 4.6 request and response schema.