TINY(1)General Commands ManualTINY(1)

Keeping the model key out of pods

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.

The gateway

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:

  • It forwards /v1/ only. Anything else sent to it is refused, not relayed with your credential.
  • Rotation needs no restart. The gateway re-reads the credential on every request. tiny setup writes a new token straight into the gateway's Secret while the gateway is on.
  • The old names are blanked. The agent container's environment sets every Claude credential name to the placeholder or to empty. A key still sitting in tiny-agent-env can't reach the agent, because a pod's own env beats envFrom.
  • Running sessions keep the old environment until their pod is replaced: tiny pause --all && tiny resume --all.

tiny gateway off moves the credential back. Bare tiny gateway says whether it's on.

More accounts, for when one hits its limit

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.

  • One kind per greenhouse. Every account must be the same kind as the main one: all subscription tokens or all API keys. Claude Code shapes its requests for one or the other.
  • Accounts live beside the main credential in 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.
  • The app does the same from the greenhouse's settings: Assistants, Claude, Accounts. Add one by pasting a token or by signing in through the browser.
  • Respect each account's terms: this is for accounts you hold, such as a personal and a work subscription, not for pooling other people's.

Gemini's key

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.

Federation

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.

  1. 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.

  2. In the Claude Console, go to Settings, then Workload identity, then Connect workload.

    • If the cluster's issuer is reachable from the internet (most managed clusters), choose Kubernetes and register it.
    • If it isn't, like most self-hosted ones, choose Custom OIDC instead: the Kubernetes tile only takes public issuers. Enter the issuer URL, paste the keys 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.

  3. 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.

What changes, and what doesn't

  • Leaking the key is closed or bounded. Behind the gateway there is no key in the pod to leak. With federation, a stolen identity token works for at most an hour and an access token for minutes, instead of a token that lasts a year.
  • Spending your quota is not. A compromised session can still make model calls while it runs: through the gateway, or with its own short-lived token. Keep the allow-list on, watch usage, and pause a session that misbehaves.
  • The gateway's credential still exists. It's in the proxy's Secret, which no session can read. Someone with Secret access in the namespace can, as before.
  • Claude Code makes one call around the gateway. At startup it fetches some account details directly from Anthropic. With the placeholder that call fails and Claude Code carries on; we haven't seen it change anything a session does.

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.