← Home

Ergo Model API reference

Ergo Model serves Amazon Ergo over an OpenAI-compatible Chat Completions API. There are two endpoints, one model and one key format. This page lists every request field we forward, the response shape, the prices, the limits and the errors.

Ergo Model is an independent service, not affiliated with, endorsed by or operated by Amazon, AWS or OpenRouter. Requests reach the model through OpenRouter, pinned to providers that serve the full 1M-token context. For a step-by-step start, read the how-to-use guide.

Base URL & authentication

All requests go to this base URL.

https://ergomodel.net/api/v1
EndpointAuthPurpose
POST /chat/completionsAPI keyCreate a chat completion, streamed or not.
GET /modelsNoneList the model with its context length and prices.

Authenticate with a bearer token in the Authorization header. Keys start with ergo_live_; create one in the dashboard (see /get-api-key). Keep the key on the server and never ship it in client code. The suggested environment variable name is ERGO_API_KEY.

Authorization: Bearer ergo_live_...

Create a chat completion

POST /chat/completions takes a list of messages and returns an assistant message. Ergo always reasons before it answers. The reasoning is returned separately in message.reasoning, and the answer is in message.content.

curl https://ergomodel.net/api/v1/chat/completions \
  -H "Authorization: Bearer ergo_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ergo-1.0",
    "messages": [
      { "role": "system", "content": "You are a concise senior engineer." },
      { "role": "user", "content": "How many r are in strawberry?" }
    ],
    "reasoning": { "effort": "low" },
    "max_tokens": 2048
  }'

Request parameters

FieldTypeDescription
modelstring"ergo-1.0". See model names for aliases. Every request is served by this one model.
messagesarrayRequired, non-empty. Conversation so far as { role, content } objects with role system, user, assistant or tool. Text only: the model has no image input.
max_tokensintegerCap on generated tokens, reasoning included. Maximum 131,072. Set at least 2048 for short answers; AWS's own guidance is an output limit of 8,192 or higher. A small value (for example 300) returns empty content with finish_reason: "length".
reasoningobjectReasoning budget. Either { "effort": "low" | "medium" | "high" } or { "max_tokens": N }. Reasoning cannot be turned off; a request that tries returns 400.
streambooleanWhen true, the response is sent as Server-Sent Events. Defaults to false.
tools, tool_choicearray, string | objectFunction calling in the OpenAI format. Tool calls come back in message.tool_calls.
response_formatobjectStructured outputs, for example { "type": "json_schema", "json_schema": { ... } }.
temperaturenumberSampling temperature. The model's Hugging Face card recommends 1.0.
top_pnumberNucleus sampling. The model's Hugging Face card recommends 0.99.
stopstring | arraySequences that end generation.
seedintegerSampling seed, forwarded as sent.

Response

The upstream response is returned as received, in the standard OpenAI shape. The answer is at choices[].message.content, the reasoning text at choices[].message.reasoning, and token counts in usage.

{
  "id": "gen-...",
  "object": "chat.completion",
  "created": 1796256000,
  "model": "amazon/ergo-1.0",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "There are 3 letter r's in \"strawberry\".",
        "reasoning": "s-t-r-a-w-b-e-r-r-y. r at positions 3, 8, 9. Three."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 31,
    "completion_tokens": 342,
    "total_tokens": 373,
    "completion_tokens_details": { "reasoning_tokens": 329 }
  }
}

Streaming

Set stream: true to receive Server-Sent Events. Each data: line carries a chunk with partial text at choices[].delta.content; reasoning arrives first at choices[].delta.reasoning. A final frame with usage is always sent, whether or not you pass stream_options, and the stream ends with a literal data: [DONE] line.

curl -N https://ergomodel.net/api/v1/chat/completions \
  -H "Authorization: Bearer ergo_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ergo-1.0",
    "messages": [{ "role": "user", "content": "Write a haiku about a build server." }],
    "max_tokens": 2048,
    "stream": true
  }'
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","reasoning":"Three lines, 5-7-5..."}}]}

data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Fans spin"}}]}

data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" in the dark"}}]}

data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: {"id":"gen-...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":18,"completion_tokens":402,"total_tokens":420}}

data: [DONE]

List models

GET /models is public and needs no key. Coding tools call it to fill their model picker. It returns the one model with its context length, maximum output and prices in USD per 1M tokens.

curl https://ergomodel.net/api/v1/models
{
  "object": "list",
  "data": [
    {
      "id": "ergo-1.0",
      "object": "model",
      "created": 0,
      "owned_by": "amazon",
      "context_length": 1048576,
      "max_output_tokens": 131072,
      "pricing": {
        "input_per_million_tokens_usd": 1.5,
        "output_per_million_tokens_usd": 4.5
      }
    }
  ]
}

Model names

Background on the model itself is at /what-is-amazon-ergo and /context-window.

Pricing

Token typePrice per 1M tokens
Input$1.50
Output (reasoning tokens included)$4.50
Cached input$1.50 (no cache discount)

The API is prepaid. Credit packs are $5, $10, $20, $50 (credits $55) and $100 (credits $115). Credits never expire and there is no subscription. Signing up and creating a key is free; calls need a balance. A 100,000-token prompt costs $0.15 of input, and 2,000 output tokens cost $0.009. Each response reports its own usage, so you can track spend per call. Details are on the pricing page; Amazon Bedrock and OpenRouter list lower per-token prices, and /amazon-ergo-api compares them.

Rate limits

Each API key may send 30 requests per minute. Beyond that the API returns 429 rate_limit_exceeded with a Retry-After header giving the seconds to wait. There is no separate token-per-minute limit; total usage is bounded by your credit balance. More on /rate-limits.

Errors

Errors use the OpenAI-style envelope, so SDKs surface the message directly.

{
  "error": {
    "message": "Rate limit exceeded: 30 requests per minute per API key. Retry in 12s.",
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded"
  }
}
StatusCodeMeaning
400— / upstream_errorBad request (unparseable JSON, missing or empty messages), or the model rejected the request: check max_tokens, reasoning and context length. Disabling reasoning lands here.
401missing_api_keyNo Authorization: Bearer ergo_live_... header, or the key is malformed.
401invalid_api_keyThe key is unknown or has been revoked.
402insufficient_creditsZero balance. The message includes a top-up link to the dashboard.
429rate_limit_exceededMore than 30 requests per minute on this key. Wait for Retry-After seconds.
503upstream_errorUpstream busy. Retry after a few seconds.
502upstream_errorUpstream unavailable. Retry with backoff.

A request that fails upstream is not charged: the credit held for it is returned.

What is and is not forwarded

HandlingFields
Forwarded as sentmessages, tools, tool_choice, response_format, temperature, top_p, max_tokens, stop, seed, reasoning, stream
Replacedmodel (always resolved to ergo-1.0)
Strippedmodels, route, plugins, web_search_options

The stripped fields are OpenRouter routing and web-search options. They are removed so a request cannot fall back to a different model or start a paid web search.

SDKs

Because the API is OpenAI-compatible, any OpenAI SDK works: set base_url to https://ergomodel.net/api/v1 and api_key to your ergo_live_ key. See /openai-compatible-api for compatibility notes and /integrations for coding tools.

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ERGO_API_KEY"],  # ergo_live_...
    base_url="https://ergomodel.net/api/v1",
)

resp = client.chat.completions.create(
    model="ergo-1.0",
    messages=[{"role": "user", "content": "Explain a race condition in one line."}],
    max_tokens=2048,
)
print(resp.choices[0].message.content)

Questions: [email protected].