API quickstart
Create a Codius API key, list available models, and make a first OpenAI-compatible chat request.
Codius exposes an OpenAI-compatible inference API for coding agents and developer tools. This quickstart creates an organization key, discovers the models available to that organization, and sends one chat request.
Before you begin
You need:
- a Codius account and organization;
- an active Pro or Max Coding Plan;
- an organization API key with
models:readandinference:createscopes.
Create the key from the Codius dashboard and copy it while it is visible. Codius stores a verifier, not the reusable plaintext secret.
1. Set the credential
export CODIUS_API_KEY="codius_live_…"Do not commit this value to source control or embed it in browser code.
2. List available models
curl https://api.codius.ai/v1/models \
-H "Authorization: Bearer $CODIUS_API_KEY"The response uses the OpenAI model-list envelope. Public model IDs are stable Codius identifiers; model-provider routing remains private.
3. Make a chat request
Replace MODEL_ID with one of the IDs returned above.
curl https://api.codius.ai/v1/chat/completions \
-H "Authorization: Bearer $CODIUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [
{
"role": "user",
"content": "Explain the likely bug in this function."
}
]
}'Every response carries x-codius-request-id. Include that identifier when
contacting support about a request.
4. Use the OpenAI SDK
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.codius.ai/v1",
apiKey: process.env.CODIUS_API_KEY,
});
const response = await client.chat.completions.create({
model: "MODEL_ID",
messages: [{ role: "user", content: "Write a unit test for this parser." }],
});Next steps
- Configure a coding client with Agent setup.
- Add streaming using the API reference.
- Learn how the three usage windows work.
Last reviewed 2026-07-28 · Capability verified · Public docs are adapted and capability-checked before publication.
Provenance: apps/web/content/docs/models/api-quickstart.mdx from CodiusAI/codius at working-tree.