Safeguard
AI Security•

How do you cap resource abuse on a self-hosted inference server?

Cap request size, output length, parallel samples, queue depth and per-user rate. A practical checklist built on OWASP LLM10 and vLLM's own limits.

Safeguard Security Team
4 min read

Cap what a single request can ask for and how many requests one caller can make. That means body size, input and output tokens, parallel output samples, queue depth, timeouts and per-user rate. OWASP lists these under unbounded consumption, and vLLM documents a limit on the samples-per-request parameter.

What unbounded consumption means

OWASP's 2025 list for LLM applications includes LLM10, Unbounded Consumption. It describes an application that lets users run excessive and uncontrolled inferences. The result can be a service outage, a large bill, or model theft through volume of queries.

With a hosted API, the provider caps some of this and bills you for the rest. With a self-hosted server, your GPUs are the bill, and one caller can fill the queue for everyone.

The parameters worth capping

ControlWhat to setWhere
Request body sizeA limit that fits your longest legitimate promptReverse proxy
Output lengthA server and per-key maximum on generated tokensServer config, app layer
Parallel samplesA low cap on the n parameterServer and proxy
Concurrency and queueA bound on in-flight and queued requestsServer, proxy
TimeoutsA wall clock limit per requestProxy, app
Per-user rateA quota per key or accountProxy, app

The vLLM docs describe the n parameter, which sets how many independent output sequences are produced per request. A very large value makes memory and GPU time grow in proportion and can cause out of memory conditions that block other requests. vLLM enforces an upper bound through VLLM_MAX_N_SEQUENCES, with a default of 16384, and the docs suggest values such as 64 or 128 for public-facing deployments.

OWASP mitigations, in plain words

The OWASP page lists ten mitigations. The ones that map most directly to a self-hosted server are:

  1. Input validation, with strict size limits.
  2. Limit exposure of logits and logprobs, so responses do not reveal more than needed.
  3. Rate limiting and user quotas.
  4. Resource allocation management, so no request takes everything.
  5. Timeouts and throttling for heavy operations.
  6. Logging, monitoring and anomaly detection on resource use.
  7. Graceful degradation under load.

The page also lists sandboxing and watermarking. Those are worth reading, but the first seven are what you can configure this week.

A quick build order

  1. Put a reverse proxy in front. Set the body size, timeout and rate limit there.
  2. Pick a maximum output length per key and enforce it in the layer that calls the model.
  3. Lower the parallel samples cap from its default.
  4. Set a queue limit and decide what happens at the limit. Return a clear busy error instead of letting latency grow without end.
  5. Log tokens in and out, latency and the caller id for every request, without logging the prompt text itself where it holds sensitive data.
  6. Alert on a caller who uses far more than their usual share.

The vLLM docs also advise monitoring per-request resource use to spot anomalous patterns, which fits step six.

Test it

Send an oversized body, a request with a very large n, and a burst of parallel calls from one key. Confirm each is rejected or throttled, and that other users keep getting responses during the burst.

Quick check

Is rate limiting per IP enough?

Not usually. Limit per authenticated key or account, and add an IP limit as a second layer.

Does a smaller model remove the need for limits?

No. A small model is cheaper per request, but an unbounded caller can still saturate it.

Where Safeguard fits

Safeguard handles dependency scanning, policies and gates, and compliance evidence automation, which can record that limits like these are part of your release checks. A free scan takes a few minutes.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.