AI Prompt Secret Leakage: How API Keys Escape Through LLM Providers, Resellers and Logs
Between July and November 2026, Dragos researchers sent roughly two million prompts to AI providers and resellers, each carrying unique bait credentials. Some of those fake AWS keys were later used for tens of thousands of AWS API calls. That is ai prompt secret leakage measured rather than imagined, and it lands at a moment when coding agents routinely paste .env files, stack traces and config blobs straight into model context. The uncomfortable lesson is that a prompt is not a private function call. It is a network message that crosses several companies, each with its own logs, retention windows and security posture. This post maps that request supply chain hop by hop, explains what “zero data retention” actually promises in the major vendors’ current wording, and shows how to build a defense that assumes some hop will eventually leak.
What this covers: the Dragos canary findings, where prompts get persisted, what ZDR and abuse-monitoring retention mean at OpenAI, Anthropic, Google, Azure and OpenRouter, a threat model table, a Python redaction middleware, and a canary-based detection loop.
Context and Background
Secrets have always leaked through the paths developers use most. A decade ago it was public Git repositories, which is why GitHub redesigned its token formats in 2021 with prefixes such as ghp_ and a built-in checksum, explicitly to make secret scanning cheap and accurate. Today the busiest path out of a developer’s machine is the LLM request, and AI prompt secret leakage is the predictable result. An assistant asked to “fix this deploy script” receives the script, the environment it reads, and often the error output that echoes a connection string.
The industry already had a name for the downstream crime. In May 2024, Sysdig’s threat research team coined “LLMjacking” for attacks that use stolen cloud credentials to run hosted models at the victim’s expense. Sysdig estimated a worst case of more than $46,000 per day in model consumption for a single compromised account. In September 2026 the SANS Internet Storm Center described an agent-assisted operation that harvested access to weakly secured LLM resale gateways and pooled it behind one unified API. Inference capacity, not the key itself, is the prize.
What was missing was evidence about the middle of the chain. Most guidance on LLM data retention reads vendor policy pages and assumes the policy is the behavior. That leaves the real llm prompt logging risk, which lives in intermediaries, largely unmeasured. The Dragos study, published on 19 November 2026 by Chief Research Officer HD Moore, tested behavior directly. It is the first large public dataset showing what happens to secrets after they enter routers, reseller marketplaces and provider front ends.
If you already run an LLM gateway, you have one natural control point. Our LLM gateway architecture guide covers routing, budgets and fallbacks; this post adds the threat model for what flows through it. The OWASP Top 10 for LLM Applications already lists LLM02:2025 Sensitive Information Disclosure and LLM03:2025 Supply Chain as separate risks. The Dragos data shows they are the same risk seen from two ends of one wire.
The AI Request Supply Chain: Where AI Prompt Secret Leakage Happens
Direct answer: AI prompt secret leakage happens because a prompt travels through several independent parties before and after inference: your SDK and gateway, optional routers and reseller marketplaces, the provider’s front door, and its abuse-monitoring and application-state stores. Each hop can log, cache or forward the prompt. Any one of them being breached, careless or malicious exposes every secret inside it.

Figure 1: The AI request supply chain. Every box with a storage edge is a place a secret can persist after the response returns.
Figure 1 traces a single request from a developer tool or application, through the vendor SDK and an internal gateway, optionally through a third-party router and a reseller marketplace, to a provider’s front door and the model itself. Storage edges mark where content can be written: gateway request logs, router logs, seller logs, the provider’s abuse-monitoring store and any application-state store such as stored conversations or files. The diagram is deliberately pessimistic, because the Dragos findings touched almost every box.
Hop by hop, the persistence points multiply
Start at the client. Coding agents and IDE assistants gather context automatically, and the context window is the point of collection. A secret in a .env file, a shell history or a failing test’s log output becomes prompt content without anyone typing it. Local telemetry, crash reporters and the agent’s own transcript files are the first persistence layer.
The second layer is your own infrastructure. Gateways such as LiteLLM, Portkey or a homegrown proxy usually log requests for cost attribution and debugging. Observability pipelines then copy those logs into tracing backends, which typically have longer retention and broader access than the gateway. Our LLM observability architecture piece discusses trace design; the security implication is that prompt bodies in traces are secrets at rest in a system rarely scoped as a secrets store.
The third layer is the one most teams never see. Routers and aggregators expose one API across many upstream providers, and some forward traffic to marketplaces where independent sellers host models. Dragos found that sellers on one inference marketplace could read and retain prompts simply by listing a model at a low price and enabling request logging. They also found a router forwarding some traffic to that marketplace without disclosing the hop; Dragos reports that it has since stopped.
Policy describes intent; the breach surface is the front door
The fourth layer is the provider. Here policy and reality diverged most sharply in the study. In the largest incident, roughly “a couple hundred” bait AWS keys were each sent in a single request to one provider within a few windows in late October. Every request in those windows was stolen, and some were copied before a model ran, which Dragos reads as theft at the provider’s front door.
That detail matters for architecture. Zero data retention is a promise about what a provider stores after processing. It says nothing about whether the API edge, load balancer or request queue was compromised while your prompt was in flight. Dragos reports that in two other breaches, some stolen requests were marked ZDR. A retention policy cannot protect data an attacker reads before the retention decision is ever made.
Retention windows are long enough for secondary misuse
The final layer is what happens after a response returns. Dragos observed a Chinese AI lab’s systems fetching secret URLs from more than half of the prompts sent to its models between July and October. That included roughly two-thirds of requests flagged “no data collection” or ZDR. The fetcher usually appeared two to three days after each request, and U.S. hosts reselling that lab’s models triggered the same fetcher.
The study also saw a large U.S. provider still crawling a secret URL more than two months after a single inference call. In one case, a secret link surfaced in a Feishu work chat 24 days after the prompt was sent. It was opened from three desktops and three phones in Beijing and Shanghai within two minutes. Dragos does not identify these providers, and its write-up describes the Feishu origin inconsistently, so treat attribution as unresolved.
In my reading, some URL fetching may be automated link safety scanning rather than espionage. That does not make it safe. A fetch proves the prompt content left the inference path and entered a separate system, with its own access controls and logs. For a credential embedded in a URL, that system now holds a working secret.
What Zero Data Retention Actually Means, Vendor by Vendor
The phrase “zero data retention API” is marketing shorthand for several narrower contractual promises. Each vendor scopes it differently: which endpoints qualify, what happens to flagged content, and whether you need approval. The table below summarizes the wording on each vendor’s documentation as fetched on 23 November 2026. Check your own contract, because enterprise terms override public pages.
| Vendor / route | Default handling of API prompts | ZDR or equivalent | Notable exceptions |
|---|---|---|---|
| OpenAI API | Abuse-monitoring logs retained up to 30 days; not used for training unless you opt in | ZDR and Modified Abuse Monitoring, both require prior approval; under ZDR store is always treated as false |
Files, assistants, threads, vector stores, fine-tuning, evals and batches are not ZDR-eligible; Responses API state defaults to 30 days when stored |
| Anthropic API | Privacy center: commercial inputs and outputs deleted within 30 days by default | ZDR per organization via sales; nothing stored at rest after the response returns | Flagged content may be kept up to 2 years; classifier scores up to 7 years; Files API, Batch at 29 days and some tools are not ZDR-eligible |
| Google Gemini API | Prompts, context and outputs retained 55 days for abuse monitoring | Not described on the abuse-monitoring page | Flagged content can be reviewed by authorized Google staff |
| Azure OpenAI in Foundry | Abuse-monitoring store per geography, human review only for flagged or patterned use | Modified Abuse Monitoring via Limited Access application; verify with ContentLogging = false |
Microsoft says Modified Abuse Monitoring will not be offered for models released on or after 1 Nov 2026, from a date to be announced |
| OpenRouter | Routes to many upstreams with differing policies | Account-wide or per-request provider.zdr: true; data_collection: "deny" filter |
In-memory caching not counted as retention; plugins and tools outside ZDR scope; Google models on Vertex require Safety Retention from 18 Oct 2026 |
Three patterns stand out. First, every vendor keeps a carve-out for abuse monitoring or flagged content, so “zero” never means “never”. Second, ZDR is endpoint-scoped: the moment you upload a file, run a batch or use a hosted tool, you may be outside it. Third, at a router, ZDR is a filter on which upstreams receive your traffic. It is only as strong as the router’s knowledge of each upstream’s real behavior, and the Dragos data shows that knowledge can be wrong.
Anthropic’s two pages, read together
Anthropic’s privacy center article, dated 1 July 2026, says commercial API inputs and outputs are deleted within 30 days by default. Its API documentation describes retention feature by feature and states that, under ZDR, Anthropic does not store prompts or responses at rest after the response is returned. The documentation also notes that ZDR organizations cannot call the API directly from a browser, because cross-origin requests are rejected. That is a sensible nudge toward server-side mediation, which is also where redaction belongs.
Azure’s verification attribute is underrated
Azure is the only vendor here that exposes a machine-checkable signal. Microsoft’s data privacy page states that a ContentLogging capability with value false appears on the resource only when abuse-monitoring storage is turned off. You can assert that in infrastructure-as-code tests and in a policy check. Every other vendor in the table asks you to trust a contract you cannot observe from outside.
Deeper Analysis: How the Canary Methodology Works and What It Proves
Canary tokens, also called honeytokens, are credentials or resources that exist only to be detected. They have no legitimate use, so any use is a signal. The Dragos study is effectively a large-scale canary deployment against an entire market, and its design is worth copying for your own monitoring.

Figure 2: Canary seeding and correlation. A unique token per route turns any later use into a pointer back to the leaking hop.
Figure 2 shows the loop. A seeding service mints a unique secret for each request, records which route and provider received it, and embeds it in an otherwise ordinary prompt. Listeners for each token type wait. When an attacker or crawler uses a token, the listener records source address, client fingerprint and time, and the correlation step maps that token back to a single route.
What was seeded
Dragos seeded AWS access keys, DNS names, URLs, Git repository URLs, SSH passwords and image URLs used for route tracing. It started with Thinkst Canarytokens, then built a custom service with DNS, web, Git, SSH, database and mail listeners. The AWS keys were tied to empty, fully logged accounts, so every API call became evidence rather than damage. The team also traced about 2,000 routes using error-response envelopes and signature matching, which is how it could tell which upstream actually served a request.
AWS key canaries are the strongest signal because use is unambiguous. Thinkst’s design relies on CloudTrail recording the call, which reveals source IP, service and function. Thinkst also documents that some AWS calls may not appear in CloudTrail. It therefore runs a “safety net” that compares the IAM credential report’s last-used time against CloudTrail, with the caveat that the report can be regenerated only about every four hours.
What the attacker behavior tells us
The timeline from the largest breach is a useful calibration point. One bait key seeded on 21 October was first used the next day and was still in use three weeks later. The attacker’s tooling shifted from a script posing as Chrome on Windows, to Boto3 inside OrbStack, to the AWS CLI on Kali Linux. On 1 November, an LLM-driven pentest framework called ARTEX joined in, with user agents Dragos says were absent from public indicator lists it checked.
Two inferences follow, and I label them as mine. First, a one-day time-to-use means that rotation measured in weeks is not a mitigation for prompt leakage; only credentials that expire in minutes or hours meaningfully shrink the window. Second, an attacker who keeps using a key for three weeks is not monitoring for revocation signals. Detection on first use, followed by fast revocation, would have cut that activity to a day.
The marketplace cases moved even faster in some respects and slower in others. Two prompts sent through one seller were opened about a day and a half later, followed by username guessing at a login page. Prompts routed through a different seller for the same model were untouched, which is the control that makes the finding credible. In another case, an attacker in France tried an SSH root login using a password from a prompt, four times in two minutes.
A threat model for prompt-borne secrets
The table maps each hop to its realistic threat and the control that addresses it. It assumes the prompt contains a secret despite policy, because developer tooling makes that inevitable.
| Hop | Threat | Evidence | Primary control | Detection |
|---|---|---|---|---|
| Client and agent | Agent gathers .env, logs, history into context |
Common agent behavior | Client-side redaction, secret-free dev environments | Local canaries in decoy files |
| Internal gateway and traces | Prompt bodies logged with long retention | Common default | Redact before logging; log hashes, not bodies | Canaries in synthetic traffic |
| Router or aggregator | Undisclosed forwarding to other hops | Dragos: undisclosed marketplace hop | Pin upstreams; enforce ZDR and data_collection deny |
Per-route canaries |
| Reseller marketplace | Seller-enabled request logging | Dragos: prompts opened about 1.5 days later | Avoid marketplaces for sensitive work | Per-seller canaries |
| Provider front door | Breach before inference | Dragos: three providers compromised | Short-lived credentials, redaction | AWS key canaries |
| Provider back end | Retention, crawling, secondary use | Dragos: fetches up to 2+ months later | Direct contracts, verified ZDR | URL and DNS canaries |
Capacity and cost of doing this yourself
Running your own canary program is cheap compared with the risk. Thinkst’s public Canarytokens service is free for basic tokens, and a single empty AWS account with CloudTrail costs little to keep. The real cost is operational: someone must own alert triage, and each canary must be traceable to the route that carried it.
As an illustrative sizing, not a benchmark, consider an organization using three upstream routes and four models. Seeding one AWS key canary and one URL canary per route-model pair per day is 24 tokens daily. That is trivial load for any listener and well under the noise floor of real traffic. The point is coverage of distinct routes, not volume.
Building the Defense: Redaction, Policy and Short-Lived Credentials
A defense against AI prompt secret leakage has to work even when every hop after your gateway is hostile. That assumption sounds paranoid until you notice it matches the evidence. The architecture in Figure 3 puts the decisive controls on infrastructure you own.

Figure 3: Defense-in-depth for prompt-borne secrets. Redaction and policy run on owned infrastructure; detection assumes they will sometimes fail.
Figure 3 has four control planes. The client and redaction middleware strip known credential formats and high-entropy strings before content leaves the process. The policy gateway enforces which providers and routes are allowed, applies ZDR flags, and logs only redacted bodies. Egress allowlists ensure no tool or agent can bypass the gateway. A secrets broker issues short-lived credentials so that a leaked value expires quickly, and a canary service seeds traffic and feeds a security information and event management (SIEM) system.
Redaction middleware in Python
Redaction is the cheapest control with the highest coverage, so it comes first. The sample below combines three detectors: provider-specific patterns adapted from the open-source gitleaks rule set, a generic assignment pattern for password= style lines, and a Shannon entropy check for unknown token formats. It replaces each finding with a stable placeholder, so the model still sees structure and your logs can correlate repeats without storing the value.
import hashlib
import math
import re
from dataclasses import dataclass, field
# Provider patterns adapted from the gitleaks default config (MIT licensed).
# Keep these in sync with your scanner of record; formats change.
PROVIDER_PATTERNS = {
"aws_access_key_id": re.compile(r"\b((?:AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\b"),
"github_pat": re.compile(r"\bghp_[0-9A-Za-z]{36}\b"),
"github_fine_grained": re.compile(r"\bgithub_pat_\w{82}\b"),
"github_other": re.compile(r"\bgh[osur]_[0-9A-Za-z]{36}\b"),
"anthropic_key": re.compile(r"\bsk-ant-api03-[A-Za-z0-9_\-]{93}AA\b"),
"openai_key": re.compile(r"\bsk-(?:proj|svcacct|admin)-[A-Za-z0-9_\-]{20,}T3BlbkFJ[A-Za-z0-9_\-]{20,}"),
"gcp_api_key": re.compile(r"\bAIza[\w\-]{35}\b"),
"slack_bot": re.compile(r"\bxoxb-[0-9]{10,13}-[0-9]{10,13}[A-Za-z0-9\-]*"),
"private_key_block": re.compile(
r"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S]+?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY-----"
),
"url_with_credentials": re.compile(r"\b[a-z][a-z0-9+.\-]*://[^\s:/@]+:[^\s@/]+@[^\s/]+"),
}
ASSIGNMENT = re.compile(
r"(?i)\b(password|passwd|secret|token|api[_-]?key|access[_-]?key|client[_-]?secret)"
r"\s*[:=]\s*['\"]?([^\s'\"]{8,})"
)
CANDIDATE = re.compile(r"[A-Za-z0-9+/_\-=]{24,}")
def shannon_entropy(s: str) -> float:
counts = {c: s.count(c) for c in set(s)}
return -sum((n / len(s)) * math.log2(n / len(s)) for n in counts.values())
@dataclass
class RedactionResult:
text: str
findings: list = field(default_factory=list)
def _placeholder(kind: str, value: str) -> str:
digest = hashlib.sha256(value.encode()).hexdigest()[:10]
return f"[REDACTED:{kind}:{digest}]"
def redact(text: str, entropy_threshold: float = 4.0) -> RedactionResult:
findings = []
def sub(kind):
def _r(m):
findings.append((kind, m.start()))
return _placeholder(kind, m.group(0))
return _r
for kind, pattern in PROVIDER_PATTERNS.items():
text = pattern.sub(sub(kind), text)
def assign(m):
findings.append(("assignment", m.start()))
return f"{m.group(1)}={_placeholder('assignment', m.group(2))}"
text = ASSIGNMENT.sub(assign, text)
def entropy(m):
token = m.group(0)
if token.startswith("[REDACTED") or shannon_entropy(token) < entropy_threshold:
return token
findings.append(("high_entropy", m.start()))
return _placeholder("high_entropy", token)
text = CANDIDATE.sub(entropy, text)
return RedactionResult(text=text, findings=findings)
def redact_messages(messages: list[dict]) -> tuple[list[dict], list]:
"""Apply to OpenAI- or Anthropic-style message lists before any network call."""
out, all_findings = [], []
for msg in messages:
content = msg.get("content")
if isinstance(content, str):
r = redact(content)
out.append({**msg, "content": r.text})
all_findings += r.findings
elif isinstance(content, list):
parts = []
for part in content:
if part.get("type") == "text":
r = redact(part["text"])
parts.append({**part, "text": r.text})
all_findings += r.findings
else:
parts.append(part)
out.append({**msg, "content": parts})
else:
out.append(msg)
return out, all_findings
if __name__ == "__main__":
sample = "deploy with AWS_ACCESS_KEY_ID=AKIAABCDEFGHIJKLMNOP and password: hunter2hunter2"
print(redact(sample).text)
Three design choices deserve explanation. The placeholder includes a truncated SHA-256 digest so you can count how often the same secret appears without retaining it. The entropy threshold of 4.0 bits per character is a starting point, not a tuned value. Per-string entropy is capped by length: a 24-character string can score at most about 4.58 bits (log2 of 24), so random tokens of that length land near the cap while repetitive identifiers score far lower. Expect false positives on hashes, UUID-heavy logs and minified code, and tune against your own traffic before blocking.
Where should this run? Ideally twice. Run it in the client or agent harness so secrets never reach your gateway logs, and again in the gateway as the enforcement point for tools you do not control. For a production approach to personal data rather than credentials, our PII detection and reversible tokenization pipeline covers Presidio-based entity detection and vault-backed restoration.
Gateway policy and egress allowlists
Redaction catches formats; policy catches routes. Your gateway should hold an explicit allowlist of upstream providers and model endpoints, and reject requests that would be served by anything else. If you use a router, pin providers rather than accepting automatic fallback, and set ZDR and data-collection constraints in every request, not just the account default.
On OpenRouter, for example, the documented controls are an account-wide privacy setting that restricts routing to ZDR endpoints, a per-request provider.zdr: true flag, and a data_collection: "deny" filter that limits routing to providers that do not collect user data. OpenRouter documents that the per-request flag can only tighten account-wide enforcement, not loosen it. That is the right semantics, but you still need to verify that your chosen upstream behaves as declared.
Egress control closes the bypass. Agents, notebooks and CI jobs should not be able to reach model APIs directly. In Kubernetes, a default-deny egress policy plus an explicit rule to the gateway does this cleanly; our Kubernetes egress network policy guide walks through the pattern. On laptops, an enterprise proxy with a domain allowlist does the same job less elegantly.
Short-lived credentials shrink the blast radius
Redaction will miss something. When it does, the leaked value should already be close to expiry. AWS’s own IAM guidance labels long-term access keys for programmatic access “not recommended”. Keys beginning with AKIA are long-term, while keys beginning with ASIA are temporary credentials from AWS STS.
The practical target is that no long-lived cloud key exists on a developer workstation at all. Use federated identity, short STS sessions and workload identity for services. A secrets manager such as OpenBao can issue dynamic database and cloud credentials with leases measured in minutes; our OpenBao production tutorial shows the setup. For agents acting on behalf of users, token exchange with narrow scopes is the equivalent pattern, covered in our post on AI agent identity and delegated authorization.
Return to the Dragos timeline: first use one day after seeding. A one-hour STS session leaked through a prompt would have expired roughly 23 hours before that first use. That single arithmetic comparison is the strongest argument in this post for ephemeral credentials.
Detection and Response: Treat Every Canary Hit as an Incident
Prevention will fail eventually, so detecting AI prompt secret leakage matters as much as stopping it. Dragos’s fourth recommendation is to seed your own canaries and treat any use as an incident. That advice is easy to agree with and hard to operationalize, because a canary alert is only useful if it tells you which route leaked and what else crossed that route.

Figure 4: Response flow for a canary hit. Correlation to route and time window drives every subsequent action.
Figure 4 starts when a listener fires. The token ID resolves to a route, provider, model and send time. From there the response forks: freeze that route at the gateway, query your redaction findings and gateway logs for real secrets sent through the same route in the same window, rotate those, notify the provider, and record the event for vendor risk review.
Design canaries for attribution
Every canary must be unique per route and per time window, or the alert cannot point anywhere. Encode a random ID that maps to a database row, never meaningful text an attacker could recognize. Mix types, because each catches a different behavior: AWS keys catch credential abuse, URLs and DNS names catch crawlers and secondary processing, and SSH or database passwords catch interactive attackers.
Place them where real secrets would appear. A canary in a synthetic prompt that looks like a health check is less convincing than one embedded in a realistic config snippet or stack trace. Seed both synthetic traffic and, with care, real traffic through decoy files that agents might read.
Know the limits of the signal
A quiet canary proves nothing. Attackers may harvest prompts without acting on them, act only on high-value formats, or validate keys with calls that leave sparse logs. Thinkst’s safety net exists precisely because some AWS calls may not appear in CloudTrail. Conversely, a URL fetch may be a provider’s link scanner rather than an attacker, but it still demonstrates that content left the inference path.
Response time is the variable you control. The difference between a three-week compromise and a one-day compromise in the Dragos data was not detection technology; Dragos saw the use as it happened. It was the absence of an owner on the victim side, because the providers did not know until notified.
Trade-offs, Gotchas, and What Goes Wrong
Every control against AI prompt secret leakage has a cost. Redaction degrades some tasks. A model debugging an authentication failure may genuinely need to see that a token is malformed. Placeholders that preserve type and length hints help, but some workflows will need a sanctioned path, such as a local model, rather than an exception to the rule.
Entropy detection is noisy. Git SHAs, content hashes, JWTs in test fixtures and base64 images will trip it. Teams that ship it in blocking mode on day one tend to disable it by day three. Run it in report-only mode first and measure the false-positive rate on real traffic.
ZDR is not a security control against breach. It is a retention promise, and the Dragos evidence shows stolen requests that carried ZDR flags. Do not let a ZDR contract substitute for redaction or ephemeral credentials. It also narrows features: files, batches and several hosted tools fall outside it at OpenAI and Anthropic.
Routers add convenience and opacity in equal measure. Automatic fallback is attractive for availability, but every fallback target is another party in your supply chain. If you cannot name every upstream that can see a given request, your threat model is incomplete.
Self-hosting is not free either. Dragos calls it the only option where no one else reads your prompts, but the model server, its logs and its GPU hosts become your attack surface. A self-hosted endpoint with request logging enabled and broad operator access can be worse than a well-run provider.
Finally, canaries can mislead. Seeding real traffic risks confusing users or tripping provider abuse systems. A canary that looks fake will be skipped by careful attackers. Keep a register of every live canary so an alert is never mistaken for a real compromise, or the reverse.
The anti-pattern underneath most of these is treating the prompt as internal data. It is egress. Classify it, filter it and monitor it the way you would any outbound message to a third party.
Practical Recommendations
Reducing AI prompt secret leakage starts with what you control completely: the content leaving your processes and the credentials that could appear in it. Then reduce the number of parties that see your traffic. Finally, assume failure and build detection that tells you which party failed.
For most teams, the highest-leverage move this quarter is removing long-lived cloud keys from developer machines and agent environments. Redaction is next, because it protects every hop at once. Router hygiene and canaries follow, and vendor contract work runs in parallel.
Be precise when you talk to vendors. Ask which endpoints your ZDR covers, how flagged content is handled, whether any reseller or subprocessor hop exists, and how they would detect a breach at their API edge. Ask for the evidence, not just the policy. Where a machine-checkable signal exists, such as Azure’s ContentLogging attribute, test it in CI.
A short checklist for any team worried about an api key leak in AI tooling:
- Inventory every path from tools and services to model APIs, including routers and fallbacks.
- Block direct egress to model APIs; force traffic through one gateway.
- Run client-side and gateway redaction in report mode, tune, then enforce.
- Replace
AKIAkeys and other long-lived tokens with short STS sessions or dynamic secrets. - Pin upstream providers; set ZDR and data-collection deny per request where supported.
- Avoid reseller marketplaces for any workload that might carry secrets.
- Seed unique canaries per route, wire alerts to on-call, and rehearse the Figure 4 flow.
- Log redacted prompt bodies or digests only, and cap trace retention.
Frequently Asked Questions
Can AI providers see the API keys I paste into prompts?
Yes. Anything in a prompt is plaintext to every party that handles the request, including your gateway, any router or reseller, and the provider. Providers process it to run inference and, depending on policy, may retain it for abuse monitoring. OpenAI’s documentation cites up to 30 days for abuse-monitoring logs, while Google’s Gemini API page cites 55 days. Dragos also showed that providers can be breached at the front door before retention policy applies. Treat any secret that entered a prompt as exposed, and rotate it. That is the practical meaning of AI prompt secret leakage for an individual developer.
Does zero data retention mean my prompts are never stored?
No. Zero data retention usually means the provider does not store prompts or responses at rest after the response is returned. It is endpoint-scoped, so file uploads, batches and some hosted tools fall outside it. Vendors also keep carve-outs: Anthropic may retain flagged content for up to two years even under ZDR. Crucially, ZDR does not protect against an attacker reading requests in flight. Dragos found stolen requests that were marked ZDR in two of the three provider breaches it described.
How do I stop coding agents from sending secrets to LLMs?
Combine prevention, containment and detection. Keep long-lived secrets off developer machines by using federated login and short-lived credentials. Run a redaction layer in the agent harness or a local proxy that strips known key formats and high-entropy strings before any network call. Force all model traffic through one gateway with an egress allowlist, so tools cannot bypass it. Then seed decoy credentials in files agents are likely to read, and alert on any use. No single layer is sufficient.
Are LLM routers and resellers safe for sensitive prompts?
They add parties you may not see. Dragos found sellers on one inference marketplace logging prompts, and a router forwarding traffic to that marketplace without disclosing the hop. Some routers offer controls such as OpenRouter’s per-request ZDR flag and data-collection deny filter. Those controls are useful, but they depend on accurate upstream declarations. For sensitive work, the Dragos write-up recommends going directly to a first-tier provider, choosing upstreams yourself, and avoiding reseller marketplaces entirely.
What is a canary token and how does it detect prompt leaks?
A canary token is a fake credential or unique resource that has no legitimate use, so any use signals compromise. To detect prompt leaks, you embed a unique token in prompts sent through each route, record which route carried it, and alert when it is used. An AWS key canary fires when someone calls AWS with it; a URL or DNS canary fires when something fetches or resolves it. Thinkst offers free Canarytokens, which Dragos used before building its own service.
How fast are leaked AI prompt secrets exploited?
Fast enough that only short-lived credentials help. In the Dragos study, one bait AWS key seeded on 21 October was first used the next day and stayed in use for three weeks. In a marketplace case, prompts were opened about a day and a half after being sent. Some provider crawlers revisited secret URLs more than two months later. Plan for exploitation within a day, and for very long tails, which is why one-hour credentials outperform monthly rotation.
Further Reading
- Designing an LLM gateway: routing, budgets, fallbacks and policy enforcement
- Building a PII detection and reversible tokenization pipeline for LLM applications with Presidio
- Running OpenBao in production for dynamic, short-lived secrets
- Agentic AI security and prompt injection defenses
- Dragos: Three breaches, endless leaks: Your AI supply chain needs canaries
- OpenAI API documentation: data controls, ZDR and abuse monitoring
By Riju — about
