#Switch from OpenAI OAuth to API Key
12 messages · Page 1 of 1 (latest)
Let me check the current docs and auth behavior so I don't guess.
Yep, usually one of these is still happening:
-
The session is still pinned to the old provider/profile
Existing threads keep their session choice, so after changing auth, do/newor/resetin that thread. -
The model is still
openai-codex/...instead ofopenai/...
OpenAI API key auth uses theopenaiprovider, while ChatGPT OAuth usesopenai-codex.
Check with:openclaw --version openclaw models status openclaw models status --probeIf the primary model still shows
openai-codex/..., switch it:
openclaw models set openai/gpt-5.4
-
You have multiple agents
Auth is per-agent, so check the actual one in use:openclaw agents list openclaw models status --agent <id>
So, configure adds the API key, but it does not automatically evict old OAuth usage from already-running sessions.
Docs:
If you paste openclaw --version + openclaw models status, I can tell you exactly which of the above is happening.
ok, I was still using openai-codex/. I have multiple agents, how can I apply the same change for every one of them?
Yep. Two separate things matter here:
- Auth is per-agent
- Model defaults can be global or per-agent
The easiest way to make the same OpenAI API key available to all agents is to put it on the gateway host as a global env key:
cat >> ~/.openclaw/.env <<'EOF'
OPENAI_API_KEY=...
EOF
openclaw gateway restart
That part is global, so every agent can use it. Docs: https://docs.openclaw.ai/gateway/authentication
Then switch models away from Codex OAuth:
openclaw models set openai/gpt-5.4
That updates agents.defaults.model.primary only.
If some agents still have their own override in agents.list[].model, they will keep using that. Check with:
openclaw agents list
openclaw config get agents.list --json
Then update the per-agent overrides you find, for example:
openclaw config set agents.list[0].model "openai/gpt-5.4"
openclaw config set agents.list[1].model "openai/gpt-5.4"
And for already-active chats/threads, do /new or /reset so they pick up the new provider/model.
Important bit: OpenClaw does not automatically share one agent’s stored auth profiles with the others. If you want stored per-agent creds instead of the global env key, you’d need to configure each agent separately. Multi-agent docs: https://docs.openclaw.ai/concepts/multi-agent
If you want, paste openclaw config get agents.list --json and I can tell you exactly which entries need changing.