Grok 4.6 API

xai/grok-4.6
500,000 tokens

Grok 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

Chat with Grok 4.6

Each model has its own conversation. Switching never sends another model's history, and switching back resumes where you left off. Requests are billed from actual token usage.

Ctrl / ⌘ + Enter to send0 / 32,000

Continue with

Grok 4.6

Grok 4.6 handles coding, document analysis, and sustained multi-step tasks using text and image input to produce text output. Chat Completions accepts ordered conversation messages; Responses accepts text or structured input. Both interfaces can return complete JSON responses or SSE streams.

Why Choose Grok 4.6?

  • Long-context analysisExamine requirements, source files, and conversation history together in a 500,000-token context window to resolve questions that span materials.

  • Persistent agent workCarry a multi-step task forward, check intermediate results, and revise the next step when tool feedback reveals a problem.

  • Repository-level engineeringConnect code, target behavior, and test evidence to implement and review changes that cross multiple files.

  • Interactive interface creationTranslate app requirements into structured layouts and first-pass interface code, then refine the design from specific feedback.

  • Research and knowledge workSynthesize reports and other source material into organized findings for research and professional analysis.

  • Reasoning and function toolsSet a supported reasoning effort in Responses and supply function tools when a task needs deeper analysis or external information.

Input Parameters

ParameterRequirementDescription
modelRequired

Set to xai/grok-4.6 for both protocols.

messagesRequired for Chat Completions

A non-empty ordered array of conversation messages with role and content.

inputRequired for Responses

A non-empty text string or structured input array that can combine text and images.

max_tokensOptional for Chat Completions

Sets a positive integer output-token limit for the request.

max_output_tokensOptional for Responses

Sets a positive integer output-token limit for the response.

reasoning.effortOptional for Responses

Selects reasoning effort; high is the default.

Defaulthighlowmediumxhigh
toolsOptional for Responses

Configures function tools available to the model.

streamOptional

Selects a complete JSON response or an SSE event stream.

Defaultfalsetrue

How to Use

  1. Define the taskProvide the goal, relevant material, constraints, and expected answer format.

  2. Choose the interfaceUse Chat Completions for conversation messages or Responses for structured text and image input, reasoning settings, and tool workflows.

  3. Set output lengthAdd max_tokens or max_output_tokens for the selected interface, then send the request.

  4. Review the resultRead the generated text and usage, then supply the context needed for the next step.

Pricing

Input and output usage is metered per 1M tokens and settled in credits. Output usage includes reasoning tokens.

UsageRateDetails
Input$1.60 · 320 credits / 1M tokensInput tokens counted in the request.
Output$4.80 · 960 credits / 1M tokensGenerated output tokens, including reasoning tokens.

Best Use Cases

  • Multi-file software engineeringConnect requirements, implementation files, and test evidence across a development task.

  • Long-form researchAnalyze reports, screenshots, and source documents to produce grounded findings and summaries.

  • Multi-step agent tasksCombine a clear goal with function tools to link research, execution, and result checks.

Pro Tips

  • For coding tasks, include relevant files, target behavior, and acceptance criteria together.
  • Set reasoning.effort in a Responses request to match the depth of analysis the task needs.
  • When analyzing an image, put the written question before the image and name the details to inspect.

Usage Notes

  • Grok 4.6 has a 500,000-token context window.
  • The on-page Playground uses Chat Completions for text conversation and offers an output control from 256 to 8,192 tokens.
  • Use xai/grok-4.6 with either /v1/chat/completions or /v1/responses.

Related Models

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.