How Core AI handles a request

A request to Core AI passes through authentication, policy, the Model Router, fallback, a provider adapter and usage attribution. Each layer has one job, and none of them depends on a particular AI vendor's SDK or API shape.

  1. Application. It calls POST /v1/chat/completions, or the AIClient library, with its API key and a model alias.
  2. Boundary. It authenticates the key. Tenant and application come from the key, never from the request body.
  3. Policy. The Model Registry is narrowed to models the key may use, by capability, data classification, provider, runtime and region.
  4. Model Router. It picks one model and orders the alternatives.
  5. Fallback and adapter. The chosen model is called through its provider adapter. Only a retryable provider failure moves the call to the next alternative.
  6. Usage attribution. Tenant, application, model, tokens and cost are recorded, never the prompt or the answer.
Figure 1. The request path, step by step. The numbered list is the complete diagram.

AIClient and provider adapters

AIClient is the one interface application code is written against. It adds timeouts, retries with jittered backoff, hooks and error normalization. A provider adapter implements the small AIProvider contract for one vendor's API using only the platform's fetch, with no vendor SDK. Adapters refuse HTTP redirects, so a credential is never carried to another host. They also validate responses, so a malformed answer becomes a retryable error instead of a crash.

Model Registry

The Model Registry is a versioned catalogue of model entries. Each entry records the provider, tier, capabilities, privacy ceiling, cost, status and, optionally, region. It has no built-in entries: which models exist is the deployment's configuration. It can be filled from a local runtime's own model list, under the tier and privacy ceiling the operator states.

Model Router

The Router decides in a fixed order:

  1. Hard filters: capabilities, privacy ceiling and policy.
  2. The lowest tier that meets the requested quality bar.
  3. Cost.
  4. Known quality, when cost ties.

It returns the chosen model, the ordered alternatives a fallback may try, and the reason each other model was rejected. It does not call any model itself.

Fallback

Fallback moves to the next alternative only on a retryable provider error: a rate limit, an outage, a timeout or a network failure. It never moves to a model the Router rejected, so it keeps every policy above. Request errors and policy refusals are returned as they are. Every attempt is recorded.

Result cache

The result cache is opt-in and exact-match. Every key carries the tenant and application, and the user when the answer is user-specific. A read under the wrong scope is refused rather than served. There is no default retention: the caller states a time to live for each entry.

Usage attribution

Each call produces a usage record with:

  • tenant, application, user, feature and task;
  • the answering model, actual tokens and cost at that model's price;
  • whether the cache or a fallback was used;
  • a prompt reference by id and version, when the caller names one, and never the prompt text.

Last updated .