Ergo AI API reference
The Ergo AI API is free and OpenAI-compatible. If your code already uses an OpenAI SDK, change the base URL and the key — nothing else.
https://ergoai.dev/v1Authentication
Create a key on your account page. Send it as a bearer token:
Authorization: Bearer ergo-sk-xxxxxxxxxxxxxxxx
Keys are shown once. Store them in an environment variable and never ship them in front-end code.
Quickstart
curl
curl https://ergoai.dev/v1/chat/completions \
-H "Authorization: Bearer $ERGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ergo-1",
"messages": [
{"role": "system", "content": "You are a senior backend engineer."},
{"role": "user", "content": "Design a rate limiter for a REST API."}
]
}'
Python
from openai import OpenAI
client = OpenAI(base_url="https://ergoai.dev/v1", api_key="ergo-sk-...")
res = client.chat.completions.create(
model="ergo-1-fast",
messages=[{"role": "user", "content": "Write a regex for ISO dates"}],
)
print(res.choices[0].message.content)
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://ergoai.dev/v1", apiKey: process.env.ERGO_API_KEY });
const res = await client.chat.completions.create({
model: "ergo-1",
messages: [{ role: "user", content: "Summarize this changelog: ..." }],
});
console.log(res.choices[0].message.content);
List models
GET /v1/models
Returns the models enabled on this server in the standard {"object":"list","data":[...]} shape.
Chat completions
POST /v1/chat/completions
| Field | Type | Description |
|---|---|---|
model | string | Model ID, e.g. ergo-1. Defaults to the first available model. |
messages | array | Conversation. Roles: system, developer, user, assistant. The last message must be user. |
stream | boolean | Stream tokens as server-sent events. Default false. |
max_tokens | integer | Maximum output tokens (up to 65,536). |
stream_options.include_usage | boolean | Add token usage to the final stream chunk. |
Response
{
"id": "chatcmpl-9f2c...",
"object": "chat.completion",
"created": 1764720000,
"model": "ergo-1",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Here's a token-bucket design...",
"reasoning_content": "The user needs per-key limits..."
},
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 42, "completion_tokens": 610, "total_tokens": 652 }
}
Streaming
Set "stream": true. You receive chat.completion.chunk events and a final data: [DONE].
data: {"choices":[{"index":0,"delta":{"reasoning_content":"Consider sliding window…"}}]}
data: {"choices":[{"index":0,"delta":{"content":"Use a token bucket"}}]}
data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
Reasoning output
Ergo models always reason before answering. A summary of that reasoning is returned in reasoning_content (on the message, or on stream deltas). Clients that don't know the field simply ignore it.
Models
| ID | Best for |
|---|---|
ergo-1-fast | Fast, low-cost. Everyday coding, writing, extraction. |
ergo-1 | Deeper reasoning for complex, multi-step problems. |
ergo-1-claude | Careful agentic coding and long documents (when enabled). |
ergo-1-max | Most capable model for the hardest tasks (when enabled). |
Call GET /v1/models to see exactly which are live.
Errors & limits
| Status | Meaning |
|---|---|
| 400 | Invalid request body. |
| 401 | Missing or invalid API key. |
| 404 | Unknown model ID. |
| 429 | Too many requests in one minute (fair-use limit). Wait a moment and retry. |
| 502 | Upstream model error — safe to retry. |
Errors use the OpenAI shape: {"error":{"message":"...","type":"..."}}. The API is free with no daily cap. A per-minute fair-use limit protects the service from abuse.
Use with coding tools
Any tool that accepts a custom OpenAI-compatible provider works — for example Cline, Continue, Roo Code, OpenCode or Aider. Set:
- Base URL:
https://ergoai.dev/v1 - API key: your
ergo-sk-…key - Model:
ergo-1orergo-1-fast