Guide

Use your GPUs first: routing LLM traffic to your own servers before paid APIs

If you own GPUs, every request a vendor serves is money you didn't need to spend. How GPU-first routing works and when to use a vendor.

GPU-first routing means sending each AI request to your own GPU servers when they can handle it, and to a paid vendor only when they can't: when they're busy, down or don't run the model. If you already own the hardware, every request a vendor serves instead is money you didn't need to spend. It needs a gateway in front of both your servers and your vendors, with health checks and load awareness.

Updated 3 December 2026.

The problem it solves

A company that buys GPUs can easily end up paying for both: the servers sit partly idle while apps keep calling OpenAI or Groq, because:

  • each app was wired to a vendor before the GPUs arrived
  • the GPUs have several URLs and no keys or limits
  • nobody trusts them to be up all the time

We had exactly this problem ourselves: five GPU machines, five URLs, no keys and no limits (the story).

How GPU-first routing works

request → gateway
            ├─ your GPU servers (first, if healthy and not at capacity)
            └─ vendors like OpenAI, Groq, Together (when needed)

For each request, the gateway:

  1. Finds the servers that run the model the app asked for.
  2. Skips unhealthy ones, based on background health checks.
  3. Skips full ones, based on per-server concurrency limits.
  4. Prefers the server likely to have the prompt cached, so similar requests reuse work already done.
  5. Moves to a vendor if no server can take the request, then records which provider served it.

What it needs

RequirementWhy
One OpenAI-compatible endpointApps call one URL whether a GPU or a vendor answers. vLLM and Ollama both speak the OpenAI API (guide).
Same model names everywhereGive each model a name your team recognises, mapped to servers and vendor models behind it.
Health checksDown servers are removed before requests hit them.
Concurrency limitsA busy server isn't overloaded into slow answers.
Cost tracking per providerYou can see how much traffic your GPUs absorbed and what the vendors cost.
Per-person limitsOne heavy user can't monopolise the shared servers.

When to send traffic to a vendor anyway

GPU-first doesn't mean GPU-only. Use vendors for:

  • Models you don't run, such as frontier closed models.
  • Overflow when your servers are at capacity.
  • Outages and maintenance windows.

For more on fallback order and retries, see LLM failover.

Options

General-purpose gateways like LiteLLM and Bifrost can route to vLLM and Ollama as providers and fall back to vendors. For one model on many replicas, vLLM Router adds cache-aware load balancing (vLLM router).

AI Gateway by LayerX is built around GPU-first routing. You register your vLLM or Ollama servers and vendor accounts, give each model a name, and set priority tiers. Requests go to your GPUs first, using health checks, concurrency limits and prefix-cache affinity, and move to the least-loaded healthy option, then to vendors like OpenAI, Groq, Together or OpenRouter. Each person gets their own keys, token budgets and allowed models. You can change the model catalogue live and take a server out for maintenance without dropping requests. Prompts are never stored.

Questions

What is GPU-first routing?

Sending AI requests to your own GPU servers first and to paid vendors only when your servers are busy, down or don't run the model.

Can I mix vLLM and OpenAI behind one API?

Yes. vLLM exposes an OpenAI-compatible server, so a gateway can put it and OpenAI behind one endpoint and route between them.

How do I know how much the GPUs are saving?

Track which provider served each request and what the vendor would have charged. A gateway with cost per provider shows this directly.

What happens during GPU maintenance?

A gateway with health checks takes the server out of rotation and sends its traffic to other servers or vendors. Some, including AI Gateway, can drain a server without dropping requests in progress.

More posts

Keep reading.

See how AI Gateway fits your setup.

Tell us what you run today and how many people need access. We'll get back to you to learn more about your setup.

See how AI Gateway fits your setup.

What do you run today?