mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 15:25:14 +00:00
* refactor: extract agent core package Introduce packages/agent-core as the OpenClaw-owned home for reusable agent loop, harness, session, prompt, and runtime dependency contracts. * refactor: extract shared llm runtime Move provider model registries, stream wrappers, OAuth helpers, and LLM utilities into src/llm with plugin-sdk barrels instead of depending on the old embedded runtime layout. * refactor: remove pi runtime internals Rename remaining Pi-shaped agent surfaces to OpenClaw agent runtime names, delete obsolete Pi docs and package graph checks, and add the third-party notice for incorporated code. * refactor: tighten agent session runtime Make agent-core/runtime dependencies explicit, consolidate compaction and session transcript helpers, and move model/session helpers behind OpenClaw-owned contracts. * refactor: remove static model and pi auth paths Drop static model catalogs and Pi auth bridges, move model/provider facts to manifest-owned runtime contracts, and harden internal embedded-agent utilities. * refactor: remove legacy provider compat paths * docs: remove agent parity notes * fix: skip provider wildcard metadata parsing * refactor: share session extension sdk loading * refactor: inline acpx proxy error formatter * refactor: fold edit recovery into edit tool * fix: accept extension batch separator * test: align startup provider plugin expectations * fix: restore provider-scoped release discovery * test: align static asset packaging expectations * fix: run static provider catalogs during scoped discovery * fix: add provider entry catalogs for scoped live discovery * fix: load lightweight provider catalog entries * fix: refresh provider-scoped plugin metadata * fix: keep provider catalog entries on release live path * fix: keep static manifest models in release live checks * fix: harden release model discovery * fix: reduce OpenAI live cache probe reasoning * fix: disable OpenAI cache probe reasoning * ci: extend OpenAI gateway live timeout * fix: extend live gateway model budget * fix: stabilize release validation regressions * fix: honor provider aliases in model rows * fix: stabilize release validation lanes * fix: stabilize release memory qa * ci: stabilize release validation lanes * ci: prefer ipv4 for live docker node calls * fix: restore shared tool-call stream wrapper * ci: remove legacy pi test shard alias * fix: clean up embedded agent test drift * fix: stabilize runtime alias status * fix: clean up embedded agent ci drift * fix: restore release ci invariants * fix: clean up post-rebase runtime drift * fix: restore release ci checks * fix: restore release ci after rebase * fix: remove stale pi runtime path * test: align compaction runtime expectations * test: update plugin prerelease expectations * fix: handle claude live tool approvals * fix: stabilize release validation gates * fix: finish agent runtime import * test: finish post-rebase agent runtime mocks * fix: keep codex compaction native * fix: stabilize codex app-server hook tests * test: isolate codex diagnostic active run * test: remove codex diagnostic completion race # Conflicts: # extensions/codex/src/app-server/run-attempt.test.ts * ci: fix full release manifest performance run id * refactor: narrow llm plugin sdk boundary * chore: drop generated google boundary stamps * fix: repair rebase fallout * fix: clean up rebased runtime references * fix: decode codex jwt payloads as base64url * fix: preserve shipped pi runtime alias * fix: add scoped sdk virtual modules * fix: decode llm codex oauth jwt as base64url * fix: avoid stale vertex adc negative cache * fix: harden tool arg decoding and codeql path * fix: keep vertex adc negative checks live * refactor: consolidate codex jwt and edit helpers * fix: await codex oauth node runtime imports * fix: preserve sdk tool and notice contracts * fix: preserve shipped compat config boundaries * fix: align codex oauth callback host * fix: terminate agent-core loop streams on failure * fix: keep codex oauth callback alive during fallback * ci: include session tools in critical codeql scans * fix: keep Cloudflare Anthropic provider auth header * docs: redirect legacy pi runtime pages * fix: honor bundled web provider compat discovery * fix: protect session output spill files * fix: keep legacy agent dir env blocked * fix: contain auto-discovered skill symlinks * fix: harden agent core sdk proxy surfaces * fix: restore approval reaction sdk compat * fix: keep live docker runs bounded * fix: keep codex oauth redirect host aligned * fix: resolve post-rebase agent runtime drift * fix: redact anthropic oauth parse failures * fix: preserve responses strict tool shaping * fix: repair agent runtime rebase cleanup * docs: redirect retired parity pages * fix: bound auto-discovered resources to roots * fix: repair post-rebase agent test drift * fix: preserve bundled provider allowlist migration * fix: preserve manifest-owned provider aliases * fix: declare photon image dependency * fix: keep provider headers out of proxy body * fix: preserve shipped env aliases * fix: refresh control ui i18n generated state * fix: quote read fallback paths * fix: preview edits through configured backend * test: satisfy core test typecheck * fix: preserve ZAI usage auth fallback * test: repair codex diagnostic test * fix: repair agent runtime rebase drift * test: finish embedded runner import rename * fix: repair agent runtime rebase integrations * test: align compaction oauth fallback expectations * fix: allow sdk-auth session models * fix: update doctor tool schema import * fix: preserve bedrock plugin region * fix: stream harmony-like prose immediately * ci: include session runtime in codeql shards * fix: repair latest rebase integrations * fix: honor explicit codex websocket transport * fix: keep openai-compatible credentials provider-scoped * fix: refresh sdk api baseline after rebase * fix: route cli runtime aliases through openclaw harness * test: rename stale harness mock expectation * test: rename embedded agent overflow calls * test: clean embedded auth test wording * test: use openclaw stream types in deepinfra cache test * fix: refresh sdk api baseline on latest main * fix: honor bundled discovery compat allowlists * fix: refresh sdk api baseline after latest rebase * fix: remove stale rebase imports * test: rename stale model catalog mock * test: mock renamed doctor runtime modules * fix: map canonical kimi env auth * fix: use internal model registry in bench script * fix: migrate deepinfra provider catalog entry * fix: enforce builtin tool suppression * fix: route compaction auth and proxy payloads safely * refactor: prune unused llm registry leftovers * test: update codex hooks session import * test: fix model picker ci coverage * test: align model picker auth mock types
240 lines
11 KiB
Markdown
240 lines
11 KiB
Markdown
---
|
|
summary: "CLI reference for `openclaw models` (status/list/set/scan, aliases, fallbacks, auth)"
|
|
read_when:
|
|
- You want to change default models or view provider auth status
|
|
- You want to scan available models/providers and debug auth profiles
|
|
title: "Models"
|
|
---
|
|
|
|
# `openclaw models`
|
|
|
|
Model discovery, scanning, and configuration (default model, fallbacks, auth profiles).
|
|
|
|
Related:
|
|
|
|
- Providers + models: [Models](/providers/models)
|
|
- Model selection concepts + `/models` slash command: [Models concept](/concepts/models)
|
|
- Provider auth setup: [Getting started](/start/getting-started)
|
|
|
|
## Common commands
|
|
|
|
```bash
|
|
openclaw models status
|
|
openclaw models list
|
|
openclaw models set <model-or-alias>
|
|
openclaw models scan
|
|
```
|
|
|
|
`openclaw models status` shows the resolved default/fallbacks plus an auth overview.
|
|
When provider usage snapshots are available, the OAuth/API-key status section includes
|
|
provider usage windows and quota snapshots.
|
|
Current usage-window providers: Anthropic, GitHub Copilot, Gemini CLI, OpenAI
|
|
Codex, MiniMax, Xiaomi, and z.ai. Usage auth comes from provider-specific hooks
|
|
when available; otherwise OpenClaw falls back to matching OAuth/API-key
|
|
credentials from auth profiles, env, or config.
|
|
In `--json` output, `auth.providers` is the env/config/store-aware provider
|
|
overview, while `auth.oauth` is auth-store profile health only.
|
|
Add `--probe` to run live auth probes against each configured provider profile.
|
|
Probes are real requests (may consume tokens and trigger rate limits).
|
|
Use `--agent <id>` to inspect a configured agent's model/auth state. When omitted,
|
|
the command uses `OPENCLAW_AGENT_DIR` if set, otherwise the
|
|
configured default agent.
|
|
Probe rows can come from auth profiles, env credentials, or `models.json`.
|
|
For Codex OAuth troubleshooting, `openclaw models status`,
|
|
`openclaw models auth list --provider openai-codex`, and
|
|
`openclaw config get agents.defaults.model --json` are the quickest way to
|
|
confirm whether an agent has a usable `openai-codex` auth profile for
|
|
`openai/*` through the native Codex runtime. See [OpenAI provider setup](/providers/openai#check-and-recover-codex-oauth-routing).
|
|
|
|
Notes:
|
|
|
|
- `models set <model-or-alias>` accepts `provider/model` or an alias.
|
|
- `models list` is read-only: it reads config, auth profiles, existing catalog
|
|
state, and provider-owned catalog rows, but it does not rewrite
|
|
`models.json`.
|
|
- The `Auth` column is provider-level and read-only. It is computed from local
|
|
auth profile metadata, env markers, configured provider keys, local-provider
|
|
markers, AWS Bedrock env/profile markers, and plugin synthetic-auth metadata;
|
|
it does not load provider runtime, read keychain secrets, call provider
|
|
APIs, or prove exact per-model execution readiness.
|
|
- `models list --all --provider <id>` can include provider-owned static catalog
|
|
rows from plugin manifests or bundled provider catalog metadata even when you
|
|
have not authenticated with that provider yet. Those rows still show as
|
|
unavailable until matching auth is configured.
|
|
- `models list` keeps the control plane responsive while provider catalog
|
|
discovery is slow. The default and configured views fall back to configured or
|
|
synthetic model rows after a short wait and let discovery finish in the
|
|
background. Use `--all` when you need the exact full discovered catalog and
|
|
are willing to wait for provider discovery.
|
|
- Broad `models list --all` merges manifest catalog rows over registry rows
|
|
without loading provider runtime supplement hooks. Provider-filtered manifest
|
|
fast paths use only providers marked `static`; providers marked `refreshable`
|
|
stay registry/cache-backed and append manifest rows as supplements, while
|
|
providers marked `runtime` stay on registry/runtime discovery.
|
|
- `models list` keeps native model metadata and runtime caps distinct. In table
|
|
output, `Ctx` shows `contextTokens/contextWindow` when an effective runtime
|
|
cap differs from the native context window; JSON rows include `contextTokens`
|
|
when a provider exposes that cap.
|
|
- `models list --provider <id>` filters by provider id, such as `moonshot` or
|
|
`openai-codex`. It does not accept display labels from interactive provider
|
|
pickers, such as `Moonshot AI`.
|
|
- 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`).
|
|
- If you omit the provider, OpenClaw resolves the input as an alias first, then
|
|
as a unique configured-provider match for that exact model id, and only then
|
|
falls back to the configured default provider with a deprecation warning.
|
|
If that provider no longer exposes the configured default model, OpenClaw
|
|
falls back to the first configured provider/model instead of surfacing a
|
|
stale removed-provider default.
|
|
- `models status` may show `marker(<value>)` in auth output for non-secret placeholders (for example `OPENAI_API_KEY`, `secretref-managed`, `minimax-oauth`, `oauth:chutes`, `ollama-local`) instead of masking them as secrets.
|
|
|
|
### Models scan
|
|
|
|
`models scan` reads OpenRouter's public `:free` catalog and ranks candidates for
|
|
fallback use. The catalog itself is public, so metadata-only scans do not need
|
|
an OpenRouter key.
|
|
|
|
By default OpenClaw tries to probe tool and image support with live model calls.
|
|
If no OpenRouter key is configured, the command falls back to metadata-only
|
|
output and explains that `:free` models still require `OPENROUTER_API_KEY` for
|
|
probes and inference.
|
|
|
|
Options:
|
|
|
|
- `--no-probe` (metadata only; no config/secrets lookup)
|
|
- `--min-params <b>`
|
|
- `--max-age-days <days>`
|
|
- `--provider <name>`
|
|
- `--max-candidates <n>`
|
|
- `--timeout <ms>` (catalog request and per-probe timeout)
|
|
- `--concurrency <n>`
|
|
- `--yes`
|
|
- `--no-input`
|
|
- `--set-default`
|
|
- `--set-image`
|
|
- `--json`
|
|
|
|
`--set-default` and `--set-image` require live probes; metadata-only scan
|
|
results are informational and are not applied to config.
|
|
|
|
### Models status
|
|
|
|
Options:
|
|
|
|
- `--json`
|
|
- `--plain`
|
|
- `--check` (exit 1=expired/missing, 2=expiring)
|
|
- `--probe` (live probe of configured auth profiles)
|
|
- `--probe-provider <name>` (probe one provider)
|
|
- `--probe-profile <id>` (repeat or comma-separated profile ids)
|
|
- `--probe-timeout <ms>`
|
|
- `--probe-concurrency <n>`
|
|
- `--probe-max-tokens <n>`
|
|
- `--agent <id>` (configured agent id; overrides `OPENCLAW_AGENT_DIR`)
|
|
|
|
`--json` keeps stdout reserved for the JSON payload. Auth-profile, provider,
|
|
and startup diagnostics are routed to stderr so scripts can pipe stdout directly
|
|
into tools such as `jq`.
|
|
|
|
Probe status buckets:
|
|
|
|
- `ok`
|
|
- `auth`
|
|
- `rate_limit`
|
|
- `billing`
|
|
- `timeout`
|
|
- `format`
|
|
- `unknown`
|
|
- `no_model`
|
|
|
|
Probe detail/reason-code cases to expect:
|
|
|
|
- `excluded_by_auth_order`: a stored profile exists, but explicit
|
|
`auth.order.<provider>` omitted it, so probe reports the exclusion instead of
|
|
trying it.
|
|
- `missing_credential`, `invalid_expires`, `expired`, `unresolved_ref`:
|
|
profile is present but not eligible/resolvable.
|
|
- `no_model`: provider auth exists, but OpenClaw could not resolve a probeable
|
|
model candidate for that provider.
|
|
|
|
## Aliases + fallbacks
|
|
|
|
```bash
|
|
openclaw models aliases list
|
|
openclaw models fallbacks list
|
|
```
|
|
|
|
## Auth profiles
|
|
|
|
```bash
|
|
openclaw models auth add
|
|
openclaw models auth list [--provider <id>] [--json]
|
|
openclaw models auth login --provider <id>
|
|
openclaw models auth login --provider openai --profile-id openai:work
|
|
openclaw models auth paste-api-key --provider <id>
|
|
openclaw models auth setup-token --provider <id>
|
|
openclaw models auth paste-token
|
|
```
|
|
|
|
`models auth add` is the interactive auth helper. It can launch a provider auth
|
|
flow (OAuth/API key) or guide you into manual token paste, depending on the
|
|
provider you choose.
|
|
|
|
`models auth list` lists saved auth profiles for the selected agent without
|
|
printing token, API-key, or OAuth secret material. Use `--provider <id>` to
|
|
filter to one provider, such as `openai-codex`, and `--json` for scripting.
|
|
|
|
`models auth login` runs a provider plugin's auth flow (OAuth/API key). Use
|
|
`openclaw plugins list` to see which providers are installed.
|
|
Use `openclaw models auth --agent <id> <subcommand>` to write auth results to a
|
|
specific configured agent store. The parent `--agent` flag is honored by
|
|
`add`, `list`, `login`, `paste-api-key`, `setup-token`, `paste-token`, and
|
|
`login-github-copilot`.
|
|
|
|
For OpenAI models, `--provider openai` defaults to ChatGPT/Codex account login.
|
|
Use `--method api-key` only when you want to add an OpenAI API-key profile,
|
|
usually as a backup for Codex subscription limits. The legacy
|
|
`--provider openai-codex` spelling still works for existing scripts.
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
openclaw models auth login --provider openai --set-default
|
|
openclaw models auth login --provider openai --method api-key
|
|
openclaw models auth paste-api-key --provider openai-codex
|
|
openclaw models auth list --provider openai
|
|
```
|
|
|
|
Notes:
|
|
|
|
- `login` accepts `--profile-id <id>` for providers that support named
|
|
profiles during login. Use this to keep multiple logins for the same
|
|
provider separate.
|
|
- `paste-api-key` accepts API keys generated elsewhere, prompts for the key
|
|
value, and writes it to the default profile id `<provider>:manual` unless you
|
|
pass `--profile-id`. In automation, pipe the key on stdin, for example
|
|
`printf "%s\n" "$OPENAI_API_KEY" | openclaw models auth paste-api-key --provider openai-codex`.
|
|
- `setup-token` and `paste-token` remain generic token commands for providers
|
|
that expose token auth methods.
|
|
- `setup-token` requires an interactive TTY and runs the provider's token-auth
|
|
method (defaulting to that provider's `setup-token` method when it exposes
|
|
one).
|
|
- `paste-token` accepts a token string generated elsewhere or from automation.
|
|
- `paste-token` requires `--provider`, prompts for the token value by default,
|
|
and writes it to the default profile id `<provider>:manual` unless you pass
|
|
`--profile-id`.
|
|
- In automation, pipe the token on stdin instead of passing it as an argument so
|
|
provider credentials do not appear in shell history or process lists.
|
|
- `paste-token --expires-in <duration>` stores an absolute token expiry from a
|
|
relative duration such as `365d` or `12h`.
|
|
- For `openai-codex`, OpenAI API keys and ChatGPT/OAuth token material are
|
|
different auth shapes. Use `paste-api-key` for `sk-...` OpenAI API keys and
|
|
`paste-token` only for token auth material.
|
|
- 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.
|
|
- Anthropic `setup-token` / `paste-token` remain available as a supported OpenClaw token path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
|
|
|
## Related
|
|
|
|
- [CLI reference](/cli)
|
|
- [Model selection](/concepts/model-providers)
|
|
- [Model failover](/concepts/model-failover)
|