> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok 4.6

> Use Grok 4.6 through the AnyFast OpenAI-compatible Chat Completions API.

Grok 4.6 is available through AnyFast at `POST /v1/chat/completions`. Use model ID `grok-4.6`.

<Info>The upstream xAI specification lists a 500,000-token context window, text and image input, and text output.</Info>

## 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

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "grok-4.6",
      "messages": [
        {
          "role": "user",
          "content": "Review this function for correctness: function median(a){a.sort();return a[a.length/2]}"
        }
      ],
      "reasoning_effort": "high",
      "stream": false
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1",
  )

  response = client.chat.completions.create(
      model="grok-4.6",
      messages=[
          {
              "role": "user",
              "content": "Review this function for correctness: function median(a){a.sort();return a[a.length/2]}",
          }
      ],
      reasoning_effort="high",
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

## Image input

Send image URLs through the OpenAI-compatible multimodal message format:

```json theme={null}
{
  "model": "grok-4.6",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "image_url",
          "image_url": {
            "url": "https://example.com/architecture-diagram.png",
            "detail": "high"
          }
        },
        {
          "type": "text",
          "text": "Identify the main components and explain the data flow."
        }
      ]
    }
  ],
  "reasoning_effort": "high"
}
```

## Reasoning behavior

Set the top-level `reasoning_effort` field:

| Value    | Behavior                                      |
| -------- | --------------------------------------------- |
| `low`    | Lower latency for simpler agentic tasks       |
| `medium` | Balanced reasoning for analysis and tool use  |
| `high`   | Default; deeper reasoning for difficult tasks |
| `xhigh`  | Maximum reasoning depth and latency           |

<Warning>Reasoning cannot be disabled for Grok 4.6. Do not send `reasoning_effort: "none"`. The upstream model also rejects `stop`, `presence_penalty`, and `frequency_penalty`.</Warning>

## Core request fields

| Parameter          | Type    | Required | Description                                                                                     |
| ------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------- |
| `model`            | string  | Yes      | Must be `grok-4.6`                                                                              |
| `messages`         | array   | Yes      | Conversation messages. User content can be text or an array containing text and image URL parts |
| `reasoning_effort` | string  | No       | `low`, `medium`, `high`, or `xhigh`. Default: `high`                                            |
| `max_tokens`       | integer | No       | Maximum number of completion tokens                                                             |
| `stream`           | boolean | No       | Return SSE deltas when `true`. Default: `false`                                                 |

## Response and streaming

For non-streaming requests, read the final answer from `choices[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`.

<Note>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.</Note>

<Card title="API Reference" icon="code" href="/api-reference/model-api/xai/grok-4-6">
  View the Grok 4.6 request and response schema.
</Card>

See the [official Grok 4.6 model page](https://docs.x.ai/developers/models/grok-4.6) for the upstream model specification.

<script src="/public/feedback.js" />
