Skip to content

Security and governanceGuide

Signs your AI API key is being abused, and what to check

A stolen AI key rarely announces itself. It shows up as a model you never call, a key that should be idle, a day with no night in it, or output tokens out of all proportion to input. Here is where to look in each provider's console and what to do first.

By INFRO Editorial

Published

10 min read

Amber glass bars on a dark ground with a line across their tops that jumps sharply at one tall bar

In short

Signs an AI API key is being abused: usage on a key that should be idle, models your code never calls, flat round-the-clock traffic with no quiet hours, a jump in output or reasoning tokens relative to input, batch or cache patterns you do not use, new keys you did not create, and spend that departs from your usual day. Check per-key usage first (OpenAI's Usage API grouped by api_key_id, Anthropic's Usage page or Usage API filtered by key, Google's AI Studio usage and Cloud Billing reports by SKU), then revoke at the provider.

Key takeaways

  • Look per key, not per account: abuse hides in an account total and stands out on the one key that should be quiet.
  • The strongest single signal is usage on a key that should be idle; the next is a model your code never calls.
  • CISA's distillation advisory lists round-the-clock usage, many IPs on one account and new accounts at full usage at once; applying them to your own keys is an inference, not the advisory's guidance.
  • Provider usage reports rarely show the caller's IP, so preventive controls (IP allowlists, scoped keys, provider spend limits) matter more than after-the-fact forensics.
  • A gateway sees only traffic sent through it: a stolen provider key used directly is visible only in the provider's own usage data.

How do you tell if your AI API key is being abused? Look at usage per key, not per account, and look for things your own code would never do: activity on a key that should be idle, models you never call, traffic that runs flat through the night, output tokens far out of proportion to input, and keys or members you did not create. Each provider shows these in a different place, and most of them lag by minutes to a day, so the order you check them in matters.

This guide lists the signals, where OpenAI, Anthropic and Google show each one, a triage table for the first hour, and what to do once you are fairly sure. For what to do after you confirm a leak, see the provider-specific runbooks for a leaked OpenAI key and a leaked Anthropic key.

Why abuse hides in the total

A stolen key is usually used for one of three things: resold access through a proxy, bulk generation of outputs for someone else's training data, or running the attacker's own workload on your bill. All three add spend to an account that already has spend. On an account-level chart the new traffic looks like a busy week. On the chart for the one key that was leaked, it looks like nothing your application has ever done.

That is the first rule: break usage down by key, project or workspace before you judge it. It is also why one key per workload and environment pays off long before an incident: a key used by five services gives you nothing to compare against. How to secure LLM API keys covers the scoping.

The signals, strongest first

Usage on a key that should be idle

A key for a staging environment on a Sunday, a key you rotated out last month, a key issued to a contractor whose project ended. Any non-zero usage there is a question you can answer quickly, and a wrong answer is a strong sign.

Models your code never calls

Applications call a short, stable list of models. Usage of a frontier model you never deployed, a reasoning model on a key that only serves embeddings, or an image or video model on a chat-only key is hard to explain innocently. Attackers harvesting outputs tend to pick the most capable model available, because that is the output worth having.

Round-the-clock flat usage

Most product traffic follows people: it rises in the working day of your users and falls at night. A key that suddenly runs at a steady rate for 24 hours, with no quiet period, deserves attention. The CISA, NSA and FBI advisory on distillation campaigns lists round-the-clock usage among the indicators of abusive accounts, along with shared accounts used from many IPs and user agents, and new subscriptions that go straight to maximum usage1. The advisory is written for AI companies detecting abuse on their platforms and has no section for ordinary key holders; reading the same patterns on your own keys is our inference, not its guidance.

Output tokens out of proportion to input

Most applications have a characteristic ratio of input to output tokens: a retrieval feature sends long prompts and gets short answers, a drafting tool the reverse. Someone collecting training data wants long, complete answers, often with visible reasoning. A sharp rise in output tokens per request, or in reasoning tokens on a model that produces them, is a signal even when total spend looks ordinary. OpenAI notes that usage details can include cached-input and reasoning-token counts, which explain why a response's visible length does not show its full token usage2. Reasoning tokens and cost explains the mechanics.

Batch or cache patterns you do not use

If your workload never uses a provider's batch tier and the report shows batch usage on one key, someone else submitted it. The same applies to a sudden change in cached-input share. The CISA advisory names usage tuned to quotas and costs, including new accounts with high immediate hit rates, as a distillation indicator1.

New keys, members or service accounts

An attacker with console access, rather than one key, will often create a key of their own so that revoking yours does not lock them out. Audit logs show this. OpenAI's Audit Logs API records the lifecycle of API keys, invitations, users and service accounts, login failures and organization settings changes, once an owner turns audit logging on3.

Spend that departs from your usual day

A fixed threshold catches a bill that doubles; it misses a key that quietly adds 15% every day. Compare each day with the same weekday's usual level, per key or project. Five LLM spend anomalies covers the patterns legitimate code produces, so you can rule them out.

Signals that come from the provider

Some signs arrive by email: an abuse notice, a warning, an alert that a compromised API key was detected, or a suspension. Google Cloud's guidance for an abuse notification starts with verifying that the project was not compromised by checking its usage and logs, and treats a compromised-key alert as a reason to generate a new key and add API key restrictions4. Make sure those emails reach someone: Google recommends adding Essential Contacts for security, technical and suspension notices4. What to do when a provider suspends your account covers the next step.

Where each provider shows usage per key

ProviderConsole viewPer-key detailGranularity
OpenAIUsage Dashboard: filter by project and by user, shown in UTC2Usage API: api_key_ids filter and group_by=api_key_id, also model, project, batch, service tier51 minute, 1 hour or 1 day buckets5
AnthropicConsole Usage and Cost pages6Usage API: filter and group by API key, workspace, model and service tier (Admin API key required)61 minute, 1 hour or 1 day; data usually within 5 minutes6
Google (Gemini API)AI Studio usage and cost dashboards, filterable by project, model and time frame7Cloud Billing reports grouped by project or SKU, with date grouping for daily detail8Daily in billing reports

Two details trip people up. OpenAI's dashboard has its own project selector, and clearing it shows the whole organization2; a filtered view left over from last week can hide the abuse. In Anthropic's reports, usage from the Console's own playground carries a null API key id, and the default workspace shows as a null workspace id6, so null rows are not by themselves suspicious.

What to check first at OpenAI

  1. Open the Usage Dashboard, clear the project filter, and pick a range that starts before the suspected window2.
  2. Pull usage grouped by api_key_id and model with one-hour buckets from the Usage API (an Admin key is needed)5. Look for keys and models you do not recognize.
  3. Check the audit log for API keys, service accounts and invitations created in the window3.
  4. If anything is unexplained, follow OpenAI's own guidance: change the password, which logs out current sessions within 30 minutes, and report through the unauthorized activity webform9.

What to check first at Anthropic

  1. Open the Console's Usage page and Cost page for the window6.
  2. With an Admin API key, query the Usage API filtered or grouped by API key and workspace, in hourly buckets6. A workspace per workload makes this readable.
  3. Compare the service tier and cache columns with what your code uses: batch, priority, cache reads and cache creation each appear separately6.

What to check first at Google

  1. In AI Studio, open the usage and cost dashboards for each project and filter by model7.
  2. In Cloud Billing reports, group by SKU and by date to see which Gemini SKUs grew and on which day8. Viewing every linked project needs a billing account role such as Billing Account Viewer8.
  3. Check the project owner's email and the Essential Contacts for abuse or compromised-key notices4.

A triage table for the first hour

SignalLikely innocent causeLikely abusive causeFirst action
Usage on an idle or retired keyA forgotten cron job or testKey leaked from a repo, laptop or third-party toolRevoke the key at the provider
A model you never callA developer trying a new modelSomeone harvesting outputs from the best modelRevoke; restrict models on the replacement
Flat 24-hour usageA new batch or evaluation jobProxy or scripted collectionAsk the key's owner; revoke if unexplained
Output tokens per request jumpA prompt change or new model snapshotLong-form output collectionCompare with recent deploys
Batch or priority tier you do not useA new internal jobBulk generation by a third partyRevoke; check which key submitted it
New key, member or service accountA colleague's setupAn attacker keeping accessRemove it; review console sign-ins
Provider abuse notice or suspensionRarely innocentCompromise or a policy breachTreat as an incident

Once you are fairly sure

Act at the provider first. A leaked provider key works directly against the provider's API, so rotating it in a secrets manager, a gateway or a CI system does nothing until the old key is revoked at the source. Then:

  • Revoke or disable the key at the provider and issue a scoped replacement.
  • Lower the provider-side spend limit on the project or workspace for the next few days.
  • Review the audit log for new keys, members and setting changes.
  • Record the window, the models, the token counts and the cost from the provider's own report.
  • Report the activity to the provider with those figures, and ask about the charges.
  • Find the source: a repository, a client-side bundle, a CI log, a laptop, or a third-party tool that held the key.

Responding to AI API key theft and asking for a refund and LLM incident response cover the longer tail.

Prevention that makes detection easier

Detection after the fact is limited by what providers report. Provider usage reports group by key, project, model and time; they do not generally tell you the caller's IP address. Controls set in advance close that gap:

  • IP allowlisting at the provider. OpenAI lets you restrict an organization or project to up to 50 IP addresses or CIDR ranges; requests from elsewhere fail with 401 and ip_not_authorized even with a valid key10. OpenAI is clear that this reduces risk but does not prevent all misuse10.
  • Provider spend caps. Google added monthly spend caps per project for the Gemini API, with a delay of about ten minutes during which overages are the customer's responsibility7. Provider spend limits compared covers the others.
  • One key per workload and environment, so every key has an expected shape.
  • A credential inventory with an owner and a purpose for each key. Building an AI credential inventory explains how.

How INFRO helps you spot abuse

INFRO is a gateway in front of provider accounts you own. For traffic that goes through it, it records every request with its key, project, environment, model, token counts and estimated provider cost, and its spend alerts flag a day that departs from a scope's usual day, with forecasts, delivered by email, Slack, Teams, PagerDuty or webhook (alerts). Gateway keys can be limited to chosen providers and IP ranges, and a request from outside them is refused with 403 ip_not_allowed before any provider call; budgets per organization, project, member and key refuse a request with 402 before the provider is called (spend controls).

Here is the limit, stated plainly. INFRO's controls govern traffic that goes through INFRO. A provider key stolen from anywhere, including from a platform that stores provider keys as INFRO does, can be used directly against the provider and bypasses every INFRO budget, allowlist and alert. For that case the evidence is in the provider's usage data. On the Business plan, INFRO's reconciliation with usage access on reads your provider's daily token counts per provider key and reports traffic that reached the account without going through INFRO; without usage access it reports "not checked", never "no bypass". Your backstops remain provider-side: scoped keys, provider spend limits, revocation at the provider, and the provider's own usage reports.

Summary

Abuse of an AI key shows up per key: a key that should be idle, a model you never call, a day without a night, output out of proportion to input, and new keys you did not create. Check per-key usage at the provider first, revoke at the provider, and set the controls in advance (scoped keys, IP allowlists, spend caps) that make the next incident smaller and easier to see.

Questions readers ask

How do I know if my OpenAI API key has been compromised?
Group your organization's usage by API key (the Usage API accepts group_by=api_key_id) and look for activity on a key that should be quiet, models your code does not call, and usage at hours your traffic never runs. Check the audit log for keys you did not create. If anything is unexplained, revoke the key, then use OpenAI's unauthorized activity form.
Can I see which IP address used my API key?
Generally not from the provider's usage reports, which group by key, project, model and time. A gateway or your own application logs record the caller's address for traffic that passes through them. That is why restricting a key to known IP ranges in advance is more useful than trying to trace a thief afterwards.
Does high usage at night mean my key was stolen?
Not on its own: batch jobs, scheduled evaluations and users in other time zones all run at night. It matters when a key whose workload follows business hours suddenly runs flat around the clock, which is one of the patterns CISA's distillation advisory lists for abusive accounts.
What should I do first if I see signs of abuse?
Revoke or disable the key at the provider, not only in a gateway or secrets manager, because a stolen provider key works directly against the provider. Then lower the provider-side spend limit, review the audit log for new keys or members, and report the activity to the provider with the dates and amounts.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Spend anomaly and drift alerts

    Available with a plan

    Each scope's usual day is learned from its own history; a day that departs from it, a budget forecast to be exceeded, cost estimates drifting from the provider's own figures, unpriced traffic and failing connections become findings in the console. Routed to email on every plan, and to Slack and signed webhooks from the Startup plan.

    Read the documentation for Spend anomaly and drift alerts
  • Budgets and spend ceilings

    Available with a plan

    A hard cap per organization, project, member, and key, with alerts at your own thresholds.

    Read the documentation for Budgets and spend ceilings
  • Key limits and rotation

    Available with a plan

    Limit a gateway key to chosen providers or IP ranges, and rotate it with an overlap window so the old key keeps working while you deploy the new one.

    Read the documentation for Key limits and rotation
  • Provider cost reconciliation

    Available with a plan

    Daily comparison of estimated spend against the cost reported by OpenAI's and Anthropic's own cost APIs, using a separate admin credential, with the likely cause of a persistent gap and a suggested rate you can apply. Included on the Business plan.

    Read the documentation for Provider cost reconciliation
  • Environments

    Available with a plan

    Production, staging and development to start, and your own beside them. A connection or route serves one, several or every environment; each gateway key belongs to exactly one, and never reaches a connection outside it.

    Read the documentation for Environments
  • Audit log

    Available with a plan

    Member, key, and policy changes recorded with actor and timestamp, viewable in the console.

    Read the documentation for Audit log

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.China-Based Artificial Intelligence Companies Conducting Industrial-Scale Distillation Campaigns Against U.S. AI Companies (AA26-251A) (opens in a new tab) — CISA, NSA and FBI. Accessed Oct 21, 2026.
  2. 2.Reviewing API usage and costs (opens in a new tab) — OpenAI Help Center. Accessed Oct 21, 2026.
  3. 3.Admin and Audit Logs API for the API Platform (opens in a new tab) — OpenAI Help Center. Accessed Oct 21, 2026.
  4. 4.Respond to abuse notifications and warnings in Google Cloud (opens in a new tab) — Google Cloud. Accessed Oct 21, 2026.
  5. 5.Completions usage (API reference) (opens in a new tab) — OpenAI. Accessed Oct 21, 2026.
  6. 6.Usage and Cost API (opens in a new tab) — Anthropic. Accessed Oct 21, 2026.
  7. 7.Giving you more transparency and control over your Gemini API costs (opens in a new tab) — Google. Accessed Oct 21, 2026.
  8. 8.Analyze billing data and cost trends with Reports (opens in a new tab) — Google Cloud. Accessed Oct 21, 2026.
  9. 9.I'm seeing unrecognized activity on my OpenAI account (opens in a new tab) — OpenAI Help Center. Accessed Oct 21, 2026.
  10. 10.IP allowlisting for OpenAI API (opens in a new tab) — OpenAI Help Center. Accessed Oct 21, 2026.

About this article

Provider features are taken from OpenAI's help center and API reference (usage dashboard, Usage API, audit logs, IP allowlisting, unrecognized activity), Anthropic's Usage and Cost API documentation, Google Cloud's billing reports and abuse-response documentation and Google's Gemini API cost-control announcement, and the CISA/NSA/FBI advisory AA26-251A, all opened on 2026-10-21. Where the post applies the advisory's indicators to an ordinary key holder, it says so. Written by the team that builds INFRO.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.