Use
Model keys
Agents run with an API key, and Claude Code can also sign in with your Claude subscription, with no key stored. Signing in with a ChatGPT or Grok subscription is not supported yet. The key stays on your machine, in the sandbox runtime's credential store. Inside the sandbox the agent holds a placeholder, and the real key is added only on requests to that model's own API.
Store a key
fenzi key set claudePaste the key at the prompt. It is not shown, and it does not land in your shell history. In a script, pipe it in instead; Fenzi reads one line from standard input.
printf '%s\n' "$ANTHROPIC_API_KEY" | fenzi key set claudeThe key is handed to the runtime in the environment of that one command, never as an argument, so it does not show up in the process list.
Which key each agent needs
| Agent | Key | Bound to |
|---|---|---|
| Claude Code | ANTHROPIC_API_KEY | api.anthropic.com |
| Codex | OPENAI_API_KEY | api.openai.com |
| OpenCode | ANTHROPIC_API_KEY | api.anthropic.com |
| Grok | XAI_API_KEY | api.x.ai |
fenzi key list■ Model keys on this machine
✓ Claude Code ANTHROPIC_API_KEY stored
- Codex no key. fenzi key set codex
- Grok no key. fenzi key set grok
- OpenCode no key. fenzi key set opencodelist never prints a key.
What the agent sees
The agent's environment has ANTHROPIC_API_KEY, set to a placeholder. When the agent calls the model, the request goes through the sandbox's proxy, which replaces the placeholder with the real key. It does that only for requests that already match the policy, to the endpoints bound to that key. Requests anywhere else do not get the key.
So a prompt that convinces the agent to print its environment, or to send its key to another host, gets nothing worth having.
The key and its endpoint stay together
Each agent's key comes with a profile: the endpoints it may be sent to and the programs allowed to send it. Fenzi ships a reviewed copy of that profile for each agent, with the real program paths and without telemetry hosts. The model API is not in your policy file for the same reason. If it were, a policy edit could send the key somewhere new.
Rotate a key
Run fenzi key set again. It replaces the stored key. New sandboxes use the new one. Restart a running agent to be sure it does.
Remove a key
fenzi key remove claudeRemove refuses while a sandbox that was started for that agent is still running, and names it: fenzi-web-4f2a is running with the Claude Code key; stop it first (fenzi stop fenzi-web-4f2a). A sandbox running another agent does not block it. The key stays stored until the sandbox is stopped.
Subscription logins
Claude Code can sign in with your Claude subscription inside the sandbox. With no key stored, fenzi run starts Claude Code without one, and Claude asks you to sign in: choose your Claude subscription and paste back the code your browser shows. With a key stored, fenzi run --sign-in claude starts Claude Code without it and Claude asks you to sign in; the key stays stored for your other runs. Without --sign-in, Claude first asks whether to use the key it found: choose No, then run /login. The sandbox allows the sign-in on platform.claude.com, for Claude Code's program only.
key none stored; Claude Code signs in inside the sandbox
note Claude asks you to sign in. Choose your Claude subscription and paste back the code your browser shows. To use a key instead, run fenzi key set claude, then fenzi run without --sign-in.A sandbox started without a key has no key for the runtime to add. Its policy opens api.anthropic.com to Claude Code's program, with the same rule a stored key would bring, and the policy check covers that rule before the sandbox is created. Changes you load later with fenzi policy apply or fenzi sync keep it.
One thing differs from a key. The sign-in token is kept in Claude Code's own files inside the sandbox, where the agent can read it. An API key never is: the runtime holds it outside and the agent sees a placeholder.
Signing in with a ChatGPT or Grok account is not supported yet. Neither sign-in has been tried in the sandbox.
On Team
Keys never reach our cloud. The console does not ask for them, store them, or see them. Each developer stores their own key with fenzi key set, the same as on Free. The same goes for Git tokens: we do not hold them in our cloud. The key does leave the machine on the agent's calls to its model vendor, which is what it is for. What our cloud does receive is in What our cloud receives.