Give the harness an API key
Keep your Anthropic API key in the OS keychain and make Claude Code use it in every run, without the agent seeing it. You end with a default target whose credential is the key. A target names the harness a run uses and how it logs in.
Without a credential, Claude Code uses its own login, or the ANTHROPIC_API_KEY in your shell, which the agent and the tools it runs can read too. With a target credential, the harness gets a placeholder, and Pandra's proxy puts the key in its place only in requests to the provider's API.
Store the key
Register a logical secret, a name for where the key lives. Pandra asks for the key and hides what you type:
pandra config secret set anthropic-api-key --keychainOn Linux, the keychain needs GNOME Keyring or KWallet. To read the key from 1Password, a file, or a command instead, use another source flag, such as --1password or --file; secret stores lists them.
Make a target that logs in with it
Create the target claude-api, which logs in to Claude Code with an API key from the secret, and make it the default target, which every agent uses unless its own settings name another:
pandra config target set claude-api --harness claude-code \
--login api-key --secret anthropic-api-key
pandra config target use claude-apipandra config target set prints the variable that the harness reads the key from:
wrote env.ANTHROPIC_API_KEY = { secret = "anthropic-api-key" } to targets.claude-api (anthropic api-key)Codex and Pi take other login methods and variables: see the login sections of Codex and Pi.
Check a run
In an agent project, --dry-run shows the plan of a run without starting it. Its Credentials section shows where the key comes from (shortened here):
pandra run . --dry-runRun plan for . (nothing was started)
...
Harness claude-code target claude-api
Backend host
Target claude-api defaults
...
Credentials
ANTHROPIC_API_KEY secret anthropic-api-key (keychain), through Pandra's proxy
...