commands.sh

opencode

all

An AI coding agent. Some subcommands such as `auth`, `models`, `web`, etc. have their own usage documentation.

More info →

Options (4)

-c, --continueboolean

Continue the most recent session

Example: opencode {{[-c|--continue]}}
-m, --modelboolean

Use a specific model and agent

Example: opencode run {{[-m|--model]}} {{provider}}/{{model}} --agent {{agent_name}} "{{message}}"
-h, --hostnameboolean

Start a headless opencode server for API access

Example: opencode serve {{[-h|--hostname]}} {{hostname}} {{[-p|--port]}} {{port}}
-p, --portboolean

Start a headless opencode server for API access

Example: opencode serve {{[-h|--hostname]}} {{hostname}} {{[-p|--port]}} {{port}}

Examples (8)

Start the interactive TUI

Continue the most recent session

opencode [-c|--continue]

Run opencode in non-interactive mode by passing a prompt directly

opencode run "message"

Use a specific model and agent

opencode run [-m|--model] provider/model --agent agent_name "message"

List all available models from configured providers

Manage credentials and login for providers

Start a headless opencode server for API access

opencode serve [-h|--hostname] hostname [-p|--port] port

Create a new agent with custom configuration

made by @shridhargupta | data from tldr-pages