v1API reference

Ergo API Documentation

Everything you need to call ergo-1.0 through an OpenAI-compatible API: base URL, authentication, request parameters, streaming, tool calling, errors and billing.

  • POST/v1/chat/completions
  • GET/v1/models

Ergo API exposes Ergo 1.0 through the OpenAI Chat Completions format. Any client that lets you change the base URL works without code changes beyond the URL, the model id and the key.

Base URL
https://ergollmapi.com/v1
Model id
ergo-1.0
Format
OpenAI Chat Completions (JSON and server-sent events)

Send your API key as a Bearer token in the Authorization header. Create and revoke keys on the API Keys page after signing in.

HTTP header
Authorization: Bearer $ERGO_API_KEY

Keep the key on your server and load it from an environment variable such as ERGO_API_KEY. Never ship it in browser code.

Open API Keys

POSThttps://ergollmapi.com/v1/chat/completions

POST https://ergollmapi.com/v1/chat/completions creates a model response for a conversation. Streaming is off by default: if you omit stream you get one JSON response. The example below sets stream to true.

curl https://ergollmapi.com/v1/chat/completions \
  -H "Authorization: Bearer $ERGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ergo-1.0",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Write a Python function that merges two sorted lists."}
    ]
  }'

Request parameters

  • modelstringRequired

    Must be "ergo-1.0". Any other value returns 400.

  • messagesarrayRequired

    Non-empty array of messages with role system, developer, user, assistant or tool. content is a string or an array of text parts. Images and files are not supported.

  • streambooleanOptional

    Default false. When omitted or false the response is a single JSON object; set true to receive server-sent events.

  • stream_optionsobjectOptional

    Passed through to the model, as in the OpenAI API.

  • max_tokensintegerOptional

    Positive integer upper bound on generated tokens. Values above 131072 are clamped to 131072 rather than rejected.

  • temperaturenumberOptional

    Sampling temperature. Recommended: 1.0.

  • top_pnumberOptional

    Nucleus sampling. Recommended: 0.99 (1.0 also works).

  • toolsarrayOptional

    Function tool definitions in OpenAI format.

  • tool_choicestring | objectOptional

    Forwarded in OpenAI format: "auto", "none", "required", or {"type": "function", "function": {"name": "..."}} to force one function.

  • parallel_tool_callsbooleanOptional

    Allow the model to return several tool calls in one turn.

  • response_formatobjectOptional

    Structured output request, for example {"type": "json_object"}.

  • reasoning_effortstringOptional

    Accepted for compatibility. Ergo reasoning effort is fixed, so this value may be ignored.

Amazon recommends temperature 1.0 and top_p 0.99 for Ergo 1.0. Ergo always reasons before answering and its reasoning effort is fixed, so reasoning_effort may be ignored. max_tokens above 131072 is clamped to 131072. Fields not listed in the table are rejected with a 400 error.

Set stream to true to receive server-sent events; when stream is omitted or false the API returns a single JSON object. Reasoning arrives as reasoning_content deltas, the answer as content deltas. The last chunk before data: [DONE] carries usage and credits_consumed.

SSE
data: {"choices":[{"delta":{"reasoning_content":"The user wants a merge function..."}}]}

data: {"choices":[{"delta":{"content":"def merge(a, b):"}}]}

data: {"choices":[],"usage":{"prompt_tokens":24,"completion_tokens":212,"total_tokens":236},"credits_consumed":0.2}

data: [DONE]

Pass function definitions in tools and read the calls from message.tool_calls. tool_choice accepts "auto", "none", "required" or a named function to force one call; parallel_tool_calls allows several calls in one turn. Send results back as tool role messages.

Python
import json, os
from openai import OpenAI

client = OpenAI(base_url="https://ergollmapi.com/v1", api_key=os.environ["ERGO_API_KEY"])

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="ergo-1.0",
    messages=[{"role": "user", "content": "What is the weather in Oslo?"}],
    tools=tools,
)

call = response.choices[0].message.tool_calls[0]
print(call.function.name, json.loads(call.function.arguments))

GEThttps://ergollmapi.com/v1/models

GET https://ergollmapi.com/v1/models returns the models available to your key. The list contains ergo-1.0.

curl
curl https://ergollmapi.com/v1/models \
  -H "Authorization: Bearer $ERGO_API_KEY"

Errors return an HTTP status and a JSON body with an error object containing message, type and code.

JSON
{
  "error": {
    "message": "Insufficient credits.",
    "type": "insufficient_quota",
    "code": "insufficient_credits"
  }
}
  • 400invalid_request_errorinvalid_request

    Meaning: The request is invalid: a missing or wrong-typed field, an unsupported field, a model other than ergo-1.0, or non-text content.

  • 401authentication_errorinvalid_api_key

    Meaning: The API key is missing or invalid.

  • 402insufficient_quotainsufficient_credits

    Meaning: Your credit balance is too low for this request. Top up on the pricing page.

  • 429rate_limit_errorrate_limit_exceeded

    Meaning: Too many requests. Retry with exponential backoff.

  • 502upstream_errorupstream_error

    Meaning: The upstream provider returned an error.

  • 503service_unavailableservice_unavailable

    Meaning: The upstream provider is busy or timed out. Retry shortly.

Retry 429, 502 and 503 responses with exponential backoff. Do not retry 400, 401 or 402 until you have fixed the request, the key or the balance.

  • Text input only. Images and files are not supported.
  • Context window: 1,048,576 tokens.
  • Maximum output: 131,072 tokens per request (max_tokens up to 131072).
  • Requests can be rate limited; a 429 response means retry with backoff.

Usage is billed in credits per token. Credit packs and subscriptions are on the pricing page.

ModelInput per 1M tokensOutput per 1M tokens
ergo-1.0Input per 1M tokens300 creditsOutput per 1M tokens900 credits

Each request costs at least 0.05 credits.

See pricing