#Switch from OpenAI OAuth to API Key

12 messages · Page 1 of 1 (latest)

placid elk
#

I ran openclaw configure and provided the API key in the wizard, however my agents are still using the OAuth profiles. IS there anything else that need to be changed?

exotic epochBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

vale prismBOT
dark lagoonBOT
#

Let me check the current docs and auth behavior so I don't guess.

#

Yep, usually one of these is still happening:

  1. The session is still pinned to the old provider/profile
    Existing threads keep their session choice, so after changing auth, do /new or /reset in that thread.

  2. The model is still openai-codex/... instead of openai/...
    OpenAI API key auth uses the openai provider, while ChatGPT OAuth uses openai-codex.
    Check with:

    openclaw --version
    openclaw models status
    openclaw models status --probe
    

    If the primary model still shows openai-codex/..., switch it:

#

If you paste openclaw --version + openclaw models status, I can tell you exactly which of the above is happening.

placid elk
#

ok, I was still using openai-codex/. I have multiple agents, how can I apply the same change for every one of them?

dark lagoonBOT
#

Yep. Two separate things matter here:

  1. Auth is per-agent
  2. 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.