I tried Grok 4.6 on Amazon Bedrock with Grok Build CLI

I tried Grok 4.6 on Amazon Bedrock with Grok Build CLI

I tried configuring a custom model for Amazon Bedrock (bedrock-mantle) in the latest version of Grok Build CLI, and called Grok 4.6 using a Bearer Token generated from AWS credentials. It worked via Bedrock in both interactive mode and headless execution, and Japanese prompts received responses in Japanese.
2026.08.19

This page has been translated by machine translation. View original

Introduction

On August 19, 2026, xAI's Grok 4.6 became available on Amazon Bedrock.

https://dev.classmethod.jp/articles/grok-4-6-amazon-bedrock-mantle-iam/

I previously tried Grok Build CLI with Grok 4.5 on X Premium+.

https://dev.classmethod.jp/articles/grok-45-build-cli-headless-mode-comparison-kiro-codex/

This time, I had the opportunity to configure a custom model in Grok Build CLI (1.0.5) and verify the use of Grok 4.6 via Amazon Bedrock, so I will introduce it here. I will not be verifying its functionality as a coding agent.

What Was Tested

I proceeded in the following order: installation and Bedrock configuration, verification of operation in interactive mode, headless execution, and confirmation of data retention settings.

Test Environment

The environment that forms the basis of this test's results.

Item Value
OS Fedora Asahi Remix 44 (Linux 7.1.6-400.asahi.fc44.aarch64+16k)
Architecture aarch64 (Apple Silicon)
Grok Build CLI 1.0.5 (stable)
Bedrock Region us-west-2
Model ID xai.grok-4.6
Custom Model Name grok-4.6-bedrock

Installation and Bedrock Configuration

Grok Build CLI was installed using the official installer.

curl -fsSL https://x.ai/cli/install.sh | bash

The version after installation was grok 1.0.5 (5115b46bc9) [stable].

With Grok Build CLI, you can define custom models in ~/.grok/config.toml and call any OpenAI-compatible endpoint. The specification for configuration items is described in the documentation bundled with the CLI (~/.grok/docs/user-guide/11-custom-models.md) and on the official website.

https://docs.x.ai/build/overview

Amazon Bedrock provides an OpenAI-compatible API at the bedrock-mantle.{region}.api.aws endpoint.

https://docs.aws.amazon.com/bedrock/latest/userguide/bedrock-mantle.html

The endpoints for each region can be found in the following list.

https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html

The following values were set for the custom model grok-4.6-bedrock for Amazon Bedrock. Since the model name contains ., the section name is enclosed in quotes in TOML.

[model."grok-4.6-bedrock"]
model = "xai.grok-4.6"
base_url = "https://bedrock-mantle.us-west-2.api.aws/openai/v1"
api_backend = "chat_completions"
env_key = "GROK_BEDROCK_TOKEN"

A Bearer Token is used for authentication on the Bedrock side. The Python library aws_bedrock_token_generator provided by AWS can generate a short-lived Bearer Token from AWS credentials. The maximum validity period of the token is 12 hours. The package name at installation time uses hyphens, while the import name uses underscores.

pip install aws-bedrock-token-generator

The installation procedure and token validity period are explained on the following page.

https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-generate.html

I set the value returned by provide_token(region=...) to the environment variable specified by env_key, then launched Grok Build CLI.

export GROK_BEDROCK_TOKEN="$(python -c 'from aws_bedrock_token_generator import provide_token; print(provide_token(region="us-west-2"))')"

Verification of Operation in Interactive Mode

First, I verified that the AWS credentials used to generate the Bearer Token pointed to the expected account.

aws sts get-caller-identity --query Account --output text
XXXXXXXXXXXX

I launched interactive mode with the custom model specified as an argument.

grok -m grok-4.6-bedrock

The startup screen displayed "Grok 4.6 (Amazon Bedrock)" and "Logged in with API key."

Grok Build CLI startup screen

After one round of prompts, I switched tabs to check the Usage-related screens. The call via Bedrock succeeded, and the token usage was recorded in the session summary on the Grok Build CLI side.

The Usage limit screen displayed Session usage (since start or last resume).
The values were Input tokens 10,710 / Output tokens 39 (22 reasoning) / Total tokens 10,749.
Model calls 1 · API time 1.8s and Cost: not available (not reported) were also shown.

Usage limit display

In Session info, Model: Grok 4.6 (Amazon Bedrock) and API Backend: ChatCompletions were shown side by side.
Turn: 1 and Context: 10749 / 500000 tokens (2%) could also be read on this screen.

Session info display

Switching to Context usage, the model notation was xai.grok-4.6 and the context limit was 500k tokens.

Context usage display

Headless Execution

Separately from interactive mode, I submitted a Japanese prompt in headless mode.

grok -m grok-4.6-bedrock \
  -p "日本語で挨拶してください。今日のAWSの調子はどうですか?" \
  --output-format json

The beginning of the response was as follows.

I will greet you in Japanese and check today's AWS operational status. Hello. I look forward to working with you today.

Here is the JSON output obtained with --output-format json. Only the beginning of the response body (text) is shown, and the session identifier has been masked.

{
  "text": "日本語でご挨拶しつつ、今日のAWSの稼働状況を確認します。こんにちは。今日もよろしくお願いします。\n\n(以下略)",
  "stopReason": "end_turn",
  "sessionId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "requestId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "usage": {
    "input_tokens": 44827,
    "cache_read_input_tokens": 1536,
    "cache_creation_input_tokens": 0,
    "output_tokens": 911,
    "reasoning_tokens": 193,
    "total_tokens": 47274
  },
  "num_turns": 4,
  "modelUsage": {
    "xai.grok-4.6": {
      "inputTokens": 44827,
      "outputTokens": 911,
      "cacheReadInputTokens": 1536,
      "cacheCreationInputTokens": 0,
      "modelCalls": 4
    }
  }
}

The model ID xai.grok-4.6 is recorded as the key in modelUsage, which confirms that the call via Bedrock succeeded.
For a single prompt execution, both modelCalls and num_turns at the JSON root level were 4.

Confirmation of Data Retention Settings

In Bedrock, whether to retain inputs and outputs during inference is controlled by a data retention mode set at the account or project level. The model side also declares the modes it permits as allowed_modes. This can be confirmed by retrieving model information using an already-generated Bearer Token.

curl -s https://bedrock-mantle.us-west-2.api.aws/v1/models/xai.grok-4.6 \
  -H "Authorization: Bearer $GROK_BEDROCK_TOKEN"
{
    "created": 1786492800,
    "data_retention": {
        "allowed_modes": [
            "provider_data_share",
            "none",
            "default"
        ],
        "mode": "default",
        "source": "model_default"
    },
    "id": "xai.grok-4.6",
    "object": "model",
    "owned_by": "system",
    "status": "available"
}

mode was default and source was model_default. The account side was confirmed to be inherit with the following command, so the model's default is applied as-is.

aws bedrock get-account-data-retention --region us-west-2
{
    "mode": "inherit"
}

With default, AWS may retain inputs and outputs for the purpose of abuse detection, but they will not be passed to the model provider. Since none is also included in allowed_modes, you can choose zero data retention as well. The meaning of each mode is summarized on the following page.

https://docs.aws.amazon.com/bedrock/latest/userguide/data-retention.html

Summary

Simply by registering a custom model and passing a Bearer Token via an environment variable, it was possible to use Grok 4.6 on Bedrock from Grok Build CLI.

Since Bedrock uses pay-as-you-go billing based on token volume, there are no fixed monthly costs. If you want to consolidate authentication and billing under an AWS account, or if you want to use Grok 4.6 without passing inputs and outputs to the model provider, please try the configuration introduced here.

Share this article

AWSのお困り事はクラスメソッドへ