Stopping API keys from reaching an LLM provider: secret blocking at the gateway
A coding tool is useful because it can see the working tree. That is also how a secret leaves the machine. Claude Code, Codex, or any similar client reads a file, pastes a log, or carries a token forward in a thread, and then sends a prompt to a provider. Whatever is in the prompt goes with it.
LLM egress filtering does not have to live in each client, and it does not have to wait until a key has already shown up in a provider's logs. You can put a self-hosted LLM gateway in your own network, point the tools at it, and scan the prompt before anything is cached or sent.
That is the inspect step in Qosway. Secrets stop at the gateway, before any cache or provider sees them.
The problem: a coding tool sends prompts to a provider
These tools are built to read the repo. They open files to fix a bug, to explain a module, to draft a migration. They also carry conversation history forward, so a secret that entered the thread once can be resent on later turns.
The dangerous cases are ordinary. A developer asks the agent to debug a connection error, and the agent reads a local config that contains a live credential. Someone pastes a failing request and the Authorization header is still in it. A test snapshot includes a token that was never meant to leave the laptop. A .env file, a Terraform variable, a JWT in a fixture, a database URL with a password in a compose file: once it is on disk, it can go into a prompt.
None of that requires a malicious user. It only requires a tool that can see the tree and a path out to a model API. Client-side habits help — gitignore, a pre-commit check, not keeping production keys in the repo — but they are uneven. Each developer has a different machine, a different client, and a different habit of pasting logs into a prompt. The consistent place to enforce a rule is the hop every request already has to take if you point Claude Code, Codex, or any OpenAI-compatible client at a gateway.
Where the check sits: stop 2 of 7
Qosway's path through a request is fixed, in the order in the code. After the client key is identified, the next stop is Inspect: the prompt is scanned for secrets before anything is cached or sent. A blocked request never reaches Reserve, Route, Remember, or Send.
That order matters for two reasons.
First, the provider must not see the secret. If the filter runs after the upstream call, you only have a record of a leak that already happened.
Second, the cache must not see it either. Exact cache entries are a SHA-256 of model, messages and tools, held in Redis, and they hold full answers. Those entries are not encrypted. If a prompt containing a key were cached, you would have stored the problem and you might serve it again. Semantic cache holds answers and embeddings, not prompt text, but inspection still has to happen first so a blocked prompt is never embedded or stored.
A request can leave the line at Inspect and return a named error to the client. The later stops never run.
The ten default rules
Qosway ships ten built-in rules. All ten are on by default, and each can be switched off in the panel without a redeploy.
- Private keys
- AWS access keys
- GitHub tokens
- Slack tokens
- Stripe live keys
- Google API keys
- OpenAI and Anthropic keys
- Database URLs with a password
- Assigned passwords and API keys
- JSON Web Tokens
The site does not publish the pattern text for these rules, and it does not define "assigned passwords and API keys" in operational detail. "Stripe live keys" is the wording on the page; it does not say what happens with test keys. Treat the list as the product states it.
Making it yours
The built-in set will not know about your internal token format. You can add your own phrases or RE2 patterns, and an allow-list for exact values.
The allow-list is for exact values, not for "anything that looks similar." That is the right shape if you have a known test credential that would otherwise trip a rule, and the wrong shape if you were hoping to allow a whole class of strings with one entry.
Any of the ten defaults can be switched off. Because the rules are patterns, you are responsible for the ones you add. A pattern that is too tight misses. A pattern that is too loose blocks ordinary code.
What the client sees
If a rule matches, the request is refused. The client gets HTTP 403 egress_blocked with the rule name. The request is not rewritten and forwarded. The matched text is not logged, cached, or returned.
The site does not publish a sample response body or a panel screenshot. What it states is the status, the named error, and the rule name. An engineer who is blocked can see which rule fired. That is the whole client-facing signal.
What is stored
What the gateway keeps for a blocked request is narrow: time, key id, and rule name only, in SQLite. The matched secret is never stored. Usage and quota records also reference a key id, never the key.
You can see that a block happened without the secret sitting in a log file or a cache entry.
What it cannot do
Qosway does not read meaning. Egress rules are patterns, and routing is rules, not a model judging your prompts. A secret that does not match a built-in rule or one of your patterns will go through. Obfuscation, unusual encodings, or a credential format you have not described will not be caught by magic.
It does not block personal data by default. Names and email addresses are not in the default set. The site's reason is that in code tools that is mostly false alarms. If you need that, you add your own patterns. Do not treat the default rules as a privacy program.
Outbound traffic, as listed on the site, is the providers you enable and the license check. Semantic matching uses a local embedder unless an OpenAI key is configured; then embeddings go to OpenAI. Inspection runs before the cache, so a blocked prompt should not be embedded. The configuration still matters: if you turn on that OpenAI key for semantic matching, embeddings for prompts that were not blocked can leave the network. If keeping that traffic on-network is part of the reason you self-host, leave the local embedder in place.
The gateway does not terminate TLS. Put it behind a reverse proxy, or bind it to loopback.
Block or redact?
A common picture of this problem is a secret redaction proxy: strip the token out of the prompt, maybe replace it with a placeholder, and send the rest to the provider. Qosway does not do that.
If a rule matches, the request is blocked. LLM egress filtering, here, means the request does not leave. The developer can remove the secret and try again.
Redacting and continuing means you have to be sure the remainder is still safe and that the model is not being asked to work with a mutilated prompt. Blocking is stricter, and it is also simpler: this request does not go to the cache or the provider.
The same binary also routes requests, caches repeated questions, and enforces daily and monthly token caps before the provider is called. That side is in Controlling Claude Code and Codex costs with a self-hosted gateway.
Try it
The product page is at qosway.com. If you want to see the route your own traffic would take, the site asks you to say which clients and providers you run today, and which rules you would want on day one.
Request a demo – hello@qosway.com