

# Use Amazon Ergo-1.0 with coding tools

You can use Amazon Ergo-1.0 with popular coding tools including Claude Code, Codex CLI, OpenCode, and Kiro. This page explains how to configure each tool to call Amazon Ergo-1.0 through Amazon Bedrock. For more information, see [Amazon Ergo-1.0](model-card-amazon-ergo-1-0.md).

## Prerequisites
<a name="model-card-amazon-ergo-1-0-coding-tools-prereqs"></a>

Complete the following steps before you configure a coding tool.

### Create an AWS account
<a name="model-card-amazon-ergo-1-0-coding-tools-prereqs-account"></a>

If you already have an AWS account, skip this step. To create a new account, go to [Sign up for AWS](https://portal.aws.amazon.com/billing/signup).

### Required IAM permissions
<a name="model-card-amazon-ergo-1-0-coding-tools-prereqs-iam"></a>

Attach a policy that allows invoking Amazon Ergo-1.0 to the IAM identity that makes calls. The following policy allows invoking Amazon Ergo-1.0 through the US and Global cross-Region inference profiles.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": [
        "arn:aws:bedrock:*:*:inference-profile/us.amazon.ergo-1.0",
        "arn:aws:bedrock:*:*:inference-profile/global.amazon.ergo-1.0",
        "arn:aws:bedrock:*::foundation-model/amazon.ergo-1.0"
      ]
    }
  ]
}
```

### Generate an API key
<a name="model-card-amazon-ergo-1-0-coding-tools-prereqs-apikey"></a>

To generate a long-term API key, go to the [Amazon Bedrock console](https://console.aws.amazon.com/bedrock/home#/api-keys/long-term/create) and choose **API keys**, then choose **Create long-term key**. Store the key value as the environment variable `AWS_BEARER_TOKEN_BEDROCK`.

As an alternative, you can generate a short-term key programmatically using `aws-bedrock-token-generator`:

```python
from aws_bedrock_token_generator import provide_token
token = provide_token(region="us-west-2")
```

Short-term keys expire; you must regenerate them when expired.

### Install the SDKs
<a name="model-card-amazon-ergo-1-0-coding-tools-prereqs-sdks"></a>

Install the SDKs for the APIs you plan to use.

```bash
# Responses and Chat Completions APIs (OpenAI SDK)
pip install -U openai aws-bedrock-token-generator

# Converse and InvokeModel APIs (AWS SDK for Python)
pip install -U boto3
```

## Model IDs and endpoint
<a name="model-card-amazon-ergo-1-0-coding-tools-modelids"></a>

Use an inference profile ID, not the base model ID, in all API calls. The base model ID `amazon.ergo-1.0` cannot be called directly.


| **Inference profile ID** | **Regions served** | 
| --- | --- | 
| global.amazon.ergo-1.0 | Any commercial AWS Region | 
| us.amazon.ergo-1.0 | US Regions only | 

The endpoint URL is `https://bedrock-runtime.<region>.amazonaws.com`. The examples in this topic use `us-west-2`.

**Note**  
Amazon Ergo-1.0 always reasons. A reasoning effort of `none` returns a 400 error. Set an output limit of at least 8,192 tokens. Amazon Ergo-1.0 uses some of that limit for reasoning before it answers.

## Set up OpenCode with Amazon Ergo-1.0
<a name="model-card-amazon-ergo-1-0-coding-tools-opencode"></a>

OpenCode ([opencode.ai](https://opencode.ai)) uses the Chat Completions API to connect directly to Amazon Bedrock.

**To set up OpenCode with Amazon Ergo-1.0**

1. Install OpenCode from [opencode.ai](https://opencode.ai).

1. Add Amazon Ergo-1.0 to `~/.config/opencode/opencode.json`:

   ```json
   {
     "$schema": "https://opencode.ai/config.json",
     "provider": {
       "bedrock-runtime": {
         "npm": "@ai-sdk/openai-compatible",
         "name": "Amazon Bedrock",
         "options": {
           "baseURL": "https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1",
           "apiKey": "{env:AWS_BEARER_TOKEN_BEDROCK}"
         },
         "models": {
           "global.amazon.ergo-1.0": {
             "name": "Ergo 1.0",
             "limit": { "context": 1048568, "output": 131072 },
             "options": { "reasoningEffort": "medium" }
           }
         }
       }
     },
     "model": "bedrock-runtime/global.amazon.ergo-1.0"
   }
   ```

   Each request reserves its full output limit against your account's quota, so keep `limit.output` close to what you need.

1. Run `opencode` in your project folder. To switch models, type `/models` and choose Amazon Ergo-1.0.

## Set up Codex CLI with Amazon Ergo-1.0
<a name="model-card-amazon-ergo-1-0-coding-tools-codex"></a>

Codex CLI (`@openai/codex`) uses the Responses API to connect directly to Amazon Bedrock.

**To set up Codex CLI with Amazon Ergo-1.0**

1. Install Codex CLI:

   ```bash
   npm i -g @openai/codex
   ```

   Alternatively, install with Homebrew: `brew install codex`.

1. Add the following to `~/.codex/config.toml`:

   ```toml
   model = "global.amazon.ergo-1.0"
   model_provider = "bedrock-runtime"
   model_reasoning_effort = "medium"
   web_search = "disabled"            # required: built-in server-side tools such as web search aren't supported
   model_context_window = 1048568
   
   [model_providers.bedrock-runtime]
   name = "Amazon Bedrock"
   base_url = "https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1"
   env_key = "AWS_BEARER_TOKEN_BEDROCK"
   wire_api = "responses"
   ```

   Also set `AWS_REGION=us-west-2` in `~/.zshrc` or `~/.bashrc`. Codex does not read the Region from the AWS CLI profile.

1. Run `codex` in your project folder, or run `codex exec "your prompt"`. Add `--skip-git-repo-check` outside a git repo or trusted folder.

**Note**  
Codex might print "Model metadata for `global.amazon.ergo-1.0` not found" at startup. You can ignore this message.

## Set up Claude Code with Amazon Ergo-1.0
<a name="model-card-amazon-ergo-1-0-coding-tools-claudecode"></a>

Claude Code uses the Anthropic Messages API. To use it with Amazon Ergo-1.0, run a local LiteLLM proxy. The proxy translates Claude Code requests into Amazon Bedrock Responses API calls.

**To set up Claude Code with Amazon Ergo-1.0**

1. Install Claude Code from [code.claude.com](https://code.claude.com/docs) and install `uv` from [docs.astral.sh/uv](https://docs.astral.sh/uv/getting-started/installation/).

1. Save the following LiteLLM configuration as `~/ergo-claude-code/litellm.yaml`:

   ```yaml
   model_list:
     - model_name: global.amazon.ergo-1.0
       litellm_params:
         model: openai/global.amazon.ergo-1.0
         api_base: https://bedrock-runtime.us-west-2.amazonaws.com/openai/v1
         api_key: os.environ/AWS_BEARER_TOKEN_BEDROCK
         extra_body:
           reasoning:
             effort: medium        # set the reasoning effort explicitly
   litellm_settings:
     drop_params: true             # drop parameters the model doesn't accept
   general_settings:
     master_key: sk-ergo-local     # any string; Claude Code sends it as its auth token
   ```

   The value `sk-ergo-local` is a user-chosen local placeholder string for the proxy, not a real credential. You can use any string as long as the value here matches `ANTHROPIC_AUTH_TOKEN` in the launcher script in the following step. The proxy reads `AWS_BEARER_TOKEN_BEDROCK` at startup; restart the proxy after a key change.

1. Start the LiteLLM proxy:

   ```bash
   uv tool run --from 'litellm[proxy]' litellm \
     --config ~/ergo-claude-code/litellm.yaml --host 127.0.0.1 --port 4000
   ```

1. Save the following launcher script as `~/ergo-claude-code/claude-ergo` and make it executable with `chmod +x ~/ergo-claude-code/claude-ergo`:

   ```bash
   #!/usr/bin/env bash
   export ANTHROPIC_BASE_URL="http://127.0.0.1:4000"
   export ANTHROPIC_AUTH_TOKEN="sk-ergo-local"                     # must match master_key in litellm.yaml
   export ANTHROPIC_MODEL="global.amazon.ergo-1.0"
   export ANTHROPIC_DEFAULT_OPUS_MODEL="global.amazon.ergo-1.0"
   export ANTHROPIC_DEFAULT_SONNET_MODEL="global.amazon.ergo-1.0"
   export ANTHROPIC_DEFAULT_HAIKU_MODEL="global.amazon.ergo-1.0"
   export CLAUDE_CODE_SUBAGENT_MODEL="global.amazon.ergo-1.0"
   export CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048568"
   unset CLAUDE_CODE_USE_BEDROCK                                    # this setup uses the proxy, not Bedrock mode
   exec claude "$@"
   ```

1. Run `~/ergo-claude-code/claude-ergo` in your project folder.

**Note**  
If `~/.claude/settings.json` has an `env` block that sets `CLAUDE_CODE_USE_BEDROCK` or `ANTHROPIC_MODEL`, those values override the launcher. Use `--setting-sources project,local` to skip user settings.

## Troubleshooting
<a name="model-card-amazon-ergo-1-0-coding-tools-troubleshooting"></a>

Use the following table to diagnose common errors.


| **Error** | **Fix** | 
| --- | --- | 
| 400 Invocation of model ID amazon.ergo-1.0 with in-region isn't supported | Use global.amazon.ergo-1.0 or us.amazon.ergo-1.0 instead of the base model ID. | 
| 400 The provided model identifier is invalid | Call from a supported Region, and confirm that your account has access to Amazon Ergo-1.0. | 
| 403 AccessDeniedException | Add the permissions in the IAM permissions step to the IAM identity, or to the IAM user associated with your API key. | 
| 403 UnrecognizedClientException | Confirm that AWS\_BEARER\_TOKEN\_BEDROCK is set and the key hasn't expired. | 
| 429 ThrottlingException | Your account's quota is used up. Retry later, lower the output limit, or request a quota increase. | 
| Empty answer (finish\_reason: "length", status: "incomplete", stopReason: "max\_tokens") | Raise the output limit to at least 8,192 tokens. | 
| Codex: error about the web\_search tool | Set web\_search = "disabled" in config.toml. | 
| Codex: Amazon Bedrock bearer token auth requires ... AWS\_REGION | Set AWS\_REGION to the Region in base\_url (see the Codex CLI section). | 
| Claude Code: authentication error from the proxy | Confirm that ANTHROPIC\_AUTH\_TOKEN matches master\_key in litellm.yaml. | 