model

manage models: built-ins, aliases, custom endpoints

Manage the models coder can dispatch to. add connects any OpenAI-compatible endpoint (Ollama, vLLM, OpenRouter, ...) as the custom engine, alongside the built-in codex/claude models. Name your own shortcuts with alias (e.g. fast -> codex/luna); disable/enable turns any model off and on.

model list [--server <server>] [--workspace <workspace>] [--yes] [--json] [--cwd <cwd>]

list built-ins, custom models, and aliases

List built-in aliases, configured custom models, and user aliases. Only custom models on this machine are probed; --server lists the workspace's.

  • --server <server> act on the Coder server
  • --workspace <workspace> with --server: the workspace to act in (default: the saved one)
  • --yes with --server: connect to a server used for the first time without asking
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model add [name] [--base-url <base-url>] [--model <model>] [--env-key <env-key>] [--context-window <context-window>] [--workspace] [--json] [--cwd <cwd>]

connect a model

Connect a custom model behind an OpenAI-compatible endpoint (Ollama, LM Studio, vLLM, OpenRouter, ...). It currently runs on the codex engine pointed at your URL and is usable anywhere a model is: --model or --model custom/, or as an agent default in config. Alias: coder model setup.

  • <name> the name to dispatch it by
  • --base-url <base-url> OpenAI-compatible API base (e.g. http://localhost:11434/v1)
  • --model <model> the provider's model id (e.g. qwen2.5-coder:32b)
  • --env-key <env-key> env var holding the API key (omit for keyless local endpoints)
  • --context-window <context-window> the model's context window in tokens; filled from the provider when it reports one
  • --workspace write to /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current
coder model add qwen --base-url http://localhost:11434/v1 --model qwen2.5-coder:32b  # local Ollama model, no key
coder model add kimi --base-url https://openrouter.ai/api/v1 --model moonshotai/kimi-k2 --env-key OPENROUTER_API_KEY  # third-party provider via OpenRouter
coder run --model qwen "explain this repo"  # dispatch a task on it

model update [name] [--base-url <base-url>] [--model <model>] [--env-key <env-key>] [--context-window <context-window>] [--workspace] [--json] [--cwd <cwd>]

change a model in place

Update a configured custom model. Only the flags you pass change; the endpoint is re-probed and the wire protocol re-detected.

  • <name> the custom model
  • --base-url <base-url> new API base
  • --model <model> new provider model id
  • --env-key <env-key> new API-key env var
  • --context-window <context-window> the model's context window in tokens; filled from the provider when it reports one
  • --workspace write to /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model remove [name] [--workspace] [--json] [--cwd <cwd>]

delete a custom model

Remove a configured custom model.

  • <name> the custom model
  • --workspace target /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model disable [name] [--workspace] [--json] [--cwd <cwd>]

turn off a model (built-in, custom, or alias)

Disable a model - built-in, custom, or alias. Requests for it fail until re-enabled.

  • <name> a built-in, custom model, or alias
  • --workspace target /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model enable [name] [--workspace] [--json] [--cwd <cwd>]

re-enable a disabled model

  • <name> a built-in, custom model, or alias
  • --workspace target /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model alias [name] [spec] [--workspace] [--json] [--cwd <cwd>]

name a spec, e.g. fast codex/luna

Save an alias for an engine spec, e.g. fast -> codex/luna. An alias may reuse a built-in name to override it; an engine name sets what that bare engine runs.

  • <name> the alias
  • <spec> the engine spec, such as codex/luna
  • --workspace target /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current

model unalias [name] [--workspace] [--json] [--cwd <cwd>]

remove an alias

Remove a user-defined alias.

  • <name> the alias
  • --workspace target /.coder/config.json instead of the user file
  • --json JSON output
  • --cwd <cwd> workspace directory; default current