Skip to content
Back to the app

Private Inference API ​

The Private Inference API gives you the platform's self-hosted models directly, in the request and response shape of the OpenAI chat-completions API. An OpenAI-compatible client works by changing its base URL.

Base URLhttps://changents.ai/api/v1, or https://<your-host>/api/v1 on your own installation
EndpointWhat it does
GET /api/v1/modelsThe models this installation serves, and the data class each is approved for
POST /api/v1/chat/completionsA chat completion; stream: true for server-sent events
POST /api/v1/embeddingsEmbeddings from a self-hosted embedding model

What makes it private ​

  • Self-hosted models only. Requests go to the platform's own model host. If your organisation restricts where data is processed, that restriction applies here too. This API never sends a prompt to a hosted model provider.
  • Nothing kept. Prompts and completions are neither stored nor logged. The only record is a token-usage row (model, token counts, duration) for billing. Every response carries X-Retention-Applied: none. See No-Retention Mode.
  • Governed models. A model must be registered, not blocked, and approved for the data you send. Declare that with X-Data-Classification: PUBLIC | SENSITIVE | RESTRICTED (default SENSITIVE). A model approved only to SENSITIVE refuses a RESTRICTED request with 403.

Keys ​

Use a key with the inference scope. On /developer, choose Create Inference Key, or call:

bash
curl -X POST https://changents.ai/api/developer/keys \
  -H "Authorization: Bearer <session token>" -H "Content-Type: application/json" \
  -d '{ "name": "inference", "scopes": ["inference"] }'

The scope is never granted by default. A key made for running agents cannot call models directly, and an inference key cannot run agents. Session tokens are not accepted on this API.

Example ​

bash
curl https://changents.ai/api/v1/chat/completions \
  -H "Authorization: Bearer cgnt_sk_<clientId>.<secret>" \
  -H "X-Data-Classification: SENSITIVE" \
  -H "Content-Type: application/json" \
  -d '{ "model": "gemma2:2b",
        "messages": [{ "role": "user", "content": "Summarise these payment terms: …" }] }'
python
from openai import OpenAI

client = OpenAI(base_url="https://changents.ai/api/v1", api_key="cgnt_sk_<clientId>.<secret>")
reply = client.chat.completions.create(
    model="gemma2:2b",
    messages=[{"role": "user", "content": "Summarise these payment terms: …"}],
)

Accepted fields: model, messages (roles system, user, assistant; 1–200 messages), temperature, top_p, max_tokens, stop, seed, response_format, frequency_penalty, presence_penalty, stream. Others are ignored. max_tokens is capped at the installation's limit (INFERENCE_MAX_TOKENS, default 2048). With stream: true, the last event before [DONE] carries usage.

Errors ​

Errors use the OpenAI error shape: {"error": {"message", "type", "code"}}.

StatusCodeMeaning
401invalid_api_keyNo key, or an unknown or revoked key
403insufficient_scopeThe key lacks the inference scope
403classification_not_permittedThe model is not approved for the declared data class
404model_not_foundNot a model this API serves; see GET /api/v1/models
402insufficient_creditNo credit left; checked before the model is called
429rate_limit_exceededOver the per-key limit (INFERENCE_RATE_PER_MIN, default 60)
502host_unavailable, host_errorThe model host did not answer or refused the request

Billing ​

On the hosted service, each call costs INFERENCE_CREDITS_PER_1K_TOKENS credits per thousand tokens (default 1), rounded up. The credits come from your organisation's pool first, then your own wallet. On your own installation, usage runs under your licence and is not charged.

Which models ​

GET /api/v1/models lists the registered self-hosted models that the model host has actually loaded. On the hosted service today that is a small CPU-served model, and answers are slower and less capable than a hosted frontier model. Larger models need a GPU host; see Models & GPU.

Served from this deployment. No page view leaves it.