Skip to content
October 2026: Railway and OpenCode incidents, what to do

AI API key security

Stop a leaked AI key before it spends.

Keep your provider keys out of your applications. Give every app, agent and tool an INFRO gateway key instead, with an off switch, an IP allowlist, model limits and a spend limit, each checked before your provider is called.

An example request log for one INFRO gateway key that leaked. The key is limited to its servers’ network, 203.0.113.0/24, and to a daily spend limit of $50.00. Requests from other networks are refused with 403 ip_not_allowed and a model outside the key’s allowlist with 403 model_not_allowed; neither reaches a provider. Requests from the servers run on the organization’s own OpenAI and Anthropic accounts, with an estimated provider cost on each.

Example: one gateway key, after it leaked.

  • 4 checks

    On every request, before your provider is called.

  • 32 networks

    Per key in its IP allowlist, IPv4 or IPv6, on every plan.

  • No deploy

    To switch a leaked key off. Every request with it is refused.

  • AES-256-GCM

    On every provider key you connect. It is never shown again.

Where provider keys live

The same provider key usually sits in five places, and any copy can spend from the whole account. With INFRO the provider key is sealed in one place and each app, agent and tool holds its own gateway key. Pick where the leak happens.

Pick where the key leaks
One provider key, copied everywhere5 of 5 places exposed
Your provider key sk-proj-••••7Hc2Copied to 5 places
  1. Production environment variablessk-proj-••••7Hc2Leaked here
  2. CI and deploy secretssk-proj-••••7Hc2Same key
  3. Developer laptops and .env filessk-proj-••••7Hc2Same key
  4. Coding agents' shellssk-proj-••••7Hc2Same key
  5. Third-party AI toolssk-proj-••••7Hc2Same key
Exposed
Your whole provider account, up to whatever limits are set at the provider, until the key is deleted there.
To recover
Delete the key at the provider, then redeploy all 5 places.
With INFRO, one gateway key per place1 of 5 keys exposed
Your provider key sk-proj-••••7Hc2Sealed in INFRO
  1. checkout-apisk_infro_••••a91f$50 a day203.0.113.0/24Leaked, contained
  2. ci-deploysk_infro_••••3c7e$10 a day203.0.113.64/27Unaffected
  3. maya-laptopsk_infro_••••5d20$5 a dayExpires in 30 daysUnaffected
  4. claude-codesk_infro_••••8b14$20 a dayAnthropic onlyUnaffected
  5. support-toolsk_infro_••••e602$15 a month1 modelUnaffected
Exposed
checkout-api: one key, refused outside your servers' network and capped at $50 a day inside it.
To recover
Switch it off in the console, with no deploy, then rotate it in that one place. The other 4 keep working.

Four checks

Each check refuses with its own documented code, so your logs say exactly why, and each one moves from the console or the API without a deploy. All four are on every plan.

  1. 01

    Off switch

    Is this key on?

    Turn a key off from the console or the API and every request with it is refused. Its secret, limits and history are kept; turning it on again restores the same key.

    403 key_disabledDocs

  2. 02

    Allowed networks

    Is it calling from your servers?

    Up to 32 IPv4 or IPv6 addresses or CIDR ranges per key, matched against the client address Cloudflare's edge reports, never X-Forwarded-For. With no trusted address, the request is refused.

    403 ip_not_allowedDocs

  3. 03

    Models and providers

    Is it allowed this model?

    Approve the models an organization, project or key may call, and the providers a key may reach. Each key belongs to one environment and never reaches a connection outside it.

    403 model_not_allowedDocs

  4. 04

    Spend limit

    Can its limit cover this request?

    A daily, weekly, monthly or lifetime limit per key, beside budgets per organization, project and member. A request the limit cannot cover is refused before the provider is called.

    402 key_budgetDocs

  • Rotation with an overlapRotate in one step: the new key takes every setting of the old one, and the old key keeps working for up to seven days while you deploy, or stops at once. The spend limit is shared, so rotating never buys fresh room.
  • ExpiryGive a key a time after which it stops working, for a contractor, a demo or a migration.
  • Shown once, stored as a hashA gateway key is 32 random bytes, shown once and stored only as a SHA-256 digest. A database disclosure does not disclose a usable key.
  • Guessing is throttledAn address that fails authentication 30 times in a minute is refused with a 429 until the minute passes, before any key is looked up.

Spend caps

A leaked key, an agent stuck in a loop, one customer scripting your free tier: each stops at a cap its own size instead of reaching your whole budget. Every applicable cap is checked before your provider is called, counting the worst case of requests already in flight.

Caps stack

A request must fit every cap that applies to it. The tightest one decides, so a small cap in the right place stops a problem long before the organization’s.

  1. Organization
  2. Project
  3. Member
  4. Gateway key
  5. End customer
Example budgets for one organization: an organization hard cap, a project budget, a gateway key’s daily limit, a key’s lifetime limit and an end-customer cap. In the chosen crisis, “A gateway key leaks”, the matching cap reaches its limit and the next request is refused with 402 key_budget before any provider is called. The key stops at $50 for the day. Every other key keeps serving.

The key stops at $50 for the day. Every other key keeps serving.

Spend caps by scope: periods, behaviour, refusal code and plan
CapPeriodHow it behavesRefused withPlan
OrganizationMonthly target and hard capThe target alerts; the hard cap alerts or blocks. Only the owner sets it.402 organization_budgetEvery plan
ProjectMonthlyAlert or block, with alerts at your own thresholds.402 project_budgetEvery plan
MemberMonthlyAlert or block, for one person's activity.402 member_budgetEvery plan
Gateway keyDaily, weekly, monthly or lifetimeAlways blocks. A lifetime limit never resets.402 key_budgetEvery plan
End customerDaily, weekly or monthlyOne rule for every customer, per organization or project, with overrides your backend sets.402 end_user_budgetTeam and up

Tested under loadIn a sandbox test, a $1 blocking cap held in 12 of 12 runs at up to 500 concurrent requests (the test and its method). Caps count INFRO’s estimate of provider cost, not your provider’s invoice, and a model with no known price is refused under a blocking cap unless you allow it, so keep a spending limit at the provider too. Spend controls docs

A key leaked

For an INFRO gateway key. If a provider key leaked, delete it at the provider first: that is the only thing that stops it.

  1. 1Contain it without a deployTurn the gateway key off, or keep your application running by narrowing the key to your servers' networks and lowering its spend limit. None of it needs a deploy, and every check runs before any provider call.
  2. 2Replace itRotate with no overlap when the key has leaked. The replacement keeps the label, project, limits, allowlists, environment and history access, and is shown once.
  3. 3Read what it didEvery request record names the gateway key that made it, with its model, status and estimated provider cost; filter the request log and usage by that key. The console shows how many requests each key's allowlist refused today.
  4. 4Check for use outside INFROOn the Business plan, cost reconciliation with usage access switched on reports usage on a connected provider key that never went through INFRO. Without that access it says "not checked", never "no bypass": read the provider's own usage page.
  5. 5Keep the recordKey changes, rotations and policy edits are in the audit log with who made them and when, in rows the database refuses to update or delete.
curl -X PATCH https://api.infro.io/manage/v1/gateway_keys/$KEY_ID \
  -H "Authorization: Bearer $INFRO_MANAGEMENT_TOKEN" \
  -H 'If-Match: "7"' \
  -H "Content-Type: application/json" \
  -d '{"disabled": true}'

# Every request with the key: 403 key_disabled
# Its secret, limits and history are kept.

The same three changes are on the key’s page in the console. With the management API, a change needs the version you last read (If-Match), so two people containing one incident cannot overwrite each other.

Secrets in prompts

People paste .env files into chats and agents read them out of shells. On the Business plan, guardrails check prompts, tool calls and responses for secret formats, then block the request, replace the match with [SECRET] or flag it, before your provider is called.

  • OpenAI
  • Anthropic
  • Google API key
  • AWS access key id
  • GitHub token
  • Slack token
  • Stripe live key
  • INFRO key
  • JWT
  • PEM private key

Detection is pattern-based: it matches these formats and nothing else, so it misses AWS secret access keys, passwords and formats it does not know. Every match is counted on the request record. Guardrails docs

Example: a developer pastes an environment file into a chat completion. Before the request reaches the provider, the guardrail’s secret detector replaces the OpenAI key with [SECRET], and the response carries the header X-INFRO-Guardrails: redacted.

Agents, tools and people

Coding agents get their own keys

Claude Code, Codex and the agent SDKs call INFRO's /v1/messages and /v1/responses with a gateway key instead of your Anthropic or OpenAI key. Give each developer or agent one, with a spend limit, an expiry and a network allowlist; revoking it touches nobody else.

Claude Code & Codex

Tool credentials stay out of agentsBusiness

Register each MCP server once with its token. INFRO adds it on every call, so no agent, prompt or config file holds it, and each gateway key gets only the tools it was granted.

MCP gateway security model

Console sign-in is the other door

Two-factor with an authenticator app, passkeys and hardware keys, a list of sessions you can end, and an organization setting that requires two-factor for every member. SAML or OIDC single sign-on and SCIM from the Business plan.

Two-factor & sessions

The keys we hold

A platform that stores provider keys is exactly what the October attacks went after, so the same questions apply to us. These controls are the Trust Center's own statements, word for word.

Provider credentials are sealed, and bound to one tenant
The provider keys you connect are encrypted with AES-256-GCM under a key held as a Worker secret, never in the database. The organization and connection identifiers are bound in as additional authenticated data, so a sealed credential copied into another tenant's row — or another row of the same tenant — fails closed rather than decrypting. Credentials connected for cost reconciliation are sealed separately, under their own binding.
There is no reveal, anywhere
Once a provider credential is saved, no interface returns it — not the console, not the API, not the internal operator console. What either side can see is the last four characters and the timestamps. If you lose the key, you rotate it at the provider; we cannot show it to you.
INFRO API keys are hashed at rest
A gateway key is 32 bytes from a cryptographic random source. What we store is its SHA-256 digest, a display prefix and the last four characters, so a database disclosure does not disclose a usable credential. Revocation writes a tombstone rather than deleting the row, so it cannot be shadowed by a stale cache entry still propagating between locations.
The encryption key can be rotated without your involvement
Rotating the key that seals customer credentials re-seals every stored credential in place. It does not ask customers to re-enter anything, and the stored algorithm carries a version string so a future scheme can coexist with the current one rather than needing a flag day.

What INFRO cannot do

A provider key taken from INFRO, or from anywhere else, can be used directly against the provider, outside every INFRO limit. Connect keys scoped to their own project or workspace, with a spending limit set at the provider: it is the control that holds even if we fail. What is not in place yet is listed on the Trust Center.

October 2026

In both, the advice was the same: replace the key, delete the old one at the provider, and read what it did. The fewer places a provider key lives, the fewer rotations a breach costs; the keys you do hand out should carry limits you can move without a deploy.

RailwayDisclosed October 21, 2026

What Railway said

An unauthorized party may have accessed encrypted customer environment variables and, for some of them, obtained the decrypted contents, in a series of attacks aimed at compromising AI inference providers.

What to do

Roll every variable Railway held, AI provider keys first: replace, delete the old key at the provider, deploy, and review the old key's usage.

Railway breach: what happened and what to doReviewed October 22, 2026

OpenCodeDisclosed October 17, 2026

What OpenCode said

A breach related to a large-scale distillation attack affected 1.4% of OpenCode Console users, those with external AI providers linked, and provider keys saved in a workspace may have been exposed.

What to do

Create a scoped replacement, revoke the old key at the provider, and review provider usage from 16 October onward.

OpenCode Console breach: what happened and what to doReviewed October 21, 2026

Each summary is from the company’s own disclosure, as our analysis quotes it. Both incidents were open when written; the analyses are reviewed weekly and carry every change in their revision notes.

Field guides

FAQ

What should I do if my OpenAI or Anthropic API key leaked?

Create a replacement key at the provider, delete the leaked key there, deploy the replacement, then review the old key's usage at the provider for the whole time it could have been used. Deleting the key at the provider is what stops it; nothing an application or a gateway does can call a stolen key back. Then give the replacement a spending limit at the provider and keep it out of code, client apps and shared environments.

How does INFRO limit the damage from a leaked API key?

Your applications hold INFRO gateway keys instead of your provider keys. Each gateway key can be turned off (403 key_disabled), limited to up to 32 networks (403 ip_not_allowed), narrowed to approved models and providers, and given a daily, weekly, monthly or lifetime spend limit (402 key_budget). Every check runs before your provider is called, on every plan, and none needs a deploy. A leaked gateway key is a bounded problem you can switch off; a leaked provider key reaches the whole provider account.

Can I cap AI spend per customer, per project or per time period?

Yes. Budgets apply per organization (a monthly target that alerts and a hard cap that alerts or blocks), per project and per member (monthly), and per gateway key (daily, weekly, monthly, or a lifetime limit that never resets). From the Team plan, end-customer caps limit each of your own customers daily, weekly or monthly, with overrides for specific customers. Every applicable cap is checked before your provider is called, counting the worst case of requests already in flight, and a refused request is a 402 that names the cap. Caps count INFRO's estimate of provider cost, not your provider's invoice, so keep a spending limit at the provider as well.

Does INFRO store my provider API keys, and how are they protected?

Yes: you connect your own provider keys once and INFRO uses them to serve your requests. Each is encrypted with AES-256-GCM under a key held as a Worker secret outside the database, with the organization and connection bound in, so a copy of the database alone opens nothing. No console screen, endpoint or export returns a saved credential; the console shows its last four characters. Gateway keys are stored only as a SHA-256 digest.

Can a stolen provider key bypass INFRO?

Yes. INFRO governs only the traffic that goes through it. A provider key taken from anywhere, including from INFRO, can be used directly against the provider, outside every INFRO limit. Connect keys scoped to their own project or workspace with a spending limit set at the provider: that limit holds even if we fail. On the Business plan, reconciliation with usage access switched on reports usage on a connected key that did not go through INFRO.

What happened in the OpenCode and Railway breaches?

OpenCode said on 17 October 2026 that a breach related to a large-scale distillation attack affected 1.4% of its Console users, those with external AI providers linked, and that provider keys saved in a workspace may have been exposed. Railway said on 21 October 2026 that an unauthorized party may have accessed encrypted customer environment variables and decrypted some of them, in attacks aimed at compromising AI inference providers. In both cases the advice is the same: replace the key, delete the old one at the provider, and review its usage. INFRO has an analysis of each, written only from the companies' own statements.

Can INFRO stop API keys from being pasted into prompts?

On the Business plan, guardrails check prompts and responses for OpenAI, Anthropic, Google API key, AWS access key id, GitHub token, Slack token, Stripe live key and INFRO key formats, JWTs and PEM private keys, and block the request, replace the match with [SECRET] or flag it before your provider sees it. Detection is pattern-based: it misses formats it does not know, such as AWS secret access keys and passwords.

Do Claude Code and Codex need my Anthropic or OpenAI key?

Not through INFRO. They call INFRO's /v1/messages and /v1/responses with a gateway key, so each developer or agent can have its own key with a spend limit, an expiry and an optional network allowlist, and revoking it touches nobody else's access. An agent can still read any key left in the same shell, so remove raw provider keys from developer environments.

What is LLMjacking?

LLMjacking is the use of stolen cloud or AI API credentials to call hosted language models at the victim's expense, either for the attacker's own use or to sell the access on. The defence is the one for any credential that can spend money: keep provider keys out of code and client apps, give every key a spend limit, watch usage per key, and be able to switch a key off without a deploy.

Which INFRO plans include these controls?

Every plan includes turning a key off, allowed networks, model and provider limits, spend limits, rotation and expiry, two-factor sign-in and passkeys and the audit log. Spend alerts go to email on every plan, and to Slack and signed webhooks from the Startup plan. Guardrails, SSO and SCIM, cost reconciliation with bypass detection and the MCP gateway are on the Business plan.

Compliance, the full control list and what is not in place yet are on the Trust Center. Found a vulnerability? Write to security@infro.io.

Get started

Make your next leaked key a bounded problem.

Your providers, your contracts, your keys, sealed in one place. Every key you hand out, limited and switchable. 0% markup on model spend.