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.
| Component | Role |
|---|---|
| External party | Vendor or contractor holds a scoped identity or virtual key, not a provider key. |
| Control layer | Gateway or runtime policy enforces budgets, rate limits, model and tool allowlists, and expiry. |
| Audit trail | Each request is attributed to a party, model, and policy decision. |
| Model provider | The 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?