GPT Image 2.5 is live — OpenAI's newest image model, targeted edits that leave the rest of the frame alone
All resources

· reAPI Team

API key leaked: stop unauthorized usage and charges

Contain an API key leak, separate new usage from pending charges, replace exposed credentials safely, and prepare the evidence needed for a billing review.

API key leaked: stop unauthorized usage and charges

Revoke the exposed key in the provider's account console now. Record the time. You can investigate the screenshot, repository or log entry after the credential has been invalidated.

Deleting the place where the secret appeared does not invalidate a copy somebody already has. GitHub's guidance puts revocation or rotation before repository cleanup for that reason.[1] If the key is in use by your application, expect the replacement to need coordination. A working application is not a reason to leave a known exposed credential active.

Start from your normal account login

Use your usual bookmark or the provider's known account address, not a link in a message claiming to have found the leak. Find the affected credential by its safe identifier or label and use the documented revoke or disable control. You do not need to paste its full value into an incident note.

On reAPI, revocation prevents new requests with that key. Applications that still hold it will need a replacement. The authentication documentation also states that pending tasks can continue to completion and consume credits after revocation.[2] That second part matters when you look at the balance immediately afterward.

Check automatic recharge and outstanding work as separate controls. If you choose to turn off automatic funding, establish what that setting actually stops. It does not revoke an API credential, cancel accepted work or by itself explain a charge. If a provider supports cancellation, check the task's confirmed outcome and billing rule rather than assuming that clicking Cancel made the job free.

At this stage, keep the note small: affected account, credential label, discovery time and revocation time, with a time zone. More detailed investigation can follow. Waiting until you have a perfect report leaves the exposed credential available for longer.

Why the balance can change after revocation

Suppose a generation is accepted at 09:01, you revoke the exposed key at 09:03, and the task finishes at 09:07. This is an illustrative sequence, not a reported incident. On reAPI, the documented pending-task behavior permits that earlier job to finish and consume credits. The task contract also separates the reservation made at submission from final settlement.[2][3]

The 09:07 settlement does not, on its own, establish that the key authenticated a new request after 09:03. Check when the task was accepted. That timestamp answers a different question from the time processing ended or the time a charge appeared.

Do not assume the reverse, either. An unfamiliar request accepted after your recorded revocation time still needs investigation. Check other active credentials, the account or organization in view, and the applications or people that can submit work there. If the available records do not identify the credential or acceptance time, leave that part unknown and ask support to help establish it.

For each suspicious request, keep its ID, model or endpoint, acceptance time, completion time and settled amount where available. Add whether your application recognizes it. You are trying to separate known work from unexplained work, not to prove a theory from a falling balance.

The amount at risk may also differ from the amount already settled. Read the platform's reservation and final-usage fields according to its contract. On reAPI, a processing task with zero settled usage has not completed billing; that zero is not evidence that the earlier reservation was refunded.[3] Keep unresolved tasks visible until their outcomes are known.

Replace the key in the process that actually uses it

Create a replacement through the provider's authenticated dashboard and store it through your application's secret-management mechanism. reAPI documents key creation in API Keys settings and recommends separate credentials for environments and services.[2] Give the replacement a clear purpose so the next rotation does not require rediscovering every consumer.

Before deploying it to an affected consumer, block any exposure path you already know about. If that process publishes its credential in a frontend bundle or prints it to a shared log, fix that path first. The full investigation can continue afterward; the replacement should not be sent through a mechanism already known to leak it.

Then follow the credential into the application. Check the web service, background workers, scheduled jobs and any automation that calls the API. Include local development and CI only if they use that credential. The point is to find actual readers of the secret, not to produce a long checklist of systems you do not run.

Imagine that the website starts working again after rotation, but a background worker's API calls still return authentication errors. This is a hypothetical diagnostic case. The successful web request confirms that one process has working configuration. It says nothing about a separate worker's environment. Check what the failing worker actually loads before creating yet another key.

Verify the configuration without printing the secret. Use safe labels, the configured secret reference and the application's existing validation procedure. There is no need to launch an unfamiliar paid generation just to check that a replacement value was supplied to a process.

For a reAPI authentication error, check the documented Bearer header and the actual error response. Invalid or revoked credentials are distinct from insufficient balance and endpoint errors.[2] If a new key is valid but the account cannot fund the requested work, rotating it again will not solve the balance problem.

Keep server credentials on the server. Google's key-management guidance cautions against embedding secrets in client code, and GitHub recommends safer secret handling to prevent renewed exposure.[4][1] A browser bundle or shared mobile application is not an appropriate place to hide the replacement just because it makes the shortest tutorial example work.

Find how this copy escaped

Once the old credential is invalidated and legitimate consumers have their replacement, return to the exposed copy. Check the particular path that could have published it: repository history, built frontend assets, CI logs, notebooks, screenshots or shared troubleshooting output.

If it appeared in a Git repository, deleting the current file is only one part of cleanup. GitHub explains that sensitive content can remain in history, forks and clones.[1] Coordinate any history-removal work with the people using the repository. Revocation is what addresses the copied credential; cleanup reduces continued exposure at those locations.

If it appeared in a log, find the code that printed it. Removing one log entry while leaving the same logging path active can expose the replacement next time the application reports an error. Review the output of your normal troubleshooting process as well as successful requests: secrets can end up in the material people copy when something goes wrong.

If it appeared in a screenshot or shared workflow, replace that material with a sanitized version and check whether the workflow still contains the old value. Do not ask colleagues to send the secret back to you as proof that they removed it. Use the credential's safe label and the affected file or message location to track the cleanup.

Keep findings separate from attribution. A request missing from your application logs is evidence that those logs do not account for it. It does not establish who sent it or where they obtained the credential. Record the exposure you can confirm and the traffic you can identify; leave the rest open for investigation.

Restrict the replacement where the controls fit

Google recommends separate credentials for applications or teams, appropriate restrictions and monitoring.[4] Applied to a rotation, that means giving a background image worker only the access it needs where the provider supports that restriction, rather than recreating one broadly shared credential by habit.

The available controls differ. fal documents permissions, expiration and allowed-model settings. OpenRouter's Security Center documents spending and expiry controls and distinguishes disabling a key from archiving it; its IP allowlist is an Enterprise feature.[5][6] Check the scope of the option your account actually exposes before relying on it.

For a spending limit, establish whether it constrains a credential, account, funding event or some other quantity, and what happens to accepted work. For expiration, identify which applications need a replacement before that date. For a model restriction, verify that it still permits the legitimate workload. A control is useful when you know which failure it contains.

Assign someone to act on unusual usage alerts. A notification can tell you to investigate; the response still requires someone who can identify the affected credential and revoke it. Keep that ownership information beside the key's purpose. It is easier to use during an incident than an unexplained list of old credential names.

Changing API providers can be a separate product decision after the incident. It does not invalidate a key left active at the old provider, and it does not fix an application that puts its next server secret into the same public bundle.

Send support the unresolved questions

Prepare the billing request from the timeline you have built. Include the account or project, safe credential identifier, suspected activity window, revocation time and request IDs. Attach the relevant charge records and any receipt identifier the provider needs. Keep API keys, card details and private customer files out of public tickets and screenshots.

You can phrase the request around facts you still need confirmed:

We revoked the affected credential at [time and time zone]. The attached request list separates activity recognized by our application from activity we cannot account for. Please confirm whether any of these requests were accepted after revocation, explain the settlement of the earlier pending jobs, and review the disputed charges.

Fill in what your records support. If an acceptance timestamp or credential association is missing, say so rather than inventing it. Include the actions already taken so support can distinguish ongoing access from a bill that still needs reconciliation.

A security investigation and a billing adjustment are separate outcomes. Detecting a leak or opening a ticket does not establish that the charges will be reversed. Keep the review open until the provider has answered the specific requests and explained any adjustment. Meanwhile, the application's replacement credential, repaired exposure path and outstanding jobs can each be checked against their own records.

References

  1. GitHub. Removing sensitive data from a repository. Retrieved November 15, 2026. GitHub security guidance.
  2. reAPI. Authentication reference. Retrieved November 15, 2026. Authentication documentation.
  3. reAPI. Tasks reference. Retrieved November 15, 2026. Task lifecycle and settlement.
  4. Google Cloud. Best practices for managing API keys. Retrieved November 15, 2026. Google Cloud authentication guidance.
  5. fal. Key-based authentication. Retrieved November 15, 2026.
  6. OpenRouter. Manage and de-risk your API keys with new Security Center. Published September 28, 2026; retrieved November 15, 2026.
All resources