Proxy tokens
Handle proxy tokens safely, rotate them with an overlap, revoke them, and know what a leaked URL allows.
Treat the URL as a secret
The proxy token is part of the base URL. Anyone with the URL can send requests through your app's proxy.
- Keep the URL in an environment variable or a secrets manager. Do not commit it.
- Tools can print or record base URLs: shell history, process lists, CI logs, crash reports. Check where your tool writes it.
- The proxy logs a short hash of the token's key id, never the token or the request path.
If a tool can set a request header, you can send the token in
x-tawa-proxy-token and use https://proxy.tawaguard.com/openai/v1 or
https://proxy.tawaguard.com/anthropic as the base URL. The header wins if
both are present, and the proxy removes it before the request goes to the
provider. This keeps the token out of the URL.
Rotate with an overlap
In API keys, Proxy tokens, choose Rotate on a token. A new token with the same settings is created, and the old one keeps working for the overlap period, then expires.
| Overlap | Note |
|---|---|
| 1 hour | |
| 24 hours | Default |
| 3 days | |
| 7 days |
Update your clients to the new URL during the overlap. If the old token already expires sooner than the overlap, its expiry is left as it is.
An app holds up to 3 active proxy tokens per environment. Rotation is allowed at that limit, so the app briefly has one more until the old token expires.
Revoke
Revoke disables a token. It stays in the list as revoked and is not deleted.
The proxy re-checks each token with Tawa Guard every 20 seconds, so a revoke or an expiry takes effect within about that time. If Tawa Guard cannot be reached, the proxy can keep using its last answer for a token for up to 10 minutes.
A token the proxy has rejected stays rejected for 60 seconds.
What a leaked URL allows
| Can do | Cannot do |
|---|---|
| Send requests through the proxy as your app, using their own provider key. Those requests are scanned and count against your plan. | Read your jobs, run analytics or manage your account. A proxy token is not accepted by those APIs. |
| Submit scans to the gateway as your app, which also count against your plan. | Use your provider key. The proxy only sees it when a client sends it with a request. |
| Run with your app's Mode, Fallback and stages. | Reach a provider that is not on your app's allowed providers. A request can only name an entry on the list. |
Revoke a leaked token and create a new one. Repeated requests with a revoked token count toward the per-source limit of 30 invalid attempts per minute.
Provider keys
The proxy forwards the provider credential headers (Authorization,
x-api-key, api-key, openai-organization, openai-project) with each
request. They are not stored or logged. Headers that start with x-tawa- or
x-forwarded-, x-real-ip and Forwarded are removed before the request
goes to the provider.
Scanning and blocking
Choose whether the proxy only watches or also blocks, what happens when a scan cannot finish, and which parts of a request and response are scanned.
Overview
Set the provider base URL for Claude Code, Codex, the OpenAI and Anthropic SDKs, or any tool that accepts a custom base URL, and scan its traffic.