Skip to content

Commit d92b3b5

Browse files
authored
refactor: unify OpenAI provider identity
Refactor OpenAI provider identity so OpenAI remains the canonical provider for API-key and OAuth-backed flows while legacy openai-codex state is doctor/migration-only. Keeps OpenAI Codex Responses as an API/transport class rather than a provider identity, moves auth aliases through providerAuthAliases, updates doctor repair sequencing for old auth/profile state, and refreshes tests/docs around the canonical OpenAI behavior.
1 parent 4d0668a commit d92b3b5

201 files changed

Lines changed: 3955 additions & 2583 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/channels/discord.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ To restrict who can click a button, set `allowedUsers` on that button (Discord u
354354

355355
Component callbacks expire after 30 minutes by default. Set `channels.discord.agentComponents.ttlMs` to change that callback registry lifetime for the default Discord account, or `channels.discord.accounts.<accountId>.agentComponents.ttlMs` to override one account in a multi-account setup. The value is milliseconds, must be a positive integer, and is capped at `86400000` (24 hours). Longer TTLs are useful for review or approval workflows that need buttons to remain usable, but they also extend the window where an old Discord message can still trigger an action. Prefer the shortest TTL that fits the workflow, and keep the default when stale callbacks would be surprising.
356356

357-
The `/model` and `/models` slash commands open an interactive model picker with provider, model, and compatible runtime dropdowns plus a Submit step. `/models add` is deprecated and now returns a deprecation message instead of registering models from chat. The picker reply is ephemeral and only the invoking user can use it. Discord select menus are limited to 25 options, so add `provider/*` entries to `agents.defaults.models` when you want the picker to show dynamically discovered models only for selected providers such as `openai-codex` or `vllm`.
357+
The `/model` and `/models` slash commands open an interactive model picker with provider, model, and compatible runtime dropdowns plus a Submit step. `/models add` is deprecated and now returns a deprecation message instead of registering models from chat. The picker reply is ephemeral and only the invoking user can use it. Discord select menus are limited to 25 options, so add `provider/*` entries to `agents.defaults.models` when you want the picker to show dynamically discovered models only for selected providers such as `openai` or `vllm`.
358358

359359
File attachments:
360360

@@ -1197,7 +1197,7 @@ Auto-join example:
11971197
discord: {
11981198
voice: {
11991199
enabled: true,
1200-
model: "openai-codex/gpt-5.5",
1200+
model: "openai/gpt-5.5",
12011201
autoJoin: [
12021202
{
12031203
guildId: "123456789012345678",
@@ -1234,7 +1234,7 @@ Notes:
12341234
- `voice.followUsers` lets the bot join, move, and leave Discord voice with selected users. See [Follow users in voice](#follow-users-in-voice) for behavior rules and examples.
12351235
- `agent-proxy` routes speech through `discord-voice`, which preserves normal owner/tool authorization for the speaker and target session but hides the agent `tts` tool because Discord voice owns playback. By default, `agent-proxy` gives the consult full owner-equivalent tool access for owner speakers (`voice.realtime.toolPolicy: "owner"`) and strongly prefers consulting the OpenClaw agent before substantive answers (`voice.realtime.consultPolicy: "always"`). In that default `always` mode, the realtime layer does not auto-speak filler before the consult answer; it captures and transcribes speech, then speaks the routed OpenClaw answer. If multiple forced consult answers finish while Discord is still playing the first answer, later exact-speech answers are queued until playback idles instead of replacing speech mid-sentence.
12361236
- In `stt-tts` mode, STT uses `tools.media.audio`; `voice.model` does not affect transcription.
1237-
- In realtime modes, `voice.realtime.provider`, `voice.realtime.model`, and `voice.realtime.speakerVoice` configure the realtime audio session. For OpenAI Realtime 2 plus the Codex brain, use `voice.realtime.model: "gpt-realtime-2"` and `voice.model: "openai-codex/gpt-5.5"`.
1237+
- In realtime modes, `voice.realtime.provider`, `voice.realtime.model`, and `voice.realtime.speakerVoice` configure the realtime audio session. For OpenAI Realtime 2 plus the Codex brain, use `voice.realtime.model: "gpt-realtime-2"` and `voice.model: "openai/gpt-5.5"`.
12381238
- Realtime voice modes include small `IDENTITY.md`, `USER.md`, and `SOUL.md` profile files in the realtime provider instructions by default so fast direct turns keep the same identity, user grounding, and persona as the routed OpenClaw agent. Set `voice.realtime.bootstrapContextFiles` to a subset to customize this, or `[]` to disable it. The supported realtime bootstrap files are limited to those profile files; `AGENTS.md` stays in the normal agent context. The injected profile context does not replace `openclaw_agent_consult` for workspace work, current facts, memory lookup, or tool-backed actions.
12391239
- In OpenAI `agent-proxy` realtime mode, set `voice.realtime.requireWakeName: true` to keep Discord realtime voice silent until a transcript starts or ends with a wake name. Configured wake names must be one or two words. If `voice.realtime.wakeNames` is unset, OpenClaw uses the routed agent `name` plus `OpenClaw`, falling back to the agent id plus `OpenClaw`. Wake-name gating disables realtime provider auto-response, routes accepted turns through the OpenClaw agent consult path, and gives a short spoken acknowledgement when a leading wake name is recognized from partial transcription before the final transcript arrives.
12401240
- The OpenAI realtime provider accepts current Realtime 2 event names and legacy Codex-compatible aliases for output audio and transcript events, so compatible provider snapshots can drift without dropping assistant audio.
@@ -1325,7 +1325,7 @@ Default agent-proxy voice-channel session example:
13251325
discord: {
13261326
voice: {
13271327
enabled: true,
1328-
model: "openai-codex/gpt-5.5",
1328+
model: "openai/gpt-5.5",
13291329
followUsersEnabled: true,
13301330
followUsers: ["123456789012345678"],
13311331
realtime: {
@@ -1375,7 +1375,7 @@ Realtime bidi example:
13751375
voice: {
13761376
enabled: true,
13771377
mode: "bidi",
1378-
model: "openai-codex/gpt-5.5",
1378+
model: "openai/gpt-5.5",
13791379
realtime: {
13801380
provider: "openai",
13811381
model: "gpt-realtime-2",
@@ -1398,7 +1398,7 @@ Voice as an extension of an existing Discord channel session:
13981398
voice: {
13991399
enabled: true,
14001400
mode: "agent-proxy",
1401-
model: "openai-codex/gpt-5.5",
1401+
model: "openai/gpt-5.5",
14021402
agentSession: {
14031403
mode: "target",
14041404
target: "channel:123456789012345678",
@@ -1433,7 +1433,7 @@ Echo-heavy OpenAI Realtime example:
14331433
voice: {
14341434
enabled: true,
14351435
mode: "bidi",
1436-
model: "openai-codex/gpt-5.5",
1436+
model: "openai/gpt-5.5",
14371437
realtime: {
14381438
provider: "openai",
14391439
model: "gpt-realtime-2",

docs/cli/doctor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Notes:
203203
- Doctor reports cron jobs with explicit `payload.model` overrides, including provider namespace counts and mismatches against `agents.defaults.model`, so scheduled jobs that do not inherit the default model are visible during auth or billing investigations.
204204
- On Linux, doctor warns when the user's crontab still runs legacy `~/.openclaw/bin/ensure-whatsapp.sh`; that script is no longer maintained and can log false WhatsApp gateway outages when cron lacks the systemd user-bus environment.
205205
- When WhatsApp is enabled, doctor checks for a degraded Gateway event loop with local `openclaw-tui` clients still running. `doctor --fix` stops only verified local TUI clients so WhatsApp replies are not queued behind stale TUI refresh loops.
206-
- Doctor rewrites legacy `openai-codex/*` model refs to canonical `openai/*` refs across primary models, fallbacks, heartbeat/subagent/compaction overrides, hooks, channel model overrides, and stale session route pins. `--fix` moves Codex intent onto provider/model-scoped `agentRuntime.id: "codex"` entries, preserves session auth-profile pins such as `openai-codex:...`, removes stale whole-agent/session runtime pins, and keeps repaired OpenAI agent refs on Codex auth routing instead of direct OpenAI API-key auth.
206+
- Doctor rewrites legacy `openai-codex/*` model refs to canonical `openai/*` refs across primary models, fallbacks, image/video generation models, heartbeat/subagent/compaction overrides, hooks, channel model overrides, and stale session route pins. `--fix` also migrates legacy `openai-codex:*` auth profiles and `auth.order.openai-codex` entries to `openai:*`, moves Codex intent onto provider/model-scoped `agentRuntime.id: "codex"` entries, removes stale whole-agent/session runtime pins, and keeps repaired OpenAI agent refs on Codex auth routing instead of direct OpenAI API-key auth.
207207
- Doctor cleans legacy plugin dependency staging state created by older OpenClaw versions and relinks the host `openclaw` package for managed npm plugins that declare it as a peer dependency. It also repairs missing downloadable plugins that are referenced by config, such as `plugins.entries`, configured channels, configured provider/search settings, or configured agent runtimes. During package updates, doctor skips package-manager plugin repair until the package swap is complete; rerun `openclaw doctor --fix` afterward if a configured plugin still needs recovery. If the download fails, doctor reports the install error and preserves the configured plugin entry for the next repair attempt.
208208
- Doctor repairs stale plugin config by removing missing plugin ids from `plugins.allow`/`plugins.deny`/`plugins.entries`, plus matching dangling channel config, heartbeat targets, and channel model overrides when plugin discovery is healthy.
209209
- Doctor quarantines invalid plugin config by disabling the affected `plugins.entries.<id>` entry and removing its invalid `config` payload. Gateway startup already skips only that bad plugin so other plugins and channels can keep running.

docs/cli/infer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ This table maps common inference tasks to the corresponding infer command.
129129
- Use `model run --thinking <level>` to pass a one-shot thinking/reasoning level (`off`, `minimal`, `low`, `medium`, `high`, `adaptive`, `xhigh`, or `max`) while keeping the run raw.
130130
- For `image describe`, `audio transcribe`, and `video describe`, `--model` must use the form `<provider/model>`.
131131
- For `image describe`, `--file` accepts local paths and HTTP(S) image URLs. Remote URLs use the normal media-fetch SSRF policy.
132-
- For `image describe`, an explicit `--model` runs that provider/model directly. The model must be image-capable in the model catalog or provider config. `codex/<model>` runs a bounded Codex app-server image-understanding turn; `openai-codex/<model>` uses the OpenAI Codex OAuth provider path.
132+
- For `image describe`, an explicit `--model` runs that provider/model directly. The model must be image-capable in the model catalog or provider config. `codex/<model>` runs a bounded Codex app-server image-understanding turn; `openai/<model>` uses the OpenAI provider path with either API-key or ChatGPT/Codex OAuth auth.
133133
- Stateless execution commands default to local.
134134
- Gateway-managed state commands default to gateway.
135135
- The normal local path does not require the gateway to be running.
@@ -172,7 +172,7 @@ Notes:
172172
- Local `model run` is the narrowest CLI smoke for provider/model/auth health because, for non-Codex providers, it sends only the supplied prompt to the selected model.
173173
- Local `model run --model <provider/model>` can use exact bundled static catalog rows from `models list --all` before that provider is written to config. Provider auth is still required; missing credentials fail as auth errors, not `Unknown model`.
174174
- For Mistral Medium 3.5 reasoning probes, leave temperature unset/default. Mistral rejects `reasoning_effort="high"` plus `temperature: 0`; use `mistral/mistral-medium-3-5` with default temperature or a non-zero reasoning-mode value such as `0.7`.
175-
- `openai-codex/*` local probes are the narrow exception: OpenClaw adds a minimal system instruction so the Codex Responses transport can populate its required `instructions` field, without adding full agent context, tools, memory, or session transcript.
175+
- Codex Responses local probes are the narrow exception: OpenClaw adds a minimal system instruction so the transport can populate its required `instructions` field, without adding full agent context, tools, memory, or session transcript.
176176
- Local `model run --file` keeps that lean path and attaches image content directly to the single user message. Common image files such as PNG, JPEG, and WebP work when their MIME type is detected as `image/*`; unsupported or unrecognized files fail before the provider is called.
177177
- `model run --file` is best when you want to test the selected multimodal text model directly. Use `infer image describe` when you want OpenClaw's image-understanding provider selection and default image-model routing.
178178
- The selected model must support image input; text-only models may reject the request at the provider layer.

docs/cli/models.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ openclaw models scan
2828
`openclaw models status` shows the resolved default/fallbacks plus an auth overview.
2929
When provider usage snapshots are available, the OAuth/API-key status section includes
3030
provider usage windows and quota snapshots.
31-
Current usage-window providers: Anthropic, GitHub Copilot, Gemini CLI, OpenAI
32-
Codex, MiniMax, Xiaomi, and z.ai. Usage auth comes from provider-specific hooks
31+
Current usage-window providers: Anthropic, GitHub Copilot, Gemini CLI, OpenAI,
32+
MiniMax, Xiaomi, and z.ai. Usage auth comes from provider-specific hooks
3333
when available; otherwise OpenClaw falls back to matching OAuth/API-key
3434
credentials from auth profiles, env, or config.
3535
In `--json` output, `auth.providers` is the env/config/store-aware provider
@@ -40,10 +40,10 @@ Use `--agent <id>` to inspect a configured agent's model/auth state. When omitte
4040
the command uses `OPENCLAW_AGENT_DIR` if set, otherwise the
4141
configured default agent.
4242
Probe rows can come from auth profiles, env credentials, or `models.json`.
43-
For Codex OAuth troubleshooting, `openclaw models status`,
44-
`openclaw models auth list --provider openai-codex`, and
43+
For OpenAI ChatGPT/Codex OAuth troubleshooting, `openclaw models status`,
44+
`openclaw models auth list --provider openai`, and
4545
`openclaw config get agents.defaults.model --json` are the quickest way to
46-
confirm whether an agent has a usable `openai-codex` auth profile for
46+
confirm whether an agent has a usable `openai` OAuth profile for
4747
`openai/*` through the native Codex runtime. See [OpenAI provider setup](/providers/openai#check-and-recover-codex-oauth-routing).
4848

4949
Notes:
@@ -76,7 +76,7 @@ Notes:
7676
cap differs from the native context window; JSON rows include `contextTokens`
7777
when a provider exposes that cap.
7878
- `models list --provider <id>` filters by provider id, such as `moonshot` or
79-
`openai-codex`. It does not accept display labels from interactive provider
79+
`openai`. It does not accept display labels from interactive provider
8080
pickers, such as `Moonshot AI`.
8181
- Model refs are parsed by splitting on the **first** `/`. If the model ID includes `/` (OpenRouter-style), include the provider prefix (example: `openrouter/moonshotai/kimi-k2`).
8282
- If you omit the provider, OpenClaw resolves the input as an alias first, then
@@ -181,7 +181,7 @@ provider you choose.
181181

182182
`models auth list` lists saved auth profiles for the selected agent without
183183
printing token, API-key, or OAuth secret material. Use `--provider <id>` to
184-
filter to one provider, such as `openai-codex`, and `--json` for scripting.
184+
filter to one provider, such as `openai`, and `--json` for scripting.
185185

186186
`models auth login` runs a provider plugin's auth flow (OAuth/API key). Use
187187
`openclaw plugins list` to see which providers are installed.
@@ -192,15 +192,15 @@ specific configured agent store. The parent `--agent` flag is honored by
192192

193193
For OpenAI models, `--provider openai` defaults to ChatGPT/Codex account login.
194194
Use `--method api-key` only when you want to add an OpenAI API-key profile,
195-
usually as a backup for Codex subscription limits. The legacy
196-
`--provider openai-codex` spelling still works for existing scripts.
195+
usually as a backup for Codex subscription limits. Run `openclaw doctor --fix`
196+
to migrate older `openai-codex` auth/profile state to `openai`.
197197

198198
Examples:
199199

200200
```bash
201201
openclaw models auth login --provider openai --set-default
202202
openclaw models auth login --provider openai --method api-key
203-
openclaw models auth paste-api-key --provider openai-codex
203+
openclaw models auth paste-api-key --provider openai
204204
openclaw models auth list --provider openai
205205
```
206206

@@ -212,7 +212,7 @@ Notes:
212212
- `paste-api-key` accepts API keys generated elsewhere, prompts for the key
213213
value, and writes it to the default profile id `<provider>:manual` unless you
214214
pass `--profile-id`. In automation, pipe the key on stdin, for example
215-
`printf "%s\n" "$OPENAI_API_KEY" | openclaw models auth paste-api-key --provider openai-codex`.
215+
`printf "%s\n" "$OPENAI_API_KEY" | openclaw models auth paste-api-key --provider openai`.
216216
- `setup-token` and `paste-token` remain generic token commands for providers
217217
that expose token auth methods.
218218
- `setup-token` requires an interactive TTY and runs the provider's token-auth
@@ -226,7 +226,7 @@ Notes:
226226
provider credentials do not appear in shell history or process lists.
227227
- `paste-token --expires-in <duration>` stores an absolute token expiry from a
228228
relative duration such as `365d` or `12h`.
229-
- For `openai-codex`, OpenAI API keys and ChatGPT/OAuth token material are
229+
- For `openai`, OpenAI API keys and ChatGPT/OAuth token material are
230230
different auth shapes. Use `paste-api-key` for `sk-...` OpenAI API keys and
231231
`paste-token` only for token auth material.
232232
- Anthropic note: Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so OpenClaw treats Claude CLI reuse and `claude -p` usage as sanctioned for this integration unless Anthropic publishes a new policy.

0 commit comments

Comments
 (0)