xAIのGrok4.3がAmazon Bedrockに登場
xAI の最新大規模言語モデル「Grok 4.3」が Amazon Bedrock で一般利用可能となり、長文コンテキストと可変推論機能によりエンタープライズ向けエージェント開発の選択肢が拡大した。
キーポイント
Amazon Bedrock での Grok 4.3 提供開始
xAI が Amazon Bedrock のモデルプロバイダーとして正式に参入し、Grok 4.3 を利用可能にした。これにより、AWS クラウド上で xAI のモデルを直接活用できる環境が整った。
可変推論努力レベルと高精度な性能
ユーザーはリクエストごとに「none」「low」「medium」「high」の推論努力レベルを選択でき、低遅延処理から深い分析まで柔軟に対応可能である。ベンチマークでは幻覚率が最低水準に抑えられ、ツール呼び出しや文書理解で業界最高位を記録している。
100 万トークンのコンテキストとマルチモーダル対応
最大 100 万トークンのコンテキストウィンドウをサポートし、長文ドキュメントや多段階の対話セッションを一度に処理できる。また、テキストと画像の入力を同時に受け付け、テキストで回答するマルチモーダル機能も備えている。
コスト効率性とエージェント開発への適性
知能対コストのパレートフロンティアにおいて、他社モデル比で 2〜10 倍の知能を提供すると主張しており、高ボリューム推論や複雑なエージェントワークロードに最適化されている。
セキュリティ要件の高いアプリケーション向け認証
長期の秘密鍵を避けるため、IAM アイデンティティに紐付いた短期トークン(short-term bearer token)の使用が推奨されています。
AWS 資格情報からの動的トークン生成
既存の AWS 資格情報を使用してリクエスト時にトークンを生成する「Amazon Bedrock token generator」ツールを利用できます。
推論出力の制御とコスト最適化
Responses API の `reasoning` パラメータにより、none、low、medium、high の4段階でモデルの推論努力度を調整でき、複雑な問題には high を、単純なタスクや低レイテンシが必要な場面には none または low を使用してトークンコストを最適化できます。
重要な引用
Grok 4.3 is a model with configurable reasoning effort.
It accepts text and image input, and has a 1 million token context window for long documents and multi-turn sessions.
xAI also places the model on the intelligence-versus-cost Pareto frontier, which it describes as 2 to 10 times more intelligence per dollar than other frontier models.
This keeps authentication tied to your IAM identity and avoids a long-lived secret.
When you're ready to incorporate Amazon Bedrock into applications with greater security requirements, we recommend using short-term credentials.
Higher effort tends to help on multi-step problems where a quick answer would be wrong, at the cost of more output tokens.
影響分析・編集コメントを表示
影響分析
この発表は、AWS クラウド上で xAI の高性能モデルを即座に利用可能にするものであり、特に長文処理や複雑な推論が必要なエンタープライズアプリケーションの開発スピードを加速させる。また、可変推論機能の導入により、コストと性能のバランスをシナリオに応じて最適化できるため、AI エージェントの実装における柔軟性が大幅に向上する。
編集コメント
xAI の Grok シリーズが AWS の主要プラットフォームである Bedrock に統合されたことは、大規模言語モデルの選択肢をさらに広げる重要な転換点です。特に「可変推論努力レベル」の実装は、コスト管理と性能要求のバランスを取る現代の AI 開発において極めて実用的な機能と言えます。
本記事は、xAI(SpaceXAI)の Eric Jiang 氏との共著です。
xAI の「Grok 4.3」が Amazon Bedrock で一般利用可能になりました。これにより、エージェントや AI ワークフローを構築するチームは、長い入力に対しても確実な推論が可能になるモデルを利用できるようになります。今回のリリースで xAI は、Amazon Bedrock のモデルプロバイダーとして加わりました。
Grok 4.3 は、推論の強度をユーザーが設定できるのが特徴です。エージェント構築には強力なツール利用機能と指示従順性を持ち、大量の推論処理にはトークン効率の高さを備えています。テキストと画像の入力に対応し、100 万トークンのコンテキストウィンドウ(文脈窓)を持つため、長文ドキュメントや複数回の対話セッションもスムーズに扱えます。このモデルは、Amazon Bedrock の次世代推論エンジン「Mantle」上で動作します。
本記事では、Grok 4.3 がなぜエージェントワークロードやエンタープライズ用途に適しているのか、Amazon Bedrock を通じたアクセス方法、そして多くのチームが最初に活用する機能の使い方について解説します。具体的には、基本的なチャットリクエスト、推論強度のカスタマイズ、ツール呼び出し、構造化出力、画像入力、状態を保持した複数回の対話(ステートフル・マルチターン会話)などです。
なぜ Grok 4.3 はエージェント型・推論タスクに最適なのか
xAI によれば、Grok 4.3 は精度が求められるエンタープライズ用途のために設計されています。モデル発表当時の独自ベンチマークでは、業界標準を凌駕する結果を示しました。
特に注目すべきは、AI 分析サイト「Artificial Analysis」のオムニシェンス(Omniscience)ベンチマークで、比較対象となった最先端モデルの中で最も低い幻覚率(ハルシネーション率)を記録し、1 位を獲得した点です。また、カスタマーサポートにおけるツール呼び出し能力では「Tau2 Telecom」ベンチメントで 1 位に輝き、ドキュメント理解の分野でも「Vals AI Case Law」および「Corporate Finance」ベンチメントで首位となりました。
さらに xAI は、このモデルを「知能対コストのパレートフロンティア(最適解の境界線)」上に位置づけています。これは、他の最先端モデルと比較して、1 ドルあたりの知能が 2 倍から 10 倍高いことを意味します。
Grok 4.3 では、各リクエストごとに「思考の深さ」を調整する effort レベルを設定できます。none(なし)、low(低)、medium(中)、high(高)から選べるため、1 つのモデルで幅広いタスクをカバー可能です。
例えば、レイテンシが重要な分類処理には none を設定し、契約書分析や判例調査など、回答の質が時間より優先されるタスクには high を指定できます。Grok 4.3 はテキストと画像を入力として受け付け、テキストで応答します。100 万トークンという広大なコンテキストウィンドウにより、長文ドキュメントや多段階の対話セッションもスムーズに処理可能です。
ツール呼び出しや指示の忠実な実行にも優れており、関数呼び出しを通じてアクションを実行するエージェントの実装に適しています。契約レビュー、与信条件書の分析、金融文書への質問応答といったユースケースで威力を発揮します。これらのタスクでは、長文の入力に対して推論を行い、その結果をレコードシステム(記録管理システム)へ連携させることが可能です。
Amazon Bedrock での Grok 4.3 アクセス方法
Grok 4.3 は Mantle プラットフォーム上で動作します。Amazon Bedrock Runtime API を利用する他のモデルとはアクセス方法が異なります。Mantle では OpenAI と互換性のある API が採用されています。
したがって、Grok 4.3 の呼び出しは、OpenAI SDK を使用するか、Chat Completions API または Responses API に対して直接 HTTPS リクエストを送信することで実行できます。
Mantle のエンドポイント URL はリージョン固有であり、以下のパターンに従います:
例えば、us-west-2 リージョンにおける基本 URL は https://bedrock-mantle.us-west-2.api.aws/openai/v1 です。Mantle エンドポイントでは、Responses API の URL ルートが Runtime エンドポイント(/v1/responses)とはわずかに異なり、/openai/v1/ となっています。
Grok 4.3 を SDK で設定する際は、前述のセクションで説明した通り、適切なリージョンとパスを含む基本 URL を指定してください。
Grok を利用する際、コンテキストウィンドウは 100 万トークンである点に留意してください。また、デフォルト値が標準的な OpenAI の仕様とは以下の 3 つの点で異なります。
- temperature は 1.0 ではなく 0.7 がデフォルトです。
- top_p は 1.0 ではなく 0.95 がデフォルトです。
- max_completion_tokens は 131072 に設定されています。
アプリケーションの要件に応じて、これらのパラメータは明示的に指定してください。
認証と最初のリクエスト実行
Mantle エンドポイントへの認証には 2 つの方法があり、どちらも同じ OpenAI SDK で動作します。本番環境では、IAM クレデンシャルから生成した短期間のベアラートークンを利用することを推奨します。これは自動で期限切れとなり、アクセス権限を IAM アイデンティティに紐付けられるためです。一方、クイックな探索や入門用には、長期有効な Amazon Bedrock API キーを使用できます。ただし、長期キーはあくまでその目的に限定し、本番アプリケーションのコードに埋め込むことは避けてください。
以下の例は、長期有効な Amazon Bedrock API キーを使用してモデルにアクセスするための認証方法を示しています。このキーはあくまで探索目的の資格情報として扱ってください。
Amazon Bedrock コンソール から API キーを生成 した後、OpenAI SDK をインストールします。
pip install openaiクライアントをリージョンごとの Mantle エンドポイントに指向させ、API キーで認証を行います。モデル ID は xai.grok-4.3 です。
from openai import OpenAI
client = OpenAI(
api_key="",
base_url="https://bedrock-mantle.us-west-2.api.aws/openai/v1",
)
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[
{"role": "user", "content": "Amazon Bedrock を一言で説明してください。"}
],
)
print(response.choices[0].message.content) アプリケーションへの組み込みにおいて、より高いセキュリティ要件が求められる場合は、短期有効な資格情報の使用を推奨します。既存の AWS 認証情報を用いて、リクエスト時に Amazon Bedrock トークンジェネレーター で短期有効なベアラートークンを生成できます。これにより、認証を IAM アイデンティティに紐付け、長期秘密鍵の使用を防ぐことができます。
まずは aws-bedrock-token-generator パッケージをインストールしてください。
pip install aws-bedrock-token-generator以下のコードのように、aws_bedrock_token_generator ライブラリから provide_token 関数を使用してトークンを取得します。
from aws_bedrock_token_generator import provide_token
from openai import OpenAI
client = OpenAI(
api_key=provide_token(region="us-west-2"),
base_url="https://bedrock-mantle.us-west-2.api.aws/openai/v1",
)推論出力の設定
Responses API の reasoning パラメータを用いて、モデルが推論に費やすリソースの量を制御できます。設定できるレベルは以下の通りです。
- none: 推論機能を無効化します
- low(デフォルト): 標準的な推論 effort
- medium: より深い推論
- high: 最も高い推論 effort
多段階の複雑な問題において、即座に答えを出すよりも正確性を重視する必要がある場合、より高いレベルの effort を設定すると効果的です。ただし、その分、出力トークンの消費量は増加します。
Chat Completions API では推論プロセス(思考の過程)は返されません。会話全体を通じてモデルの推論履歴を利用したい場合は、Responses API を使用してください。
デフォルトの状態維持パターンでは、store=True を設定し、previous_response_id を用いて呼び出しを連鎖させることで、各ターンでの推論結果が自動的に保持・再利用されます。そのため、ユーザー側で推論データを管理する必要はありません。
一方、状態を保持しない(ステートレス)ケースでは暗号化された推論データを利用します。サーバーサイドで会話履歴を保存したくない場合など、store=False を設定する場合は、include=["reasoning.encrypted_content"] を指定して推論データをリクエストに含めてください。取得した推論結果は、次のリクエストの入力としてモデルに渡すことで、過去の推論文脈として活用できます。
以下は、高レベルの推論 effort で古典的なトリック質問を実行する例です。
以下に、Amazon Bedrock で Grok を利用する際のコード例を示します。
response = client.responses.create(
model="xai.grok-4.3",
reasoning={"effort": "high"}, # none, low, medium, or high
include=["reasoning.encrypted_content"],
max_output_tokens=4096,
input=(
"A bat and ball cost $1.10. The bat costs $1 more than the ball. "
"How much is the ball? Answer with just the number."
),
)
print(response.output_text)
print(response.usage.output_tokens_details.reasoning_tokens)
このモデルは、直感的に導き出されやすい誤った答え(0.10 ドル)に飛びつくのではなく、代数的な計算プロセスを経て正解を導き出しました。また、使用状況のレポートには、内部で処理に要した推論トークンの数も含まれています。
もし推論の努力度を "none" に設定すると、同じフィールドには 0 という値が返されます。これは、単純なタスクやレイテンシ(応答遅延)を重視する呼び出しにおいて推奨される設定です。
response = client.responses.create(
model="xai.grok-4.3",
reasoning={"effort": "none"},
max_output_tokens=2048,
input="Say OK.",
)
print(response.output_text) # OK.
実務的な運用パターンとしては、分類処理、情報抽出、短時間の事実確認などは "none" または "low" で実行し、計画立案や数学的計算、あるいは初期のミスがその後の連鎖全体を破綻させるような複雑なタスクに対してのみ、推論努力度を "high" に設定するのが効果的です。
Grok 4.3 でツールを呼び出す
エージェントワークロードにおいて、ツールの呼び出し機能は不可欠です。Grok 4.3 は OpenAI と互換性のある同じインターフェースを通じてこの機能をサポートしています。利用可能なツールを記述すると、モデルがいつツールを呼び出すかを判断し、構造化されたリクエストを返します。その後、あなたのコードがこのリクエストを実行して結果をフィードバックします。
Grok 4.3 は標準的な OpenAI のツール呼び出し形式に従っているため、各ツールのパラメータには JSON Schema を定義する必要があります。
以下の例では、単一の get_weather ツールを用意し、これをトリガーする質問を投げかけています。
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}
]
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[{"role": "user", "content": "What's the weather in Sydney? Use the tool."}],
tools=tools,
tool_choice="auto", # let the model decide whether to call a tool
)
tool_call = response.choices[0].message.tool_calls[0]
print(tool_call.function.name, tool_call.function.arguments)
# get_weather {"city":"Sydney"}モデルは質問から都市情報を抽出し、スキーマに合致する有効な引数オブジェクトを生成しました。次に、自社のコードでこの関数を呼び出し、結果を含むツール役のメッセージを追加してモデルを再度実行します。これにより、モデルはデータを自然な言語による回答として統合できます。これが Grok 4.3 における多段階エージェントの基礎となる仕組みです。
##構造化された出力
コードが直接解析できる形でデータを返す必要がある場合、JSON スキーマを用いた構造化出力を利用してください。Grok 4.3 は厳格モード付きの json_schema レスポンス形式をサポートしており、自由なテキストを生成するのではなく、指定したスキーマに厳密に従った回答を返します。
例えば、以下のコードは国に関する事実を取得し、回答の形式を制限しています:
import json
schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"capital": {"type": "string"},
"population_millions": {"type": "number"},
},
"required": ["name", "capital", "population_millions"],
"additionalProperties": False,
}
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[{"role": "user", "content": "Return facts about the country Australia."}],
response_format={
"type": "json_schema",
"json_schema": {"name": "country_facts", "strict": True, "schema": schema},
},
max_completion_tokens=4096,
)必ず JSON 形式で返してください。translation フィールドのみを含め、他のフィールドは一切追加しないでください。余計なフィールドを記述しようとして本文がトークン上限に達し、出力が途中で切れてしまう事故を防ぐためです。
{"translation": "リライト全文"}
データ構造を確認するために、レスポンスのメッセージ内容を JSON パースし、結果を出力します。
data = json.loads(response.choices[0].message.content)
print(data)
# {'name': 'Australia', 'capital': 'Canberra', 'population_millions': 26.6}strict を True に設定し、additionalProperties を False にすることで、レスポンスを指定したキーのみに制限できます。これは、後続システムが固定されたレコード形式を期待している場合のツール呼び出しと非常に相性が良い設定です。
ただし、運用上の注意点として、テストでは意図しない benign な入力に対しても、自動的なコンテンツ安全チェックにより 400 エラーが返されることがあります。本番環境では、このエラーに対応した簡易なリトライ処理を実装しておくことを推奨します。
画像入力のサポート
Grok 4.3 は画像を入力として受け付け、テキストで回答を返すことができます。ドキュメントの理解、チャートの読み取り、視覚的な質問への回答などが可能です。
OpenAI の Chat Completions API と同じパターンを使用します。画像は data: URL に base64 でエンコードされたバイト列を含むコンテンツパート、あるいは公開されている画像 URL として指定します。テキストと画像の両方を同一のコンテンツ配列に含めることで、モデルが質問と画像を同時に認識できるようになります。
import base64
with open("chart.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()必ず JSON 形式で返してください。translation フィールドのみを含め、他のフィールドは一切追加しないでください。余計なフィールドを記述しようとして本文がトークン上限で打ち切られる事故を防ぐためです。
{"translation": "リライト全文"}response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in one short sentence."},
{
"type": "image_url",
"image_url": {"url": f"data:image/png;base64,{b64}"},
},
],
}
],
max_completion_tokens=4096,
)
print(response.choices[0].message.content)
テストでは、生成された画像を読み込み、その主な色を正しく識別しました。使用する画像形式は PNG または JPEG などの対応フォーマットに絞り、エンコードもきれいに保つ必要があります。画像データが破損していたり切り捨てられていたりすると、推測で答えを出すのではなく「validation_error(検証エラー)」が返されます。
Responses API を使った状態維持型会話
Responses API では、会話の状態をサービス側で保持できるため、毎回すべてのメッセージ履歴を送信する必要はありません。会話の 1 トーン(やり取り)を保存するには、store=True を指定して呼び出し、返された response ID を取得しておき、次の呼び出しで previous_response_id にその ID を渡します。すると、モデルは過去のやり取りを文脈として扱います。
first = client.responses.create(
model="xai.grok-4.3",
input="Remember the number 42. Just acknowledge.",
store=True,
max_output_tokens=2048,
)
second = client.responses.create(
model="xai.grok-4.3",
previous_response_id=first.id,
input="What number did I ask you to remember?",
max_output_tokens=2048,
)
print(second.output_text) # 42
コード例の 2 つ目の client.responses.create 呼び出しでは、previous_response_id 以外にメッセージは送信されていません。サービスが各会話履歴を保存しているため、モデルの過去の推論プロセスも自動的に次の呼び出しへ引き継がれます。これにより、会話内容とモデルの思考過程を両方とも文脈として維持しつつ、手動で状態管理を行う必要がありません。
ただし、この機能を有効にする前に知っておくべき点があります。会話履歴を保存するということは、サービス側がそのデータを保持することになるからです。保存されたデータのセキュリティやプライバシーについては、Amazon Bedrock のデータ保護 に関するドキュメントで確認してください。必要に応じて保持機能を無効化する方法についても記載されています。
サービスティアとリージョン対応状況
Amazon Bedrock では、ワークロードごとにコストとスループットを最適化できるよう、複数のサービスティアが用意されています。Standard ティアのオンデマンド推論は、利用したトークン数に応じた従量課金で、契約不要です。Priority ティアは、1 トークンあたりの料金は高くなりますが、処理キューでの優先処理が受けられます。一方、Flex ティアは、時間制約のないワークロード向けに低コストなアクセスを提供します。Grok 4.3 は、Standard、Priority、Flex のすべてのティアで利用可能です。詳細については、推論用のサービスティア をご覧ください。
Grok 4.3 では、リージョン内での推論(in-Region inference)のみがサポートされています。そのため、モデルが利用可能なリージョンにクライアントを固定し、Mantle のベース URL もそれに合わせて設定する必要があります。このモデルのローンチ時点では、地理的な制約を超えたクロスリージョン推論やグローバルなクロスリージョン推論は提供されていません。本記事の例では us-west-2 を使用しています。現在サポートされているリージョンの一覧については リージョン対応状況 のドキュメントを、各ティアごとの料金については Amazon Bedrock の価格設定 ページをご確認ください。
結論
Amazon Bedrock で利用可能な Grok 4.3 は、推論を最優先に設計されたモデルです。必要に応じて推論の強度を調整可能で、ネイティブなツール呼び出し機能や厳格な構造化出力、画像理解能力、サーバーサイドでの会話状態管理など、多様な機能を備えています。
このモデルへのアクセスは、Bedrock の Mantle エンドポイントを指す OpenAI SDK を使用して行います。本記事で紹介する例では、リクエストごとのトークン利用以外に課金対象となる AWS リソースは作成されません。ただし、探索目的で長期有効な Amazon Bedrock API キーを発行した場合は、使い終わったら必ずコンソールから削除してください。長期キーは恒久的な認証情報となるため、不要になったものを削除しておくことで、アカウントの攻撃対象範囲を最小限に抑えることができます。
開発を始めるには、まず現在のリージョン一覧とパラメータの詳細を確認できる Grok 4.3 モデルカード を参照し、トークン単価については Amazon Bedrock の価格ページ で確認してください。その上で、以下の方向性を検討することをお勧めします。
- 返された関数を実行し、その結果をフィードバックしてツール呼び出しのループをエンドツーエンドで実装する
- 応答間で暗号化された推論内容を継承させ、長時間稼働するエージェントが思考の一貫性を保てるようにする
- 自社のワークロードに対して推論レベルをベンチマークし、推論強度を上げてもトークンコストに見合わないポイントを見極める
原文を表示
*This post is co-written with Eric Jiang from xAI (SpaceXAI).*
xAI’s Grok 4.3 is now generally available on Amazon Bedrock, giving teams that build agents and AI workflows a model that reasons reliably over long inputs. With this launch, xAI joins Amazon Bedrock as a model provider. Grok 4.3 is a model with configurable reasoning effort. It offers strong tool use and instruction following for building agents, and token efficiency for high-volume inference. It accepts text and image input, and has a 1 million token context window for long documents and multi-turn sessions. The model runs on Mantle, the next-generation inference engine in Amazon Bedrock.
This post covers what makes Grok 4.3 a great fit for agentic and enterprise workloads, how you access it through Amazon Bedrock, and how to use the capabilities most teams reach for first: a basic chat request, configurable reasoning effort, tool calling, structured output, image input, and stateful multi-turn conversations.
Why Grok 4.3 is a great fit for agentic and reasoning workloads
According to xAI, Grok 4.3 is built for enterprise work where accuracy matters. On its own benchmarks at the time of the model launch, xAI reports it outperforms various industry benchmarks. Grok 4.3 ranked #1 on the Artificial Analysis Omniscience benchmark with the lowest hallucination rate among the frontier models it compared. It also placed #1 on the Artificial Analysis Tau2 Telecom benchmark for tool calling in customer support scenarios, and #1 on the Vals AI Case Law and Corporate Finance benchmarks for document understanding. xAI also places the model on the intelligence-versus-cost Pareto frontier, which it describes as 2 to 10 times more intelligence per dollar than other frontier models.
With Grok 4.3, you can control how much the model thinks before answering through an effort level on each request. You configure the effort level (none, low, medium, and high) per request and let one model serve the full range of work. A classification call can run at none effort to keep latency low. A contract analysis or case law task can run at high when depth matters more than response time. Grok 4.3 accepts text and image input and returns text, and its 1 million token context window leaves room for long documents and extended multi-turn sessions. The model handles tool calling and instruction following well, which is what makes it practical for agents that depend on function calls to take action. These traits line up with use cases such as contract review, credit agreement analysis, and financial document question answering. In these cases, the model reasons over long inputs and then calls out to systems of record.
How you access Grok 4.3 on Amazon Bedrock
Grok 4.3 runs on Mantle, and accessing it differs from models that use the Amazon Bedrock Runtime API. Mantle uses OpenAI-compatible APIs. You can invoke Grok 4.3 either with the OpenAI SDK or through direct HTTPS requests to the Chat Completions API or the Responses API.
The Mantle endpoint URL is Region-specific and follows this pattern:
For example, in us-west-2 the base URL is https://bedrock-mantle.us-west-2.api.aws/openai/v1. Note that the Responses API URL route differs slightly on the Mantle endpoint (/openai/v1/) from the Runtime endpoint (/v1/responses).
To set up your SDK with Grok 4.3, set the base URL with the correct Region and path as described in the preceding section.
When using Grok, note that the context window is 1 million tokens and that the defaults depart from the standard OpenAI specification in three places:
- temperature defaults to 0.7 rather than 1.
- top_p defaults to 0.95 rather than 1.
- max_completion_tokens defaults to 131072.
Set these explicitly if your application needs different behavior.
Authenticate and run a first request
You have two ways to authenticate against the Mantle endpoint, and both work with the same OpenAI SDK. For production, we recommend short-term bearer tokens generated from your IAM credentials, because they expire automatically and keep access tied to your IAM identity. Use a long-term Amazon Bedrock API key for quick exploration and getting started. Restrict long-lived keys to that purpose rather than embedding them in production applications.
The following example shows how to authenticate with a long-term Amazon Bedrock API key to access the model. Treat this as an exploration-only credential. You can generate one from the Amazon Bedrock console, and then install the OpenAI SDK:
pip install openaiPoint the client at the regional Mantle endpoint and authenticate with your API key. The model ID is xai.grok-4.3:
from openai import OpenAI
client = OpenAI(
api_key="",
base_url="https://bedrock-mantle.us-west-2.api.aws/openai/v1",
)
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[
{"role": "user", "content": "In one sentence, what is Amazon Bedrock?"}
],
)
print(response.choices[0].message.content)When you’re ready to incorporate Amazon Bedrock into applications with greater security requirements, we recommend using short-term credentials. You can generate a short-term bearer token from your existing AWS credentials at request time using the Amazon Bedrock token generator. This keeps authentication tied to your IAM identity and avoids a long-lived secret. To get started, install the aws-bedrock-token-generator package.
pip install aws-bedrock-token-generatorUse the provide_token function from the aws_bedrock_token_generator library in code as shown below:
from aws_bedrock_token_generator import provide_token
from openai import OpenAI
client = OpenAI(
api_key=provide_token(region="us-west-2"),
base_url="https://bedrock-mantle.us-west-2.api.aws/openai/v1",
)Configure reasoning output
You can control how much of reasoning effort the model spends through the reasoning parameter on the Responses API. The effort levels are none (which disables reasoning), low (the default), medium, and high. Higher effort tends to help on multi-step problems where a quick answer would be wrong, at the cost of more output tokens.
The Chat Completions API does not return a reasoning trace. If you want the model’s reasoning available across turns, use the Responses API. In the default stateful pattern, where you set store=True and chain calls with previous_response_id, the service retains each turn’s reasoning and feeds it back automatically, so you do not manage it yourself. Encrypted reasoning is for the stateless case. If you set store=False (for example, when your workload requires that turns are not persisted server-side), request the reasoning with include=["reasoning.encrypted_content"]. Pass it back in your next request’s input to give the model its own prior reasoning as context.
This example runs a classic trick question at high effort:
response = client.responses.create(
model="xai.grok-4.3",
reasoning={"effort": "high"}, # none, low, medium, or high
include=["reasoning.encrypted_content"],
max_output_tokens=4096,
input=(
"A bat and ball cost $1.10. The bat costs $1 more than the ball. "
"How much is the ball? Answer with just the number."
),
)
print(response.output_text)
print(response.usage.output_tokens_details.reasoning_tokens)The model worked through the algebra rather than reaching for the intuitive wrong answer of $0.10, and the usage block reports the reasoning tokens it spent internally. Drop the effort to none and that same field reports 0 reasoning tokens, which is the setting to reach for on simple, latency-sensitive calls:
response = client.responses.create(
model="xai.grok-4.3",
reasoning={"effort": "none"},
max_output_tokens=2048,
input="Say OK.",
)
print(response.output_text) # OK.A practical pattern is to run classification, extraction, and short factual lookups at none or low, and reserve high for planning steps, math, and chains where a single early mistake derails the whole task.
Call tools with Grok 4.3
Tool calling is central to agentic workloads, and Grok 4.3 supports it through the same OpenAI-compatible interface. You describe the tools available, the model decides when to call one, and it returns a structured request that your code executes and feeds back. Grok 4.3 follows the standard OpenAI tool-calling shape, so you define each tool with a JSON Schema for its parameters.
The following example offers a single get_weather tool and asks a question that should trigger it:
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}
]
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[{"role": "user", "content": "What's the weather in Sydney? Use the tool."}],
tools=tools,
tool_choice="auto", # let the model decide whether to call a tool
)
tool_call = response.choices[0].message.tool_calls[0]
print(tool_call.function.name, tool_call.function.arguments)
# get_weather {"city":"Sydney"}The model parsed the city out of the question and produced a valid arguments object that matches the schema. From here you run the function in your own code, append a tool role message with the result, and call the model again so it can fold the data into a natural-language reply. This is the building block for multi-step agents on Grok 4.3.
Structured output
When you need the model to return data your code can parse directly, use structured output with a JSON Schema. Grok 4.3 supports the json_schema response format with strict mode, so the response conforms to the schema you provide, rather than giving free-form text.
For example, the following code asks for facts about a country and constrains the shape of the answer:
import json
schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"capital": {"type": "string"},
"population_millions": {"type": "number"},
},
"required": ["name", "capital", "population_millions"],
"additionalProperties": False,
}
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[{"role": "user", "content": "Return facts about the country Australia."}],
response_format={
"type": "json_schema",
"json_schema": {"name": "country_facts", "strict": True, "schema": schema},
},
max_completion_tokens=4096,
)
data = json.loads(response.choices[0].message.content)
print(data)
# {'name': 'Australia', 'capital': 'Canberra', 'population_millions': 26.6}Setting strict to True and additionalProperties to False keeps the response constrained to the keys you asked for, which pairs well with tool calling when a downstream system expects a fixed record format. One operational note from testing: requests occasionally return a 400 from an automated content safety check even on benign input, so build a short retry into production calls.
Image input
Grok 4.3 accepts images as input and returns text, which covers document understanding, chart reading, and visual question answering. You pass an image using the same pattern as the OpenAI Chat Completions API, as a content part with a data: URL holding base64-encoded bytes, or a public image URL. The text and image parts go in the same content array so the model sees the question and the picture together.
import base64
with open("chart.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="xai.grok-4.3",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in one short sentence."},
{
"type": "image_url",
"image_url": {"url": f"data:image/png;base64,{b64}"},
},
],
}
],
max_completion_tokens=4096,
)
print(response.choices[0].message.content)In testing, the model read a generated test image and named its dominant color correctly. Use a supported image format such as PNG or JPEG and keep the encoding clean: a malformed or truncated image payload returns a validation_error rather than a best-guess answer.
Stateful conversations with the Responses API
The Responses API can hold conversation state on the service side, so you do not need to resend the full message history on every turn. You store a turn by passing store=True, capture the returned response ID, and reference it on the next call with previous_response_id. The model treats the earlier exchange as context.
first = client.responses.create(
model="xai.grok-4.3",
input="Remember the number 42. Just acknowledge.",
store=True,
max_output_tokens=2048,
)
second = client.responses.create(
model="xai.grok-4.3",
previous_response_id=first.id,
input="What number did I ask you to remember?",
max_output_tokens=2048,
)
print(second.output_text) # 42From the second client.responses.create call in the code example, there is no message being sent except for the previous_response_id. Because the service stores each turn, the model’s prior reasoning is carried forward automatically to the next call, so you keep both the conversation and the model’s thinking in scope without managing that state yourself. One thing to know before you turn this on: storing conversation state means the service retains those turns. Review the Amazon Bedrock data protection documentation for details on the security and privacy of your stored data, and how to disable retention if needed.
Service tiers and Regional availability
Amazon Bedrock offers multiple service tiers so you can match cost and throughput to each workload. Standard tier on-demand inference provides pay-per-token access with no commitment, Priority offers preferential treatment in the processing queue for a higher per-token price, and Flex provides lower-cost access for workloads that are not time-sensitive. You can use Grok 4.3 with the Standard, Priority, and Flex tiers. For details, see service tiers for inference.
Grok 4.3 uses in-Region inference, so you pin your client to a Region where the model is available and set the Mantle base URL to match. Geo and Global cross-Region inference are not offered for this model at launch. The examples in this post use us-west-2. For the current list of supported Regions, see the Regional availability documentation, and for pricing across the tiers, see the Amazon Bedrock pricing page.
Conclusion
Grok 4.3 on Amazon Bedrock gives you a reasoning-first model with configurable effort, native tool calling, strict structured output, image understanding, and server-side conversation state. You can reach the model through the OpenAI SDK pointed at the bedrock-mantle endpoint. The examples in this post do not create billable AWS resources beyond per-request token usage. But if you generated a long-term Amazon Bedrock API key for exploration, delete it from the Amazon Bedrock console when you are done. A long-term key is a standing credential, so removing the ones you no longer need keeps your account’s attack surface small.
To start building, review the Grok 4.3 model card for the current Region list and parameter details, and see the Amazon Bedrock pricing page for token rates. From there, a few directions are worth exploring: wire the tool-calling loop end to end by executing the returned function and feeding the result back, thread encrypted reasoning content across Responses turns to give long-running agents continuity in how they think, and benchmark effort levels against your own workloads to find where higher reasoning stops earning its token co
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み