Implementation Guide

Capping LLM Usage by Vendors and Contractors Who Access Models Through Your API Keys

To cap LLM usage for vendors and contractors, stop handing out provider API keys. Issue each external party its own identity or virtual key at a gateway or runtime policy layer that sits between them and the model provider. Enforce token, request, spend, model, and expiry limits per identity at that layer. Log every request against the identity, alert on breaches, and revoke access without rotating the underlying provider key.

Why raw provider keys are a weak control point

A provider API key is not tied to an individual vendor or contractor. When it is handed to an external party, there is no per-party identity to attach limits, logs, or an expiry to, and removing one party's access means rotating the underlying provider key.

The approach in this guide is to stop handing out provider keys and move enforcement to a layer that knows who is making each request.

Choosing an enforcement point

Place a gateway or runtime policy layer between external parties and the model provider. Each vendor, contractor, or engagement receives its own identity or virtual key at this layer, and the real provider key stays inside your organization.

Where enforcement moves
ComponentRole
External partyVendor or contractor holds a scoped identity or virtual key, not a provider key.
Control layerGateway or runtime policy enforces budgets, rate limits, model and tool allowlists, and expiry.
Audit trailEach request is attributed to a party, model, and policy decision.
Model providerThe real provider key stays inside your organization and is never shared.

Designing the caps

Enforce limits per identity at the control layer, not per provider key. The limits to define for each external party are:

  • Tokens and requests: token and request limits, including rate limits.
  • Spend: a budget for each party.
  • Models and tools: allowlists for the models and tools each party may use.
  • Expiry: an end date for each identity or engagement.

Identity, logging, and monitoring

Log every request against the identity that made it, so each one is attributed to a party, a model, and a policy decision. Alert on breaches of the caps you define.

Offboarding an external party

Because each party holds its own identity or virtual key, access can be revoked at the control layer without rotating the underlying provider key.

Questions to ask when evaluating a control layer

  • Can it issue a distinct identity or virtual key for each vendor, contractor, or engagement?
  • Which caps can it enforce per identity: tokens, requests, spend, model allowlists, tool access, and expiry?
  • Does it hard block, throttle, or only alert at a cap, and how fast does enforcement apply?
  • Do audit logs attribute each request to an external party with model, token counts, and policy decision?
  • Can logs be exported to your existing SIEM or monitoring systems?
  • Can access be revoked immediately without rotating the underlying provider keys?

Put enforcement where identity is known

If your teams are deciding how to scope, audit, and revoke third-party access to models and agents, talk through your requirements with our team.

Talk to an Expert