> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon Ergo

> Integration guide for Amazon Ergo (ergo-1.0): 1.1T MoE, 55B active parameters, 1M context, always-on reasoning, Claude Code and Anthropic-native access, plus pricing, output budgets, streaming, tool calling, caching, and tested limits.

## Overview

**Amazon Ergo** is an open-weights frontier model from Amazon Frontier Model Research, built for software engineering and agentic workflows. It is a mixture-of-experts model with 1.1 trillion total parameters and 55 billion active parameters, a native 1M-token context window, and up to 128K output tokens. It is designed for long-running tasks that require planning, tool use, and self-checking.

APIYI serves the model as **`ergo-1.0`**, with OpenAI-compatible Chat Completions and Responses endpoints plus an Anthropic-compatible Messages endpoint. It works directly with Claude Code and other Anthropic-native clients. Input and output are text only; image input is not supported.

> [!NOTE]
>
> **Highlights:** 1M context, 128K max output, tool calling with parallel tools, structured output, and prefix caching. A good fit for coding, terminal agents, document review, and multi-step automation.

> [!WARNING]
>
> **Amazon Ergo always reasons, and reasoning is billed as output.** Do not set `max_tokens` too low: reasoning consumes the budget first, and an exhausted budget can leave the final answer empty or truncated.

> [card] [Pricing & Groups](#pricing)
>
> Official list price; Default / SVIP for OpenAI-compatible, ClaudeCode for Claude Code.

> [card] [Quick Start](#quick-start)
>
> Call Chat Completions with the OpenAI SDK or cURL.

> [card] [Reasoning Budget](#reasoning-and-output-budget)
>
> Understand fixed reasoning and set output budgets correctly.

> [card] [Long Context](#long-context)
>
> Tested limits and best practices for the 1M window.

## Pricing

Amazon Ergo is billed by token usage. **APIYI list prices match Amazon's official prices with no markup.** All prices are in **USD per 1M tokens**:

| Item | Price |
| - | - |
| Standard input | \$1.00 |
| Output (including reasoning) | \$3.00 |
| Cache read | \$0.03 |
| Cache write (official 30-minute TTL tier) | \$1.25 |

> [!NOTE]
>
> Model prices are aligned with the official website and may change when the official prices change. The table above is for reference only; the **Model Pricing** tab in the top navigation is authoritative: [Model Pricing](https://docs.apiyi.com/en/models/index.md).

### Effective cost with top-up bonuses

The list price does not change. When you meet the conditions of the [top-up bonus program](https://docs.apiyi.com/en/faq/recharge-promotions.md), a single top-up receives a **10%–20% bonus**, which brings the effective cost to roughly **83%–91% of the list price**:

| Single top-up amount | Bonus | Effective cost vs. list |
| - | - | - |
| \$100 ≤ X \< \$500 | 10% | About 91% |
| \$500 ≤ X \< \$1,000 | 12% | About 89% |
| \$1,000 ≤ X \< \$3,000 | 15% | About 87% |
| \$3,000 tier | 20% | About 83% |

> [!NOTE]
>
> The discount comes from top-up bonuses, not from a lower model price. Eligibility, rates, and stacking rules are defined on the [recharge promotions page](https://docs.apiyi.com/en/faq/recharge-promotions.md).

### Cost examples

Because the model always reasons, output tokens run well above the visible answer length. The following APIYI test samples are estimated at \$3.00 per 1M output tokens:

| Task | Output tokens (including reasoning) | Approx. output cost |
| - | -: | -: |
| One-line answer | 50–150 | Less than \$0.001 |
| \~200-word explanation | \~3,000 | \~\$0.009 |
| Medium coding task | \~4,600 | \~\$0.014 |

## Group Setup

The model has three group entry points:

| Use case | Token group | Rate |
| - | - | - |
| OpenAI-compatible (Chat Completions / Responses) | `Default` or `SVIP` | 1x |
| Anthropic native / Claude Code | `ClaudeCode` | 0.95x |

The `ClaudeCode` group is billed at a 0.95 rate (about 95% of list); top-up bonuses lower the effective cost further — see the [recharge promotions page](https://docs.apiyi.com/en/faq/recharge-promotions.md). OpenAI-compatible calls do not need a group change; for Claude Code and other Anthropic clients, switch the Token's group to `ClaudeCode`.

For the Token's **Billing model**, choose either `Pay-as-you-go` or `Pay-as-you-go Priority`. `Pay-per-request` does not apply to token-billed text models.

## Tested Capabilities

APIYI validated the following cases for `ergo-1.0` on **2026-12-04 (UTC+8)**:

| Capability | Result |
| - | - |
| Non-streaming chat | Passed |
| Streaming output | Passed |
| Tool calling and tool-result round trip | Passed |
| Parallel tool calls | Passed |
| JSON object output | Passed |
| JSON Schema structured output | Passed |
| logprobs | Passed |
| Basic Responses API call | Passed |
| Anthropic Messages / Claude Code end to end | Passed, including thinking, tool\_use, multi-turn replay, and streaming |
| Claude Code CLI (with Read tool) | Passed |
| 1M-context retrieval | Passed; a mid-document fact was found with 1,026,083 input tokens |
| Prefix cache write and read | Passed; 5-minute cache tier write and read verified |
| Image input | Not supported; returns 400 |

> [!NOTE]
>
> The table covers basic request/response semantics, not every parameter, the full context range, or long-running behavior. Longer cache TTL tiers and batch inference were not part of this validation round.

## Quick Start

Use an APIYI Token and call `POST /v1/chat/completions`. Amazon recommends a `max_completion_tokens` value of at least 8192 to leave room for reasoning.

```bash cURL theme={null}
curl https://api.apiyi.com/v1/chat/completions \
  -H "Authorization: Bearer $APIYI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ergo-1.0",
    "messages": [
      {"role": "user", "content": "Write a Python HTTP request function with retries and explain the retry strategy."}
    ],
    "max_completion_tokens": 8192
  }'
```

```python Python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["APIYI_API_KEY"],
    base_url="https://api.apiyi.com/v1",
    timeout=600,
)

response = client.chat.completions.create(
    model="ergo-1.0",
    messages=[
        {"role": "user", "content": "Write a Python HTTP request function with retries and explain the retry strategy."}
    ],
    max_completion_tokens=8192,
)

message = response.choices[0].message
print(message.content)
print(response.usage)
```

> [!TIP]
>
> For long tasks or large contexts, set client timeouts to at least 600 seconds. Use streaming when you need to show progress in real time.

## Claude Code and Anthropic Native Access

The `/v1/messages` endpoint for `ergo-1.0` is live on APIYI and works directly with Claude Code and other Anthropic-native clients. Validation covered basic chat, tool calling, `thinking` block replay, `tool_result` replay, and streaming; an end-to-end Claude Code CLI run with the Read tool also passed.

```bash theme={null}
export ANTHROPIC_BASE_URL=https://api.apiyi.com
export ANTHROPIC_AUTH_TOKEN=sk-your-apiyi-key
export ANTHROPIC_MODEL=ergo-1.0
export ANTHROPIC_SMALL_FAST_MODEL=ergo-1.0
```

Select the **`ClaudeCode`** Token group (0.95x rate, about 95% of list); OpenAI-compatible calls continue to use `Default` / `SVIP`. Claude Code may show an `unrecognized_model` warning; it does not affect the call.

**Watch the output budget**: Ergo always reasons, so a `max_tokens` below 8192 is more likely to produce an empty answer. Claude Code sets its own output limit; if the answer is empty, check whether reasoning consumed the budget and raise the client limit.

> [!NOTE]
>
> With the Anthropic SDK, point the base URL to `https://api.apiyi.com`, send `anthropic-version: 2023-06-01`, and keep the model ID as `ergo-1.0`.

## Reasoning and Output Budget

Amazon Ergo **always reasons** and cannot disable reasoning. The official `reasoning_effort` parameter adjusts the reasoning level and accepts `low`, `medium`, `high`, `xhigh`, and `max`. `none` is not an official value and returns 400 on Bedrock. Even when a compatibility layer accepts `none`, it does not turn reasoning off.

| Parameter | Usage |
| - | - |
| `reasoning_effort` | Adjusts reasoning level: `low` / `medium` / `high` / `xhigh` / `max` |
| `max_completion_tokens` | Total output budget for this request, including reasoning and the final answer; Amazon recommends at least 8192 |
| `stream` | Set to `true` for streaming |
| `stream_options.include_usage` | Set to `true` to receive usage in the final chunk |
| `tools` | Defines function tools executed by your application |

> [!WARNING]
>
> **Do not use switches from other models to try to turn off reasoning.** `enable_thinking` and `thinking: {"type": "disabled"}` do not apply to Amazon Ergo and do not stop reasoning content from being produced. Use `reasoning_effort` to adjust the level and `max_completion_tokens` to control the total budget.

### Reading the response

The final answer is in `choices[0].message.content`; reasoning is in `choices[0].message.reasoning_content`. Read `content` when you only need the conclusion, and `reasoning_content` when you want to show the thought process.

Reasoning tokens are billed at the output price. Do not estimate cost from the visible answer alone; use `usage` and the console logs.

### Recommended output budgets

| Scenario | Suggested `max_completion_tokens` |
| - | -: |
| Short Q\&A, classification, extraction | Start at 4,000 |
| Explanations, writing, document work | Start at 8,000 |
| Coding, multi-step agents | Start at 16,000 |
| Near-128K outputs | Set as needed, up to 131,072 |

> [!NOTE]
>
> If `finish_reason` is `length` and `content` is empty, reasoning most likely consumed the entire budget. Raise `max_completion_tokens` and retry; do not treat this as the model being unavailable.

## Streaming

Reasoning arrives through `delta.reasoning_content`; the final answer arrives through `delta.content`. The last chunk may include `usage`, so check `chunk.usage` before reading `choices`.

```python theme={null}
stream = client.chat.completions.create(
    model="ergo-1.0",
    messages=[{"role": "user", "content": "Design a task queue with a retry mechanism."}],
    max_completion_tokens=16384,
    stream=True,
    stream_options={"include_usage": True},
)

for chunk in stream:
    if chunk.usage is not None:
        print("\nUsage:", chunk.usage)
    if not chunk.choices:
        continue

    delta = chunk.choices[0].delta
    reasoning = getattr(delta, "reasoning_content", None)
    if reasoning:
        # Send reasoning to a separate UI area so it does not mix with the answer.
        pass
    if delta.content:
        print(delta.content, end="", flush=True)
```

## Tool Calling

The model generates function names and arguments; your application executes the tools. After receiving `tool_calls`, append the full assistant message to the history, then append each tool result with its matching `tool_call_id`, and send the next request.

```python theme={null}
import json

messages = [{"role": "user", "content": "Check the delivery status of order A100."}]
tools = [{
    "type": "function",
    "function": {
        "name": "get_order_status",
        "description": "Look up the delivery status of an order",
        "parameters": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
            "additionalProperties": False,
        },
    },
}]

response = client.chat.completions.create(
    model="ergo-1.0",
    messages=messages,
    tools=tools,
    max_completion_tokens=8192,
)
message = response.choices[0].message
messages.append(message.model_dump(exclude_none=True))

if message.tool_calls:
    for call in message.tool_calls:
        arguments = json.loads(call.function.arguments)
        # Example result only; validate arguments and call the real order service in production.
        result = {"order_id": arguments["order_id"], "status": "shipped"}
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": json.dumps(result),
        })

    final = client.chat.completions.create(
        model="ergo-1.0",
        messages=messages,
        tools=tools,
        max_completion_tokens=8192,
    )
    print(final.choices[0].message.content)
else:
    print(message.content)
```

> [!TIP]
>
> To look up several objects at once, define the tools in a single request and ask the model to query them together. It returns multiple `tool_calls`, which you can execute in parallel and return in one batch.

## Prompt Caching

Amazon Ergo supports prefix caching. Put stable content first (system prompts, codebase notes, long documents) and the changing question last. This reduces latency and cost for repeated input.

| Item | Details |
| - | - |
| Cache read | Billed at \$0.03 per 1M tokens |
| Cache write | Billed on the official cache-write tier; the official price list currently shows \$1.25 per 1M tokens for the 30-minute TTL tier |
| Tested tier | The 5-minute tier's cache write and read both passed; longer TTL tiers were not part of this round |

> [!WARNING]
>
> Confirm cache hits from the cache fields in `usage` and the console logs, not just from a successful request. Cache TTLs and write pricing may change with the official prices; use the Model Pricing tab and the console for budgeting.

## Long Context

The official context window is **1,048,576 tokens**, with a maximum input of **1,047,552 tokens** and a maximum output of **131,072 tokens**.

| Input size | Test result |
| - | - |
| 1,026,083 tokens | Passed; a mid-document fact was found exactly |
| 1,116,051 tokens | Returned 400 for exceeding model capacity |

**1. Put stable content first**

Keep system prompts, codebase notes, and long documents at the front and the question at the end so prefix caching can reuse them.

**2. Budget input and output together**

Input plus `max_completion_tokens` must fit within the 1,048,576-token window. Compress the input first when you approach the limit.

**3. Stream long runs**

Time to first token on a 1M-token input can reach tens of seconds. Streaming avoids client timeouts and surfaces reasoning progress early.

## Technical Specs

| Item | Details |
| - | - |
| Model ID | `ergo-1.0` |
| Developer | Amazon Frontier Model Research |
| Architecture | 1.1T total-parameter MoE, 55B active parameters |
| Context window | 1,048,576 tokens |
| Max input | 1,047,552 tokens |
| Max output | 131,072 tokens |
| Input modality | Text only |
| Output modality | Text |
| Knowledge cutoff | May 2026 (official model card) |
| Reasoning | Always on; `reasoning_effort` accepts `low` / `medium` / `high` / `xhigh` / `max` |
| Official sampling | `temperature=1.0`, `top_p=0.99` |
| Primary endpoint | `POST https://api.apiyi.com/v1/chat/completions` (OpenAI-compatible) |
| Compatible endpoints | `/v1/responses` (OpenAI), `/v1/messages` (Anthropic native) |
| Anthropic access | Base URL `https://api.apiyi.com`, `anthropic-version: 2023-06-01`, group `ClaudeCode` |
| Final answer field | `choices[0].message.content` |
| Reasoning field | `choices[0].message.reasoning_content` |

## FAQ

> [accordion] Can I turn off reasoning?
>
> No. Amazon Ergo is designed to always reason; `enable_thinking` and `thinking disabled` do not take effect. You can adjust the level with `reasoning_effort`, but you cannot reduce reasoning to zero.

> [accordion] Why is the returned content empty?
>
> The most common cause is a `max_completion_tokens` value that is too small: reasoning consumes the budget first and `finish_reason` becomes `length`. Raise the budget to at least 8,000 and retry; use 16,000 or more for coding and long tasks.

> [accordion] Does it support image input?
>
> No. This version of Amazon Ergo is text-only; images, screenshots, and diagrams return 400. Use a vision model such as Gemini, GPT, or Qwen when you need image understanding.

> [accordion] Which APIs are supported?
>
> OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages. With the OpenAI SDK, set `base_url` to `https://api.apiyi.com/v1`. With the Anthropic SDK, point the base URL to `https://api.apiyi.com` and send the `anthropic-version` header.

> [accordion] Does it work with Claude Code?
>
> Yes. `/v1/messages` is live on APIYI; basic chat, tool calling, thinking replay, and streaming have been validated. Set `ANTHROPIC_BASE_URL=https://api.apiyi.com`, `ANTHROPIC_AUTH_TOKEN`, and `ANTHROPIC_MODEL=ergo-1.0`, and select the `ClaudeCode` group. An unrecognized-model warning does not block calls.

> [accordion] Why does the output cost exceed the visible answer length?
>
> Reasoning tokens are billed at the output price. `usage.completion_tokens_details.reasoning_tokens` reports the reasoning usage; use `usage` and the console logs for cost, not the answer character count.

> [accordion] How is prompt caching billed?
>
> Cache reads cost \$0.03 per 1M tokens. Cache writes use the official cache-write tier; the current official price list shows \$1.25 per 1M tokens for the 30-minute TTL tier. Check `usage` and the console logs for actual hits and charges.

> [accordion] What is the maximum output?
>
> 131,072 tokens (128K). Budget input and `max_completion_tokens` together against the 1,048,576-token window.

> [accordion] Does it support parallel tool calls?
>
> Yes. When a single request returns multiple `tool_calls`, execute them in parallel and return each result with its matching `tool_call_id`.

> [accordion] What sampling parameters does Amazon recommend?
>
> Amazon recommends `temperature=1.0` and `top_p=0.99`. You can lower the temperature for more deterministic output, but that moves away from the official recommendation.

> [accordion] Why is the top-up discount 83%–91%?
>
> The list price does not change. A 10%–20% top-up bonus increases available credit by 1.1–1.2x, which works out to roughly 83%–91% of the list price. See the [recharge promotions page](https://docs.apiyi.com/en/faq/recharge-promotions.md) for eligibility and rules.

## Related Docs

* [Text Generation API Overview](https://docs.apiyi.com/en/api-capabilities/text-generation.md)
* [API Manual](https://docs.apiyi.com/en/api-manual.md)
* [Function Calling Basics](https://docs.apiyi.com/en/api-capabilities/openai/function-calling.md)
* [Handling Reasoning Model Responses](https://docs.apiyi.com/en/api-capabilities/openai/reasoning-models.md)
* [Claude Code Integration](https://docs.apiyi.com/en/scenarios/programming/claude-code.md)
* [Model Pricing](https://docs.apiyi.com/en/models/index.md)
* [Group Guide](https://docs.apiyi.com/en/groups.md)
* [Recharge Promotions](https://docs.apiyi.com/en/faq/recharge-promotions.md)

Official references: `huggingface.co/Amazon-FMR/Ergo`, `aboutamazon.com/amazon-ergo`, `docs.aws.amazon.com/bedrock/latest/userguide/model-card-amazon-ergo-1-0.html`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.