AI Operations

AI Gateway for Private Infrastructure: Model Selection, API Routing, Usage Metering and GPU Capacity

An AI gateway on private GPUs needs to know which GPU servers, or nodes, have free memory before it sends a request. The gateway sits between applications and AI models and does four jobs: model selection, API routing, usage metering and GPU-capacity awareness.

AI gateway explainers from API-gateway vendors such as Tyk route requests on cost, latency and provider uptime. Those guides skip GPU capacity, because the vendor handles it for a rented API.

Audit a stack against the four jobs to find the missing layer. Start with capacity awareness, because gateways built for vendor APIs leave that job to the vendor.

TL;DR: A plain API gateway with a large language model (LLM) plugin can serve a stack that calls vendor APIs. Once a route points at company-owned GPUs, the AI gateway needs live cluster data, such as free GPU memory and queue depth, before it sends the request.

What an AI Gateway Controls

An AI gateway is the software between applications and models. It picks the model for each request, picks the endpoint that serves it, records usage and checks who can call each model.

We split that work into four jobs:

  1. Model selection: picks the model for a request, from a self-hosted model or a vendor API.
  2. API routing and failover: picks the endpoint and the next target when that endpoint fails.
  3. Usage metering: records which team or customer used what, and what it cost.
  4. GPU-capacity awareness: checks the cluster's free GPU memory and queue before the gateway routes a request.
Gateway jobLive input it reads
Model selectionWhere each model runs and its cost
API routing and failoverEndpoint health and latency
Usage meteringTokens, requests and GPU-hours per team
GPU-capacity awarenessFree GPU memory, running jobs and network health

The first three jobs work the same way for rented and owned backends. On owned GPUs, the gateway handles the fourth itself, because a vendor's service-level agreement (SLA) doesn't cover a company's own hardware.

An AI gateway pictured as a glass slab linked to a small rented group and a larger grid of owned GPU cubes

AI Gateway vs API Gateway on Self-Hosted Models

Tyk's AI gateway explainer describes the category through request routing, authentication, policy enforcement, monitoring and observability, multi-model integration and cost management. That list reflects one vendor's view of its own product category.

The two gateway types differ most in how they handle failures on owned GPUs. The table below sets out our own reasoning on how each backend fails:

Failure eventVendor-API backendSelf-hosted backend
Backend unavailableThe vendor has an outageA GPU is busy, out of memory or cut off by a network fault
Partial failureThe API answers or it failsA node fits a small request and rejects a large one
CapacityThe vendor's SLA covers itThe cluster scheduler, which the gateway has to query
Cost of a bad routing decisionOne failed request, retriedQueued work and jobs stopped mid-run

Model Selection in an AI Gateway: Self-Hosted Model or Commercial API?

On private infrastructure, the AI gateway checks free capacity before model capability.

Companies build a GPU cluster because one GPU runs short of memory for large models. The gateway can pick a self-hosted model while the cluster has memory free for that model.

Mixed fleets can use a four-step selection rule:

  1. Classify the request: sort it as latency-critical, batch or cost-tolerant, which narrows the candidate models before routing.
  2. Check capability fit: proprietary models run on the vendor's side, and a company's fine-tuned models, retrained on its own data, run on its own GPUs.
  3. Check live capacity: confirm the cluster can serve this request size without stopping running work. When memory runs short, send the request to the API or a queue.
  4. Apply the economics: Zettabyte's H100 rent-vs-buy analysis puts the break-even for buying at roughly 18 months or more of continuous use. Until a company's GPUs stay that busy, sending overflow to a commercial API can cost less than buying more GPUs.
Glass cubes lined up on stepped white plinths, a picture of model selection in an AI gateway

AI Gateway Failover When the Fallback Target Is an Owned Cluster

TrueFoundry's generative AI gateway checklist covers multi-model routing, intelligent fallback, prompt caching, guardrails (filters on model inputs and outputs), RBAC (role-based access control), observability, rate limiting, cost tracking, audit logs and deployment flexibility. Its routing items work for vendor and self-hosted backends.

On owned GPUs, a fallback target can be another node in the same cluster, a second GPU fleet on the same network or a commercial API when the cluster runs out of room.

Glass channels branch from one central cube to other groups, showing AI gateway failover to other targets

The gateway has to see and reach each of those targets, so routing depends on the network that links the GPUs. zFABRIC, our network for GPU clusters, connects mixed GPU and accelerator types over standard Ethernet, so failover can move work to a different hardware generation.

Three failover patterns work differently on private infrastructure:

  1. A second vendor API: the default for a SaaS deployment, and on owned GPUs a way to absorb burst traffic at per-token prices when the cluster runs out of room.
  2. Another node in the same cluster: the default on owned GPUs, which works when the gateway knows each node's free capacity.
  3. Queue and retry: protects running jobs on owned GPUs, at the cost of a longer wait for the user.

Usage Metering in an AI Gateway: Billing Customers or Charging Back Internal Teams

On owned GPUs, metering starts from the company's own costs. A gateway built for SaaS counts tokens and multiplies them by the vendor's published price.

Owned GPUs come without a published price. Their cost includes depreciation, power, staff and the GPU time one team takes from another.

Metering questionVendor-API backendOwned-GPU backend
Unit of useTokens or requestsTokens, requests, GPU-hours or reserved time
Price per unitThe vendor's list priceA rate built from the company's cost and utilization
Who gets chargedAn API key or workspaceA team or customer tied to cluster resources
Purpose of the numberPaying the vendor's billInternal chargeback or customer billing

The owned-GPU column needs cluster software that meters use, bills it, controls access and separates each customer's work. zPLATFORM, the user and commercial layer of our zSUITE software, provides metering, billing, per-customer controls, identity management and integrated observability.

Token counts miss one failure on private infrastructure: one team's batch jobs use capacity another team paid to reserve. Two requests with the same token count can hold very different amounts of GPU memory and time.

GPU Capacity: What an AI Gateway Reads Before It Routes a Request

Capacity-aware routing means the AI gateway checks the cluster's state before it sends a request. It reads four live inputs:

  1. Free GPU memory per node: shows whether a request with a long prompt fits on that node.
  2. Job run times: show which nodes will free up soon and which jobs the scheduler may stop to make room.
  3. Network health: a slow link raises latency and can rule out splitting one model across several nodes.
  4. Queue depth: sends requests the cluster can't take to the commercial API, so they don't wait behind batch work.

The gateway reads these inputs from the cluster's control plane, the software that schedules and monitors work. zWARE, our GPU control plane, runs a hardened Kubernetes distribution with an AI-aware scheduler and tracks GPU, network and power health in real time.

A grid of GPU cubes with open gaps and one cube waiting, an image of the free capacity an AI gateway checks

A gateway without capacity data works for one model on one node. Once several models and teams share a fleet, it picks servers without knowing their load and can slow the jobs already running.

We couldn't find a published threshold for this, so it rests on our own judgment.

AI Gateway Governance Checklist for Private GPUs

The governance part of an AI gateway changes little on owned GPUs. TrueFoundry's checklist gives a baseline: RBAC, observability, rate limiting, cost tracking, audit logs and guardrails.

Solo.io's AI gateway explainer adds key management: the gateway holds provider API keys, so developers work without provider credentials. Its prompt guards also block injection attacks and leaked secrets.

Two items change on private infrastructure:

  1. RBAC: for a vendor backend, access control stops at the API. On owned GPUs it decides which teams reach which nodes, models and reserved capacity.
  2. Audit logs: for a vendor backend, logs record who called which model. On owned GPUs they also record where each request went, how busy the node was and why the gateway queued or rejected it, which gives both sides evidence in a chargeback dispute.

Rate limiting, guardrails and the remaining checklist items work the same way on both backends.

Does a Private Stack Need an AI Gateway or a Plain API Gateway?

A stack that routes to owned GPUs needs an AI gateway, and a stack that calls vendor APIs can run on a plain API gateway. Use the audit below to check which case fits a given stack:

Gateway jobWhere it often lives todayQuestion to ask
Model selectionA config file or plugin listing modelsDoes selection depend on live cluster state?
API routing and failoverRetries that move to the next vendorCan it fail over to another node in the cluster?
Usage meteringToken counts per API keyCan it charge GPU-hours and reserved capacity to teams?
GPU-capacity awarenessOften missing, because the vendor's SLA covered itDoes it read free GPU memory and job state before routing?

A stack that answers yes to the four questions already does a private AI gateway's work. If the gateway can't read GPU memory and job state, the next layer to build is capacity awareness.

zPLATFORM covers the metering, identity and billing described above, and zWARE tracks the cluster state a capacity-aware gateway reads. Model routing, fallback and prompt caching come from a separate gateway product, so judge each candidate against the audit table.

AI Gateway FAQ

Is an LLM gateway different from an AI gateway?

An LLM gateway routes to large language models (LLMs), and AI gateway is the broader term that covers other model types too. Vendors define the two terms differently, so check each product's definition.

Does an AI gateway replace Kubernetes or a GPU scheduler?

An AI gateway works alongside Kubernetes and the GPU scheduler and reads the scheduler's state. The scheduler decides where jobs run and which jobs stop for others, and the gateway picks each request's destination and policy.

Can one AI gateway route to both a self-hosted model and a commercial API?

Yes, one AI gateway can route to both. It needs multi-model routing, separate metering for each backend and a capacity check on the self-hosted side, so overflow goes to the commercial API by design.