# Grok 4.1 Fast

Grok 4.1 Fast is a reasoning model by xAI with vision, function calling, web search, prompt caching, structured output — designed for complex, multi-step problem solving where accuracy matters more than speed. It supports a 2M token context window with up to 2M tokens of output. Priced at $1.25 per million input tokens and $2.5 per million output tokens. Access Grok 4.1 Fast through [Inworld Router](https://platform.inworld.ai/routers) with OpenAI SDK compatibility, built-in failover, and intelligent routing across providers.

→Function Calling Web Search Reasoning Prompt Caching Response Schema Vision reasoning Capability

## Step 1 — Create Router

### cURL

```bash
curl --location 'https://api.inworld.ai/router/v1/routers' \
--header 'Authorization: Basic <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "name": "compare-frontier-models",
  "defaultRoute": {
      "route_id": "default",
      "variants": [\
        {\
          "variant": {\
              "variant_id": "xai/grok-4-1-fast-a",\
              "model_id": "xai/grok-4-1-fast"\
          },\
          "weight": 33\
        },\
        {\
          "variant": {\
              "variant_id": "xai/grok-3-mini-fast-b",\
              "model_id": "xai/grok-3-mini-fast"\
          },\
          "weight": 33\
        },\
        {\
          "variant": {\
              "variant_id": "xai/grok-3-mini-fast-beta-c",\
              "model_id": "xai/grok-3-mini-fast-beta"\
          },\
          "weight": 34\
        }\
      ]
  }
}'
```

### Python

```python
import requests

response = requests.post(
    "https://api.inworld.ai/router/v1/routers",
    headers={
        "Authorization": "Basic <your-api-key>",
        "Content-Type": "application/json",
    },
    json={
        "name": "compare-frontier-models",
        "defaultRoute": {
            "route_id": "default",
            "variants": [\
                {\
                    "variant": {\
                        "variant_id": "xai/grok-4-1-fast-a",\
                        "model_id": "xai/grok-4-1-fast"\
                    },\
                    "weight": 33\
                },\
                {\
                    "variant": {\
                        "variant_id": "xai/grok-3-mini-fast-b",\
                        "model_id": "xai/grok-3-mini-fast"\
                    },\
                    "weight": 33\
                },\
                {\
                    "variant": {\
                        "variant_id": "xai/grok-3-mini-fast-beta-c",\
                        "model_id": "xai/grok-3-mini-fast-beta"\
                    },\
                    "weight": 34\
                }\
            ]
        }
    },
)
print(response.json())
```

### JavaScript

```javascript
const response = await fetch(
"https://api.inworld.ai/router/v1/routers",
{
    method: "POST",
    headers: {
      Authorization: "Basic <your-api-key>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "compare-frontier-models",
      defaultRoute: {
        route_id: "default",
        variants: [\
          {\
            variant: {\
              variant_id: "xai/grok-4-1-fast-a",\
              model_id: "xai/grok-4-1-fast",\
            },\
            weight: 33,\
          },\
          {\
            variant: {\
              variant_id: "xai/grok-3-mini-fast-b",\
              model_id: "xai/grok-3-mini-fast",\
            },\
            weight: 33,\
          },\
          {\
            variant: {\
              variant_id: "xai/grok-3-mini-fast-beta-c",\
              model_id: "xai/grok-3-mini-fast-beta",\
            },\
            weight: 34,\
          },\
        ],
      },
    }),
}
);
const data = await response.json();
console.log(data);
```

## Step 2 — Chat Completion

### cURL

```bash
curl --location 'https://api.inworld.ai/v1/chat/completions' \
--header 'Authorization: Basic <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "model": "inworld/compare-frontier-models",
  "messages": [{"role": "user", "content": "Hello!"}]
}'
```

### Python

```python
from openai import OpenAI

client = OpenAI(
    api_key="<your-api-key>",
    base_url="https://api.inworld.ai/v1",
)

response = client.chat.completions.create(
    model="inworld/compare-frontier-models",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

### JavaScript

```javascript
import OpenAI from "openai";

const client = new OpenAI({
    apiKey: "<your-api-key>",
    baseURL: "https://api.inworld.ai/v1",
});

const response = await client.chat.completions.create({
    model: "inworld/compare-frontier-models",
    messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
```

## Grok 4.1 Fast pricing and providers

Access Grok 4.1 Fast through xAI via [Inworld Router](https://platform.inworld.ai/routers) or Realtime API. By using the AI provider(s) below you acknowledge you reviewed and agree to their terms listed in the Legal section under the AI provider's name.

| Provider | Context | Max Output | Input ($/1M tokens) | Output ($/1M tokens) | Capabilities | Input modalities | Output modalities |
| --- | --- | --- | --- | --- | --- | --- | --- |
| xAI | 2M | 2M | $1.25 | $2.50 | +4 |  |  |

## Other xAI models available through Inworld

Compare Grok 4.1 Fast with other xAI models available through [Inworld Router](https://platform.inworld.ai/routers) or Realtime API.

| Model | Context | Max Output | Input ($/1M tokens) | Output ($/1M tokens) | Capabilities | Input modalities | Output modalities | Inference provider |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Grok 3 Mini Fast](/content/models/xai-grok-3-mini-fast/index.html) | 131.1K | 131.1K | $1.25 | $2.50 | +2 |  |  |  |
| Grok 3 Mini Fast Beta](/content/models/xai-grok-3-mini-fast-beta/index.html) | 131.1K | 131.1K | $1.25 | $2.50 | +2 |  |  |  |
| Grok 3 Mini Fast Latest](/content/models/xai-grok-3-mini-fast-latest/index.html) | 131.1K | 131.1K | $1.25 | $2.50 | +2 |  |  |  |
| Grok 4](/content/models/xai-grok-4/index.html) | 256K | 256K | $1.25 | $2.50 |  |  |  |  |
| Grok 4 Fast](/content/models/xai-grok-4-fast/index.html) | — | — | $1.25 | $2.50 | — |  |  |  |
|

## Start building with Grok 4.1 Fast

Access Grok 4.1 Fast and every other model through Inworld Router or Realtime API. Create your free account and start routing in minutes.
