WheelmachineDocs
Open app

Your own AI keys

Add your key from a model's provider once, under the name agents read it by, and every agent in every one of your machines works with it: no sign-in screen, no paste box. The key itself never enters a machine.

wm

$ wm secrets set ANTHROPIC_API_KEY
Value of ANTHROPIC_API_KEY (not shown as you type):
Set ANTHROPIC_API_KEY, an AI key: on every machine. Sent only to api.anthropic.com. The key never enters a machine.

In the dashboard, the Secrets page has an AI keys part first: a row for each provider, with Add, Replace and Remove. To choose the model each agent starts on, from your keys' own lists, see Choosing models.

How it works#

A machine holds a placeholder in the key's place, under the key's name: in the environment of its commands, its terminals, its SSH sessions and its agents. When a program in the machine calls the provider's API over HTTPS, the real key is added to the request on its way out - for the provider's own hosts alone. The program works as it would with the key itself; the machine never has it.

The names#

A secret set under one of these names is an AI key. The names are the ones agents and the providers' own libraries read.

ProviderNameSent only to
AnthropicANTHROPIC_API_KEYapi.anthropic.com
OpenAIOPENAI_API_KEYapi.openai.com, us.api.openai.com, eu.api.openai.com
GeminiGEMINI_API_KEY, GOOGLE_API_KEYgenerativelanguage.googleapis.com
OpenRouterOPENROUTER_API_KEYopenrouter.ai
DeepSeekDEEPSEEK_API_KEYapi.deepseek.com
xAIXAI_API_KEYapi.x.ai, us.api.x.ai
Mistral AIMISTRAL_API_KEYapi.mistral.ai
GroqGROQ_API_KEYapi.groq.com
Together AITOGETHER_API_KEYapi.together.ai, api.together.xyz
Fireworks AIFIREWORKS_API_KEYapi.fireworks.ai
PerplexityPERPLEXITY_API_KEYapi.perplexity.ai
CohereCOHERE_API_KEY, CO_API_KEYapi.cohere.com, api.cohere.ai
Alibaba Cloud Model StudioDASHSCOPE_API_KEYdashscope-intl.aliyuncs.com, dashscope.aliyuncs.com, dashscope-us.aliyuncs.com
Moonshot AIMOONSHOT_API_KEYapi.moonshot.ai, api.moonshot.cn
Z.aiZAI_API_KEYapi.z.ai, open.bigmodel.cn
MiniMaxMINIMAX_API_KEYapi.minimax.io, api.minimaxi.com
Hugging FaceHF_TOKENrouter.huggingface.co, huggingface.co
CerebrasCEREBRAS_API_KEYapi.cerebras.ai
DeepInfraDEEPINFRA_API_KEYapi.deepinfra.com
NVIDIANVIDIA_API_KEYintegrate.api.nvidia.com

GET /v1/secrets/presets (client.secrets.presets()) lists them, with the headers each key goes in. A secret under any other name is an ordinary one, given to machines by name (see Environment).

Which agents use them#

Each agent uses a key you have added. When there are several, each takes the first it works with, in this order: Anthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Mistral AI, Groq, then the rest.

AgentWorks with
CodexOpenAI, OpenRouter
Gemini CLIGemini
Qwen CodeAnthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Alibaba Cloud Model Studio
AiderAnthropic, OpenAI, Gemini, OpenRouter, DeepSeek
GooseAnthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, Mistral AI, Groq
Hermes AgentAnthropic, OpenAI, Gemini, OpenRouter, DeepSeek, xAI, and more
OpenClawAnthropic, OpenAI, Gemini, OpenRouter, xAI

Any program you run in a machine finds the keys under their names too: a provider's own library, a script, an agent you install yourself. An agent that was already running when a key was added or changed takes it when it is started again: the dashboard says so beside it, with Restart, and wm apps ls shows it as on, restart to use new keys.

What never happens to the key#

On every machine, as its internet lets it#

An AI key is on every machine of your account: the ones made before it was added, and every one made after.

A machine's ai_keys (wm machines get, and its Secrets part in the dashboard) says which keys reach it.

Keep a key inside, or on some machines only#

A few tools cannot work with a placeholder: one that signs each request itself, or one that does not speak HTTPS to the provider. For such a tool keep the key an ordinary secret, with --inside: its value is then in the environment of the machines you give it to, as any secret's is. To keep an AI key on some machines only, set it with --only-given and give it to each of them by name.

wm

$ wm secrets set --only-given OPENAI_API_KEY
$ wm machines secrets box OPENAI_API_KEY
$ wm secrets set --inside GEMINI_API_KEY

Setting a key again resets these choices: without the flags, it goes back to the default.

Which keys work this way#

An API key made in the provider's own console works. A sign-in token that renews itself, or a credential a program signs each request with (as some cloud accounts' are), does not work: keep such a one inside.

In the API#

PUT /v1/secrets/{name} takes outside: true adds the key on the way out (the default for an AI key's name); false makes it an ordinary secret; or give your own hosts, header and format for a key of any other service. every_machine is true by default for an AI key. See Set a secret and The AI keys the API knows.