Access on request
The API contract.
Routes, keys and errors, so you can judge it before requesting access.
Quickstart
- Request access.
- Create your key.
- Change the address and the key in your client.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://criterium.pro/v1",
api_key=os.environ["CRITERIUM_API_KEY"],
)
r = client.chat.completions.create(
model="criterium/router",
messages=[
{"role": "user", "content": "Summarise this invoice."},
],
)
print(r.choices[0].message.content)
Only the marked lines change.
Contract
Shape compatible with the OpenAI ecosystem.
| Method | Route | What it does |
|---|---|---|
| GET | /v1/models | The models that work with your key. |
| POST | /v1/chat/completions | Full response or event stream. |
Authentication
One key in a header, with its prefix in plain sight.
Example keycrit_sk_
- It is shown only once, when created.
- We only store its hash and prefix.
- Quotas and budget are per organisation.
Errors
Codes in the OpenAI ecosystem error shape.
| Status | Code | When |
|---|---|---|
| 401 | invalid_api_key | Key missing, mistyped or revoked. |
| 402 | budget_exceeded | Your organisation's budget has run out. |
| 404 | model_not_found | The model does not exist or is not available to your key. |
| 429 | rate_limit_exceeded | You have exceeded your organisation's quota. |
| 502 | upstream_error | The model provider failed. |