LLM API keys in the wild: the cost-abuse mechanics
What OpenAI- and Anthropic-class keys expose — spend, quota, stored data — plus the caps and org controls that bound damage, and downtime-free rotation.
LLM API keys in the wild: the cost-abuse mechanics
For developers shipping products on OpenAI- or Anthropic-class APIs: precisely what a leaked key exposes, which controls cap the damage, and how to rotate without taking your product down.
An LLM API key is unusual among credentials in how directly it converts to money. Most leaked keys expose data or infrastructure; a leaked model-provider key exposes a metered spending line attached to your payment method, with the throttle set by your plan tier. That asymmetry shapes everything about response priorities: speed of rotation matters more than for almost any other credential class, because the meter runs continuously until you stop it.
This guide enumerates what these keys can reach — spend, quota, and stored data — using current provider documentation throughout; covers the organizational controls (projects/workspaces, budgets, limits) that determine the ceiling; and walks the zero-downtime rotation sequence. Every example key below is a synthetic placeholder in the provider's format.
What the key formats tell you first
Format prefixes identify scope before you consult any dashboard:
| Prefix | Provider | Scope |
|---|---|---|
sk-proj-… | OpenAI | Project-scoped key (authentication docs) |
sk-svcacct-… | OpenAI | Service-account key (machine identity within a project) |
sk-… (legacy) | OpenAI | Older user-scoped key format, still functional |
sk-ant-api03-… | Anthropic | Workspace-scoped API key (getting started) |
| Synthetic example | — | sk-proj-SYNTHETIC_PLACEHOLDER_not_real_000000 |
Scope granularity is the first control lever: OpenAI organizes accounts into organizations containing projects, with keys issued at the project level; Anthropic organizes into organizations containing workspaces. A key scoped narrowly means a leak compromises one integration's context rather than the whole account — provided you actually split keys per integration rather than reusing one across all of them.
Blast radius one: spend
Inference requests authenticated with a valid key bill to your account. The mechanics worth knowing flatly:
- The burn rate is bounded by rate limits, not by your imagination. Providers publish usage tiers with per-minute token/request ceilings (OpenAI rate limits, Anthropic rate limits). A high-tier account with expensive-model access has a proportionally higher maximum drain rate.
- Costs accrue until a limit stops them. OpenAI projects support monthly budget and hard usage limits — when a project reaches its limit, API access halts until the next cycle (usage limits documentation). Without a configured limit, the ceiling is your billing relationship.
- Model choice sets the multiplier. Flagship-model tokens cost orders of magnitude more than small-model tokens; abuse routed to your most expensive models maximizes drain per request.
The defensive reading is direct: configure hard limits on every project before you need them, keep per-project budgets aligned to realistic usage, and treat "no hard limit set" on a project holding production keys as an open invoice. These settings cost minutes and convert worst-case spend from unbounded to bounded.
Blast radius two: quota and availability
Beyond direct billing, a runaway key consumes shared capacity. Rate limits attach at org/project levels, so abuse traffic competes with legitimate traffic — your real users experience throttling, degraded latency, and hard failures while the abusive traffic runs. For products whose core loop is model calls, availability loss frequently costs more than the metered spend itself.
Separation is the mitigation: distinct projects/workspaces per environment and per major integration mean one compromised key's quota consumption stays isolated from production's allocation. This is the same principle as Supabase's per-component secret keys: scope credentials so blast radii don't merge.
Blast radius three: data
The data exposure depends on provider surface area, and it's larger than "prompts":
- Files storage: both platforms offer file storage tied to the account (uploads for fine-tuning, retrieval, batch processing). A compromised key can list and retrieve stored files within its scope — which may include training corpora, customer documents, or internal datasets.
- Fine-tuned models and jobs: keys within scope can enumerate fine-tuning jobs and use resulting models, exposing indirectly what the models were trained on and enabling use of your competitive artifact under your own billing.
- Batch and async results: queued jobs and their outputs are retrievable artifacts.
- Conversation content: chat-completion APIs are stateless — prompts aren't retrievable later through the key unless persisted in files or logs. Data-use defaults differ per provider and product tier (training opt-outs, retention windows, zero-retention endpoints); verify current terms in each provider's data-usage documentation rather than assuming (OpenAI data usage, Anthropic data handling).
The composite picture: a leaked LLM key typically exposes spend immediately, availability quickly, and stored data wherever files/fine-tunes exist in scope. Response planning treats all three as parallel losses to bound, with the irreversibility caveat from incident response applying squarely to data already retrieved.
Controls that bound each radius
Mapped to the exposures above:
| Exposure | Control | Where |
|---|---|---|
| Unbounded spend | Hard usage limits + budgets per project | OpenAI dashboard project settings; Anthropic workspace spend limits |
| Shared-quota collapse | Project/workspace separation per environment and integration | Org structure in both consoles |
| Data retrieval | Minimal stored data; delete files post-consumption; scope keys to projects without file storage | Files API hygiene |
| Identity abuse | Audit logs to attribute anomalies; rotate promptly | OpenAI audit logs; Anthropic admin API |
| Silent leakage | Artifact-level scanning of deployed bundles and CI output | KeyDrift monitoring |
One control deserves emphasis because AI-era codebases undermine it routinely: keys belong in server environments. The paste-and-iterate workflow that moves model calls into frontend components — covered in how keys migrate from .env into source — puts the key into client bundles through the standard prefix conventions, converting a metered corporate card into a public utility.
A reference project layout makes the controls concrete:
acme-org
├── proj-prod-assistant hard limit $X · production keys only
├── proj-staging-experiments budget-only · no files storage enabled
└── workspace-sandbox spend-capped · throwaway keys welcome
Each unit holds its own keys, quotas, and ceilings; nothing shares. A leaked staging key burns staging's budget against staging's models — annoying, bounded, invisible to production. The same leak in an unsplit org would draw against every product simultaneously at whatever rate the highest tier allows. The layout costs one afternoon to establish and nothing to maintain, which is why it leads the control column rather than trailing the incident postmortem.
Zero-downtime rotation, concretely
Both platforms allow multiple active keys per scope, which makes overlap-based rotation straightforward (generalized pattern):
- Create a replacement key in the same project/workspace. Nothing breaks; the old key keeps working.
- Deploy consumers gradually — update the server environments referencing the key, one service at a time, watching error rates.
- Verify silence: confirm the old key shows zero traffic via usage dashboards or audit logs. Scheduled batch jobs are the classic stragglers.
- Revoke the old key.
Under confirmed active abuse, compress steps 1–4 into minutes and accept brief disruption: revoke-first beats overlap when the meter is visibly running. Post-revocation, review usage dashboards for the exposure window to quantify unauthorized spend and retrieve-attempts — the numbers feed both your provider support case and your incident record (first-hour runbook).
Cadence note: because these keys monetize instantly on disclosure, they justify shorter scheduled-rotation intervals than most credentials — quarterly is a reasonable default for production keys, with event-driven rotation (team departures, suspicious dashboard activity) layered on top.
Provider control surfaces, compared
The controls that bound blast radius exist on both platforms but organize differently — worth knowing precisely, because misreading them produces false confidence:
| Control | OpenAI | Anthropic |
|---|---|---|
| Scoping unit | Organization → Projects; keys issued per project | Organization → Workspaces; keys per workspace |
| Spend ceiling | Monthly budget + hard usage limit per project — hard limits halt traffic at the ceiling | Workspace-level spend limits in Console settings |
| Rate tiers | Published per usage tier, per model family | Published per tier (rate limits) |
| Usage attribution | Dashboards segment by key and project | Console usage views by key/workspace |
| Administrative API | Audit logs API for account events | Admin API for workspace/key management |
| Data controls | Retention/training settings per product terms; zero-retention eligibility on some endpoints | Data-handling terms per product tier |
Two asymmetries deserve attention. Hard limits differ from budgets: a budget alerts while traffic continues; a hard limit stops it. Abuse scenarios make the difference categorical — configure hard limits wherever offered, budgets as the alerting layer above them. And scoping depth varies: project/workspace membership is the primary lever both platforms offer, so the architecture decision (one project per integration versus shared) happens at setup time, before any key exists to leak.
Reading dashboards like an incident investigator
When exposure is suspected — or as quarterly hygiene — provider dashboards answer "did anything use this key besides us?" if you know the signatures:
- Volume shape: your application's traffic follows its users' diurnal pattern; abuse runs flat-around-the-clock or spikes outside release windows. Overlay suspected periods onto normal weeks.
- Model distribution: requests hitting expensive flagship models your product never calls is among the strongest signals available — legitimate traffic rarely changes model mix spontaneously.
- Request geography and cadence where visible: datacenter IP ranges and machine-gun regularity differ visibly from human-driven patterns.
- File operations: files-listed or files-downloaded events without corresponding application features deserve immediate escalation — that's the data-retrieval radius speaking.
- Fine-tune jobs: creation of training jobs you didn't authorize means the key holder is investing persistence, not joyriding.
Reconciliation turns impressions into numbers: export the suspect window's usage, subtract your own infrastructure's known consumption (deploy logs, server metrics), and treat the remainder as unauthorized spend quantified. That number drives three conversations — provider support (refund/fraud paths vary), finance (actual loss), and scope assessment (whether stored files or fine-tunes were touched, which determines whether the incident runbook adds notification analysis to rotation).
Anthropic's workspace separation adds one investigation convenience: keys scoped to a dedicated workspace mean abuse evidence stays segmented from production workspaces' noise, making anomaly detection a comparison rather than a search. The same logic argues for keeping one low-cap "sandbox" workspace where experiments happen — anomalies there cost almost nothing and teach dashboard-reading skills before they matter.
Data controls: what retention settings change
The data-exposure radius responds to controls set once during setup and easy to leave untouched afterward — worth revisiting precisely because their semantics differ per product surface:
| Control | What it changes | Blast-radius effect |
|---|---|---|
| Training opt-outs / data-processing terms | Whether API inputs/outputs feed model improvement | Doesn't affect retrieval-by-key either way — abuse reads happen through APIs regardless |
| Retention windows | How long conversations/files persist server-side | Longer windows enlarge what a leaked key can retrieve later |
| Zero-retention eligibility | Selected endpoints process without storage | Shrinks the retrievable corpus toward nothing for those flows |
| File storage lifecycle | How long uploads remain listed/fetchable | Directly bounds files-API exposure |
| Org-level data governance settings | Where enterprise controls consolidate retention policy | Determines whether project-level choices even apply |
The reading order matters: retention controls bound future retrieval, not current disclosure. A key leaked today can enumerate whatever exists today regardless of tomorrow's retention policy — which makes deletion discipline (files removed post-consumption, finished fine-tune datasets archived out of scope) the active control, and retention settings the backstop behind it.
Zero-retention endpoints deserve special attention in incident planning: flows routed through them shrink the notification-analysis conversation dramatically, since nothing persisted for an abuser to retrieve. Teams handling regulated material through LLM APIs increasingly architect specifically around this — sensitive processing confined to eligible endpoints, general work elsewhere — trading some integration convenience for a categorically smaller worst case. Verify current eligibility per endpoint against provider documentation rather than assuming; these programs evolve quarter to quarter (OpenAI data terms, Anthropic data handling).
One synthesis closes the section: spend caps bound the meter, scoping bounds the reach, retention bounds the memory. A leaked key facing all three simultaneously encounters bounded burn, bounded access, and shrinking evidence — which converts the worst-case story from "unbounded" into arithmetic. That's the entire goal of the control layer.
Batch and asynchronous jobs complete the straggler inventory: scheduled summarization runs, nightly embedding pipelines, queue workers processing retries — consumers whose next invocation may lag days behind any deploy-based migration. Enumerate them alongside cron-style checks (the playbook's verification discipline) and give their consumption patterns their own dashboard baseline, because abuse traffic and legitimate batch traffic look uncomfortably similar at usage-graph zoom.
Realtime and streaming surfaces add one inventory wrinkle: browser-facing voice/realtime integrations authenticate through ephemeral tokens minted server-side, short-lived by design — the correct pattern, and worth verifying wherever realtime features exist, because implementations assembled from examples sometimes ship long-lived keys into clients instead. Audit these flows for the minting pattern (client requests short-lived token → connects → token expires) rather than assuming; the failure mode looks identical to every other client-bundle leak once shipped, so the server-environment rule applies here too, with tighter clocks.
Provider support channels deserve inclusion in standing preparation, not just incident response: knowing the fraud-review path, typical validation timelines, and what documentation each provider requests turns the worst day into a structured conversation. Save the support contact points alongside rotation records — the same place responders will look first.
FAQ
My key was in a client bundle for two weeks before I noticed. Assume the worst? Yes. Bundle contents are fetchable by anyone for the entire window, including automated scanners that index such things continuously. Rotate immediately, then reconcile the usage history against your own traffic to quantify the excess.
Do free-tier or trial keys matter less? They cap spend but still consume shared quota and can reach data within scope. Rotation urgency drops; hygiene requirements don't — especially since trials upgrade into paid tiers without keys changing.
Can I restrict an LLM key to specific models or endpoints? Provider-side scoping is coarser than per-endpoint: project/workspace membership is the main lever, plus role assignments. Design projects around that reality — a project whose keys should never touch file storage shouldn't have file storage in scope.
We caught it fast and rotated. Anything else owed? Review the exposure window's usage for unauthorized calls (billing reconciliation), check whether files were listed or retrieved, and fix the leak path that put the key in reach — rotation without path repair guarantees a repeat.
LLM keys are the credentials most worth scanning for continuously, because their abuse is measured in dollars per hour. KeyDrift's free scan checks your deployed bundles in minutes — no signup required.