Skip to main content

Request Lifecycle

AISIX sits between applications and AI providers. Applications send requests to the proxy API with a caller API key and a model alias. AISIX uses that information to apply access control, resolve the upstream target, enforce AI traffic policy, and record what happened.

The lifecycle looks like this:

Caller Authentication

Each proxy request uses a caller API key. AISIX checks the key before it resolves the requested model. The key controls which model aliases the caller can use, so application teams do not need direct provider credentials.

Model Resolution

The model value in the request is the caller-facing alias. AISIX resolves that alias to one of four dispatch shapes:

  • A direct model, which points to one upstream model through one provider credential. A direct model can also include embedding metadata when a semantic router uses it for similarity comparisons.
  • A routing model, which lets AISIX choose one target model by failover, round-robin, weighted routing, cost, latency, or load.
  • A semantic model, which selects a target model by comparing request text with configured route examples.
  • An ensemble model, which sends a chat request to panel models and uses a judge model to synthesize the response.

Only one dispatch shape can be configured on a model resource. For the complete resource relationships, see Models and Providers.

Request Controls

AISIX can stop a request before it reaches a provider. Caller API keys and model aliases can carry rate limits, while AISIX Cloud deployments can enforce request budgets. Guardrails can inspect input, and response caching can return a stored chat completion before an upstream call.

Provider Dispatch

After the request is allowed, AISIX dispatches it to the selected provider using the provider key and adapter configured by the operator. Applications keep their gateway-facing API shape while AISIX handles provider credentials, upstream model names, base URLs, and provider-specific request handling.

Response Handling

Provider responses return through AISIX. Output guardrails can inspect generated text before the response reaches the caller. For successful requests, AISIX records usage and telemetry so operators can understand requested aliases, resolved models, provider attempts, token usage, latency, and errors.

Deployment Boundary

On a standalone gateway, operators can declare gateway resources in a resources.yaml file. With AISIX Cloud, the control plane owns resource management and projects accepted configuration to the AISIX gateway. The proxy request lifecycle remains the same from the caller's perspective: applications call the proxy API, and AISIX applies the configured model access, routing, controls, and observability behavior.