Quickstart
Get a key, send your first request to ai.codai.ro, pick a wire format.
The codai gateway lives at https://ai.codai.ro. It speaks three wire formats — OpenAI Chat Completions, Anthropic Messages and the OpenAI Responses API — and one model name, codai. Whatever SDK you already use will work; the gateway translates under the hood.
Get an API key
Sign in to hub.codai.ro and open Keys → Create key. Keys look like codai_xxxxxxxx and are shown once — store yours in an environment variable:
$env:CODAI_API_KEY = 'codai_xxxxxxxx'Send your first request
curl https://ai.codai.ro/v1/chat/completions \
-H "Authorization: Bearer $CODAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "codai",
"messages": [
{ "role": "user", "content": "Write a one-line Python function that returns the nth Fibonacci number." }
]
}'A successful response is a standard chat completion:
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "codai",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 27, "completion_tokens": 21, "total_tokens": 48 }
}Read the response headers
Every response tells you what actually happened. The two you will use most:
| Header | Meaning |
|---|---|
x-codai-routed-to | The upstream model that served the request. |
x-codai-cost-micro-usd | The cost of this request in integer micro-USD (when known before the first byte — see limits & pricing). |
The full list is on the request headers page.
Already using an SDK?
Point it at the gateway and keep your code.
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.CODAI_API_KEY,
baseURL: 'https://ai.codai.ro/v1',
});
const res = await client.chat.completions.create({
model: 'codai',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(res.choices[0].message.content);The OpenAI base URL includes /v1; the Anthropic base URL is the bare host. Getting this wrong produces a 404 not_found that looks like an auth failure.
Next steps
Models
What `codai` resolves to, the other aliases, effort and thinking.
Wire formats
Chat Completions, Messages and Responses — request and response shapes.
Streaming
SSE shapes per format and where usage lands.
Clients
VS Code, Copilot CLI, Cursor, Continue, MCP.
SDKs
The official TypeScript and Python clients.
Limits & pricing
Rate limits, spend caps and the error contract.