Calendar Icon White
November 4, 2026
Clock Icon
11
 min read

Claude Gateway: Govern Claude Code and Claude Apps Without Breaking Them

A Claude gateway is one control point between your Claude clients and the Anthropic API. Here is how to govern Claude Code on production data without breaking the agent.

Claude Gateway: Govern Claude Code and Claude Apps Without Breaking Them
ChatGPT
Perplexity
Grok
Google AI
Claude
Summarize and analyze this article with:

TL;DR

A Claude gateway sits between your Claude clients and the Anthropic API. The hard part is Claude Code reading production data, and blocking it just breaks the agent.

TL;DR:

  • A Claude gateway is a single control point between your Claude clients and the Anthropic API.
  • Most gateway discussion is about keys, routing and cost. For Claude specifically, the pressing question is what Claude Code reads, because coding agents routinely touch production data.
  • Blocking requests breaks the agent. Stripping values breaks the answer. Substituting them is the only approach that leaves Claude useful, and the restore has to reach inside tool calls.
  • Strac tokenizes sensitive values on the way out and restores them inside tool calls on the way back, so the agent completes real work and Anthropic receives tokens.
  • Setup is one environment variable. Deterministic tokens mean prompt caching keeps working.

Claude has quietly become the model that touches the most sensitive surface in a lot of companies. Not through the chat window, but through Claude Code reading a repository and querying a database, through Claude Desktop connected to internal systems, and through Agent SDK workflows that act on customer records. Every one of those paths sends real data to an API endpoint you do not control.

That is what people are actually looking for when they search for a Claude gateway. This guide covers what one is, how the Claude Code case differs from the rest, and how to govern it without turning a useful agent into a broken one.

✨ What is a Claude gateway?

A Claude gateway is a proxy between your Claude clients and the Anthropic API. Instead of each machine, service and agent holding its own key and calling the provider directly, everything points at the gateway, and the gateway decides what happens before the request continues.

Claude Code, Claude Desktop and the Claude Agent SDK all route through the Strac AI Gateway, which detects, tokenizes and restores before and after the Anthropic API
Every Claude client routes through one hop. Anthropic receives tokens; the real values are restored on the way back.

Three jobs justify putting one in the path:

  • Key management. One place to issue, rotate and revoke, instead of keys spread across laptops, CI and repositories.
  • Visibility. A record of what your agents are actually sending, which almost nobody has before they install one.
  • Data control. Deciding what is allowed to leave. This is the one that blocks deployments, and the one most gateways do not do.

For the vendor-neutral version of this, see what is an AI gateway. For the provider-routing angle, see what is an LLM gateway.

✨ Claude Code gateway: a coding agent on production data

Claude Code is the reason most security teams start caring about this. A chat assistant leaks whatever a human pastes into it. A coding agent leaks whatever it decides to read, which is a much larger and far less predictable surface.

Side by side comparison of Claude Code debugging against a production database copy without a gateway and with Strac tokenizing the query results
The most common Claude Code exposure: an agent querying a production copy, with every returned row entering the model context.

The pattern repeats across almost every team we talk to. An engineer asks Claude Code to debug a failing order. The agent does the sensible thing and queries the database, which in dev and test is frequently a copy of production. Four hundred rows of names, emails and card numbers land in the context window, and all of them go to the provider on the next turn. Nobody decided that should happen, and nobody can say afterwards what was retained.

Blocking the request is not a fix, because the agent needs the rows to do the work. Strac substitutes them instead, so the query returns, the agent reasons over tokens, and the debugging session proceeds normally.

If the data is shared in advance rather than queried live, you can also redact at the source with Postgres masking so the agent only ever reads masked rows, or with Endpoint DLP for files on the machine itself. Use either layer or both.

✨ Claude Apps gateway: one policy across every Claude surface

Claude Code is not the only path. Claude Desktop connects to internal systems, apps and connectors reach into SaaS tools, and Agent SDK workflows run unattended. Governing those one at a time does not scale, and the gaps are exactly where incidents happen.

Five governance controls for a Claude gateway: see, classify, control, continue and prove
One policy across Claude Code, Claude Desktop and SDK agents, rather than a separate control per surface.

Because Strac sits at the API boundary rather than inside any one client, every surface that speaks the Anthropic Messages API inherits the same policy. You define data elements, actions and exclusions once, and they apply whether the request came from a terminal, a desktop app or an unattended job.

For the inbound half, meaning what agents are allowed to pull in from your tools over the Model Context Protocol, pair this with an MCP gateway and read MCP DLP.

Claude Code LLM gateway: routing is not the hard part

Search for a Claude Code LLM gateway and most of what comes back is about provider management: spreading traffic across models, failing over, tracking spend. Those are real operational needs and the incumbents handle them competently.

They also do not change your exposure by one byte. Routing decides where a request goes. It never touches what is inside it. A team can deploy a perfectly engineered routing layer, watch their cost dashboard improve, and still be sending every customer record their coding agent reads straight to a provider.

So the useful way to evaluate a gateway for Claude Code is to ignore the routing feature grid, which is converging anyway, and ask the content question instead.

✨ The best Claude Code gateway for governance

Governance is the word that shows up once a security reviewer gets involved, and it usually means five specific things. Here is how the realistic options compare on them.

CapabilityStracCloudflare AI GatewayKongAzure API Management
Detects sensitive data in requestsYes, 255 element typesYesYes, AI PII Sanitizer pluginVia Azure AI Content Safety and Foundry filters, not APIM itself
Behaviour on a hitSubstitutes and restoresFlags or blocksSubstitutes, restores in response onlyAnnotates or blocks
Agent still completes the taskYesNoNoNo
Restores values inside tool callsYesNoNoNo
Images and PDFs via OCRYesLimitedNoNo
Deterministic tokens, caching survivesYesNot applicableNot applicableNot applicable
Runs fully in your own networkYes, no calls homeNoSelf-managed or Konnect SaaS control planeYour Azure tenant

Strac is first on governance for one reason the table makes plain: it is the only option that restores values inside tool calls. Kong comes closest of the incumbents, and its AI PII Sanitizer genuinely substitutes and can restore originals, but restoration lands in the response body rather than in the tool call an agent is about to execute. For a chat product that distinction is academic. For Claude Code, the tool call is the work. Everywhere else on this table, enforcing the policy means the agent stops, so the policy gets switched off within a month and the governance is theoretical.

The honest gap: Strac does not ship routing, failover or cost dashboards today. Those are on the roadmap. We built the classifier and the token vault first because that is the part that is genuinely hard and the part a reviewer actually blocks on.

See it on your own data. Send a few examples of what your Claude agents handle and Strac returns a tuned policy plus a report of exactly what Anthropic would have received. Book a demo or browse the integrations your agents already touch.

✨ What Anthropic actually receives

Real name, email and card values on the left become consistent tokens on the right at the provider
The same value always produces the same token, so Claude can still compare and group records without receiving them.

Tokens are deterministic rather than random, which is what keeps Claude useful. It can tell that two rows belong to the same customer, group by email address and refer back to a specific person later in a long session. It simply never learns who that person is.

✨ Prompt caching still works

Random masks produce a different token every turn so the cache never hits, while deterministic tokens keep the resent history byte-identical
A random mask per request changes the prefix every turn and the cache never hits. A deterministic token keeps history identical.

This deserves its own section because it is how most redaction layers die. Anthropic's prompt caching works by matching a prefix of the conversation. Claude Code sessions are long and resend a lot of history, so caching is doing real work on your bill. Any filter that generates a fresh placeholder per request changes that prefix every turn, the cache stops hitting, and costs climb for reasons nobody connects to the security tool they installed six weeks earlier.

Deterministic tokenization sidesteps it entirely. Strac also re-checks the agent's history on every request before it leaves, so a value that slipped in earlier does not quietly persist across a session.

✨ A worked example

An agent asked to refund an order and email the customer, start to finish.

Four-step flow with the agent querying real data, the model receiving tokens, a tool call containing tokens, and the agent sending email with real values restored
The provider only ever saw three tokens, and the right customer still received the refund email.

Step 1, in your environment. The agent queries the orders table and gets back real values:

SELECT name, email, card FROM orders WHERE id = 88213;
Jane Doe | jane.doe@example.com | 4111 1111 1111 1111

Step 2, at the provider. The gateway substitutes before the request leaves, so Claude receives:

[[NAME_ecc4dcdbb381c137]] | [[EMAIL_ADDRESS_f785576eceba2a00]] | [[CREDIT_CARD_c8d0a2f9aeab4158]]

Step 3, at the provider. Claude cannot send mail itself. It replies with a tool call, still using tokens:

send_email(to="[[EMAIL_ADDRESS_f785576eceba2a00]]", body="Hi [[NAME_ecc4dcdbb381c137]], your refund for order 88213 is on its way.")

Step 4, in your environment. The gateway restores the tokens in that tool call before your agent sees it, so your own code sends the real message:

send_email(to="jane.doe@example.com", body="Hi Jane Doe, your refund for order 88213 is on its way.")

✨ What the gateway covers

Coverage across prompts and queries, structured files, images via OCR and PDFs, with 255 data elements and 160 national ID types
Query results, command output, logs, JSON, CSV, images and PDFs, not just the prompt string.

Coding agents send far more than prompt text. Command output, stack traces, CSV exports, screenshots pasted into a session and scanned PDFs all carry values, and a gateway that only inspects the prompt string will pass your evaluation and miss all of it. Detection spans 255 data element types across PII, PHI, PCI and secrets, including 160 national ID formats, plus custom elements and exclusions you define.

✨ Two ways to run it

SaaS versus self-hosted comparison covering where it runs, connection, where real values go, detection models, token vault, and policy and audit
Same policy engine either way. Self-hosted keeps detection, the vault and the real values entirely inside your environment.
 SaaS (default)Self-hosted
Where it runsStrac-managed, on Strac's AWSDocker container in your VPC, on-prem, or your customer's infrastructure
Connect a Claude clientOne environment variableOne environment variable
Where real values goYour environment and StracNowhere outside your environment
Detection modelsRun by StracBundled in the image, run on your CPUs, no calls home
Token vaultEncrypted, held by StracAES-256-GCM on your storage, under a secret you hold
Policy and auditStrac consoleConsole or local policy file, JSON audit events to your SIEM

Connecting Claude Code in one line

There is no SDK to adopt and no wrapper to import. Point the client at the gateway and start it as normal:

export ANTHROPIC_BASE_URL="https://gw.yourtenant.strac.io"
claude

The same variable covers Claude Desktop, the Claude Agent SDK and any other client of the Anthropic Messages API. Agent code, prompts, tools and MCP configuration are untouched, which is usually what makes this deployable without a platform-team project.

🎥 See the detection engine at work

The gateway runs the same detection and remediation engine Strac applies wherever your sensitive data lives.

Strac detecting and remediating sensitive data in Slack. The Claude gateway applies the same detection engine to the Anthropic API path.

Where to start

If Claude Code is already in use in your organization, the fastest useful exercise is to find out what it has been sending. Point one developer's client at a gateway for a week and read the audit log. The volume of real customer data in a normal debugging session is usually the thing that settles the internal argument.

From there, see AI agent security for the controls around the agent itself, shadow AI for discovering clients nobody registered, and the best AI gateway comparison for how the wider field handles this.

🌶️ Spicy FAQs on Claude gateways

What is a Claude gateway?

A Claude gateway is a proxy that sits between your Claude clients and the Anthropic API, so every request passes through one control point before it reaches the provider. Teams put one in place for three reasons: to centralize API keys instead of scattering them across machines and repositories, to get an audit trail of what agents are actually doing, and above all to control what leaves the building. Strac's gateway does the third one by substituting sensitive values for tokens on the way out and restoring them on the way back, which is what lets a Claude agent work with real data without the provider ever receiving it.

What is Claude Apps gateway?

People use the phrase two ways. Sometimes they mean Anthropic's own surface for connecting Claude to apps and connectors. More often, when a security team says it, they mean the control point they want in front of all of that: one place that governs every Claude client in the organization, Desktop and Code and custom SDK agents alike, under a single policy. Strac is the second thing. Any client that speaks the Anthropic Messages API is covered by pointing it at the gateway, and the same data policy applies no matter which Claude surface the request came from.

Does a Claude gateway break Claude Code?

It should not, and this is the exact test to run. Claude Code's value is that it can read your repository, query a database and then act on what it found. A gateway that blocks requests containing sensitive data turns that into a broken tool, and a gateway that deletes values leaves the agent unable to write the follow-up query. Strac substitutes instead: the model reasons over tokens, and real values are restored inside tool calls before your agent executes them, so the agent behaves normally.

Will a gateway break Claude's prompt caching?

Only if the gateway is careless about it. Anthropic's prompt caching matches on a prefix of the conversation, so if your gateway emits a different placeholder for the same value on every request, the resent history changes each turn, the prefix stops matching and you pay full price on every call. Strac maps each value to a stable token, so the serialized history is byte-identical between turns and caching behaves exactly as it did before the gateway existed.

How do I connect Claude Code to a gateway?

One environment variable. Set ANTHROPIC_BASE_URL to your gateway URL and start Claude Code as usual. There are no changes to agent code, prompts, tools or MCP configuration, which matters because the people who own the agents and the people who own the risk are rarely the same team. The same variable works for Claude Desktop, the Claude Agent SDK and any other client of the Anthropic Messages API.

Can a Claude gateway run inside my own network?

Yes. Strac ships a self-hosted Docker container that runs in your VPC, on-prem, or inside your customer's infrastructure. Detection models are bundled in the image and run on your own CPUs with no calls home, the token vault is AES-256-GCM encrypted on storage you control, and the gateway's only outbound path is to the Anthropic API. Your agents can sit on a network with no other route out.

What does Anthropic actually retain if I use a gateway?

Whatever you sent it, which is the point. Anthropic's own retention and training commitments are a contractual control, not a technical one, and a security reviewer will treat them that way. A gateway converts the question from a policy promise into an architectural fact: if the values were tokenized before the request left your boundary, the provider never held them, and your audit log proves which values were substituted on every single request.

Customer story

“Don’t just alert on problems, fix them.”

Scott Roberts, Chief Information Security Officer, UiPath

  • UiPath
  • Crypto.com
  • Inmar Intelligence
  • thredUP
  • Paymentology
  • Qventus
  • Genesis Molecular AI
  • MeridianLink
More customer stories →
What is a Claude gateway?
What is Claude Apps gateway?
Does a Claude gateway break Claude Code?
Will a gateway break Claude's prompt caching?
How do I connect Claude Code to a gateway?
Discover & Protect Data on SaaS, AI, MCP, Endpoints & Cloud
Strac provides end-to-end data loss prevention for all SaaS and Cloud apps. Integrate in under 10 minutes and experience the benefits of live DLP scanning, live redaction, and a fortified SaaS environment.

Customers include

  • UiPath
  • Crypto.com
  • Inmar Intelligence
  • thredUP
  • Paymentology
  • Qventus
  • Genesis Molecular AI
  • MeridianLink
Trusted by enterprises
Data Security + Compliance Automation

Latest articles

Browse all

Get Your Datasheet

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Close Icon