By default a session's Claude credential, a claude setup-token or an
API key, sits in tiny-agent-env, and every agent pod reads it. A
prompt-injected agent can read it too, and send it anywhere the network
allows. tiny has two ways to take it out of the pod, one for each way of
paying.
| the gateway | federation | |
|---|---|---|
| for | Pro or Max subscriptions, and API keys | API billing through the Claude Console |
| what the agent pod holds | a placeholder | a short-lived identity token |
| where the real credential is | a Secret only the egress proxy mounts | nowhere: none is stored |
| needs | the egress allow-list on | a federation rule in the Claude Console |
| turn it on | tiny gateway on |
tiny federation set … |
Both apply to Claude sessions. Codex sessions keep their credential in
tiny-agent-env as before: a ChatGPT login (~/.codex/auth.json, which
Codex refreshes in each session) or an OpenAI API key, stored by
tiny setup or by the desktop app.
tiny gateway on
The credential moves out of tiny-agent-env into tiny-model-credential,
which only the egress proxy mounts. The proxy runs a small gateway next to
its allow-list. New Claude sessions get its address as
ANTHROPIC_BASE_URL and a placeholder token of the same kind, so Claude
Code behaves exactly as it would with your subscription. The gateway
forwards model calls to api.anthropic.com and puts the real credential
on each one.
The details:
/v1/ only. Anything else sent to it is refused, not
relayed with your credential.tiny setup writes a new token straight into the
gateway's Secret while the gateway is on.tiny-agent-env can't reach the agent, because a pod's own
env beats envFrom.tiny pause --all && tiny resume --all.tiny gateway off moves the credential back. Bare tiny gateway says
whether it's on.
The gateway can hold several Claude accounts:
claude setup-token | tiny gateway account add work # signed in to the other account
tiny gateway account # main, then the others by name
tiny gateway account remove work
It uses the main account (the one tiny setup stored) until Anthropic
answers a request with 429, meaning the usage limit is reached. Then it
sends the same request again with the next account, in name order. The
agent gets a normal answer and never sees the limit, so nothing restarts.
The limited account rests until the reset time in Anthropic's answer (the
5-hour or weekly window for a subscription, Retry-After for an API
key), then it's first again. When every account is resting, the agent
gets Anthropic's own 429 from the account whose limit ends first.
tiny-model-credential,
as account.<name>.oauth or account.<name>.apikey. Replacing the main
token keeps them. tiny gateway off deletes them with the Secret.A Gemini API key goes to the gateway on its own whenever the greenhouse
runs the allow-list: there is no switch. tiny setup and the app store
it in the gateway's Secret, and a key stored earlier in tiny-agent-env
moves there the next time a Gemini session starts. The session gets a
placeholder key and GOOGLE_GEMINI_BASE_URL pointing at the gateway's
/gemini route, which forwards the Gemini API (and nothing else) to
generativelanguage.googleapis.com with the real key. A Gemini session
that prints its environment shows only the placeholder, and it needs
none of Google's sites on the allow-list. Without the allow-list the key
stays in tiny-agent-env, as before.
Anthropic's Workload Identity Federation
lets a pod sign in with the identity Kubernetes already gives it. tiny
mounts a service-account token minted for Anthropic (audience
https://api.anthropic.com, valid for an hour, rotated by the kubelet),
and Claude Code exchanges it for an access token that lasts minutes,
under a rule you create in the Claude Console. Nothing is stored. Usage
is billed to the Console organization at API prices; a subscription can't
be federated.
See what the Console needs:
tiny federation
It prints this cluster's service-account issuer, the subject
(system:serviceaccount:<namespace>:tiny-session), the audience, and
the cluster's public signing keys.
In the Claude Console, go to Settings, then Workload identity, then Connect workload.
tiny federation printed (the list
inside "keys", without the wrapper), and tick the box that says
the keys are reachable. With inline keys Anthropic never fetches
anything, and the wizard confirms "Signing keys were provided
inline."Then create a rule with the subject above (enable it in one workspace, not all) and a service account for it.
Give tiny the IDs the Console shows:
tiny federation set --rule fdrl_... --organization <org id> --service-account svac_...
Add --workspace wrkspc_... (Settings, then Workspaces) to pin the workspace.
If tiny-agent-env still holds a Claude credential, tiny offers to
delete it. Pods no longer see it either way, but federation's point is
storing none.
The token the pod gets can't be used against the Kubernetes API: the API
server rejects a token minted for another audience. With inline keys,
re-run tiny federation and update the Console when the cluster rotates
its signing keys, which is rare, usually at an upgrade.
tiny federation off switches back to the stored credential.
In the desktop app, a greenhouse's Advanced tab switches either mode: Keep the Claude key out of helpers is the gateway (it needs "Sites you allow" on), Set up federation shows what the Console asks for, read from the greenhouse (issuer, subject, audience, and Copy keys, with the Console option to pick), then takes the IDs the Console gives you. With federation on, the app offers to remove a key still stored in the greenhouse.
The greenhouse's Assistants tab has a card for each agent, and signs
each in with your own account with nothing installed on your Mac:
Sign in with Claude, Sign in with ChatGPT and Sign in with
Google each start a short-lived
pod in the greenhouse that runs the agent's own login (claude setup-token,
codex login, Gemini CLI's Google sign-in). Your browser opens the
provider's page; when you finish, the page returns to a local port the
app forwards into that pod, the pod hands the result back, and the app
stores it in the greenhouse and deletes the pod. Your password goes only to
the provider. The pod mounts nothing, gets no Kubernetes token, and sits
behind the same egress rules as a session. With "Sites you allow" on, the
login itself needs platform.claude.com (Claude), auth.openai.com
(Codex) or oauth2.googleapis.com (Gemini); the app names any that are
missing and offers to add them. For Gemini, Google sign-in works only for
Code Assist Standard and Enterprise accounts since June 2026; everyone
else pastes a Gemini API key from Google AI Studio. A login your Mac already has (Codex's or
Gemini CLI's) is offered as a shortcut, and an API key can be pasted
instead. With "Sites you allow" on, Codex also needs api.openai.com
and chatgpt.com on the list to work; the Codex card says when they're
missing.
Both modes are switched per namespace. The rest of the confinement is the same: see the threat model.