Grok 4.6 API
xai/grok-4.6Grok 4.6 turns text and image material into code, analysis, and structured answers for software engineering, knowledge work, and multi-step agent tasks. Its 500,000-token context window and configurable reasoning help carry relevant details through long documents and connected code changes.
Grok 4.6
xAI · chat-completions
Quick start
Send a POST request to /v1/chat/completions with xai/grok-4.6. Choose JSON or SSE with stream, and receive generated content and usage.
- Endpoint
- POST /v1/chat/completions
- Model ID
- xai/grok-4.6
- Protocol
- Chat Completions
Request fields
| Field | Requirement | Description |
|---|---|---|
| model | Required | xai/grok-4.6 |
| messages | Required | A non-empty array of conversation messages. |
| max_tokens | Optional | Limits output tokens for this response. |
| temperature | Optional | Sampling temperature; the playground allows 0–2. |
| top_p | Optional | Nucleus sampling probability; the playground allows 0–1. |
| stream | Optional | Returns an SSE event stream when true. |
Response and usage
Successful responses include generated content and usage with input and output token counts.
Streaming
Set stream: true to read SSE. Finalize usage accounting from the terminal usage event.
curl --request POST \
--url https://api.vidgo.ai/v1/chat/completions \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "xai/grok-4.6",
"messages": [
{
"role": "user",
"content": "Explain why deterministic retries matter in distributed systems."
}
],
"max_tokens": 1024,
"temperature": 1,
"top_p": 1,
"stream": false
}'Keep API keys on the server. Never expose them in browser code or public repositories.
Continue with
Grok 4.6 API — Frequently asked questions
What is the Grok 4.6 API?
Grok 4.6 is an xAI language model for coding, knowledge work, and agent tasks. It uses text and image material to produce code, analysis, and structured answers across connected steps. Its 500,000-token context window and configurable reasoning help it use extensive context throughout longer work. You can call it programmatically or try text conversation in the playground on this page.
How does Grok 4.6 use a 500,000-token context?
Put related requirements, code files, and documents into the task input so Grok 4.6 can analyze their connections within its 500,000-token context window. State the goal and acceptance criteria to keep a long task focused.
How does Grok 4.6 analyze images?
Grok 4.6 can analyze images alongside written questions. In structured Responses input, place the text instruction before the image content to focus its analysis of screenshots, charts, or interfaces.
Which reasoning efforts can Grok 4.6 use?
Grok 4.6 offers low, medium, high, and xhigh reasoning effort, with high as the default. Set reasoning.effort in a Responses request to choose the depth for your task.
How does Grok 4.6 work across a codebase?
Provide Grok 4.6 with the target behavior, relevant code, constraints, and test results so it can plan edits, write code, and review outcomes. Add fresh test evidence and feedback as the task progresses.
How does Grok 4.6 use function calling?
Configure tools in a Grok 4.6 Responses request so the model can produce function calls for steps that use external operations. Define tool inputs and task boundaries, then execute the calls in your application and provide their results.
How does Grok 4.6 produce structured answers?
Grok 4.6 can organize text results into a specified structure. Configure the text output format in a Responses request and describe each field in the instructions so your application can parse the result.