1. Add the Bedrock provider to Codex CLI
Install or update Codex CLI, generate an AWS Bedrock API key with permission to invoke Ergo, and export AWS_BEARER_TOKEN_BEDROCK in your shell. Never hardcode credentials inside TOML files.
Add this provider block to ~/.codex/config.toml:
[model_providers.bedrock-ergo]
name = "Amazon Bedrock Ergo"
base_url = "https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1"
env_key = "AWS_BEARER_TOKEN_BEDROCK"
wire_api = "responses"
2. Save an isolated Ergo profile
Current Codex CLI reads standalone profile files rather than nested [profiles.*] blocks. Save ~/.codex/ergo.config.toml:
model = "global.amazon.ergo-1.0"
model_provider = "bedrock-ergo"
model_reasoning_effort = "medium"
model_context_window = 1048568
web_search = "disabled"
3. Launch and verify on a test repo
export AWS_REGION=us-west-2
export AWS_BEARER_TOKEN_BEDROCK="your-bedrock-api-key"
codex --profile ergo
Start in a disposable or read-only repository and ask Codex to summarize the project structure without editing files. Confirm the status bar shows global.amazon.ergo-1.0 and verify the request appears in your AWS Bedrock usage dashboard.
Common Codex + Ergo issues
- Web search tool errors: Keep
web_search = "disabled"insideergo.config.tomlas documented in AWS’s coding-tool guide. - Region mismatch: Make sure
AWS_REGIONmatches the region inbase_url(us-west-2). - Higher token spend than expected: Lower
model_reasoning_effortfromhightomediumorlowfor routine file inspection, and project costs in the API cost calculator.
Want to compare alternative endpoints? See the Amazon Ergo API guide or all coding agent guides.
Frequently asked questions
Does this setup replace my default Codex CLI model?
No. Placing Amazon Ergo in ~/.codex/ergo.config.toml keeps your default Codex model untouched; Ergo only activates when you pass --profile ergo.
Does my Codex subscription cover Amazon Ergo Bedrock requests?
No. Requests sent through this profile bill directly to your Amazon Bedrock account under AWS_BEARER_TOKEN_BEDROCK, separate from OpenAI Codex billing.
Why must web_search be disabled in ergo.config.toml?
AWS’s Bedrock OpenAI-compatible Responses endpoint for Ergo does not support Codex’s built-in hosted web search tool, so leaving it enabled triggers request errors.