Skip to main content
Access on request

The API contract.

Routes, keys and errors, so you can judge it before requesting access.

Quickstart

  1. Request access.
  2. Create your key.
  3. Change the address and the key in your client.
API contract · access on request
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.

API contract · access on request
MethodRouteWhat it does
GET/v1/modelsThe models that work with your key.
POST/v1/chat/completionsFull 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.

API contract · access on request
StatusCodeWhen
401invalid_api_keyKey missing, mistyped or revoked.
402budget_exceededYour organisation's budget has run out.
404model_not_foundThe model does not exist or is not available to your key.
429rate_limit_exceededYou have exceeded your organisation's quota.
502upstream_errorThe model provider failed.