Skip to main content

Basic Usage

Global Options

OptionDescription
-v, --versionShow version number and exit
-t, --task TEXTInitial task to seed the conversation
-f, --file PATHPath to a file whose contents seed the conversation
--resume [ID]Resume a conversation. If no ID provided, lists recent conversations
--lastResume the most recent conversation (use with --resume)
--expUse textual-based UI (now default, kept for compatibility)
--headlessRun in headless mode (no UI, requires --task or --file)
--jsonEnable JSONL output (requires --headless)
--always-approveAuto-approve all actions without confirmation
--llm-approveUse LLM-based security analyzer for action approval
--override-with-envsApply environment variables (LLM_API_KEY, LLM_MODEL, LLM_BASE_URL) to override stored settings
--exit-without-confirmationExit without showing confirmation dialog

Subcommands

serve

Launch the OpenHands GUI server using Docker.
OptionDescription
--mount-cwdMount the current working directory into the container
--gpuEnable GPU support via nvidia-docker
Examples:

web

Launch the CLI as a web application accessible via browser.
OptionDefaultDescription
--host0.0.0.0Host to bind the web server to
--port12000Port to bind the web server to
--debugfalseEnable debug mode
Examples:

cloud

Create a new conversation in OpenHands Cloud.
OptionDescription
-t, --task TEXTInitial task to seed the conversation
-f, --file PATHPath to a file whose contents seed the conversation
--server-url URLOpenHands server URL (default: https://app.all-hands.dev)
Examples:

acp

Start the Agent Client Protocol server for IDE integrations.
OptionDescription
--resume [ID]Resume a conversation by ID
--lastResume the most recent conversation
--always-approveAuto-approve all actions
--llm-approveUse LLM-based security analyzer
--streamingEnable token-by-token streaming
Examples:

mcp

Manage Model Context Protocol server configurations.

mcp add

Add a new MCP server.
OptionDescription
--transportTransport type: http, sse, or stdio (required)
--headerHTTP header for http/sse (format: "Key: Value", repeatable)
--envEnvironment variable for stdio (format: KEY=value, repeatable)
--authAuthentication method (e.g., oauth)
--enabledEnable immediately (default)
--disabledAdd in disabled state
Examples:

mcp list

List all configured MCP servers.

mcp get

Get details for a specific MCP server.

mcp remove

Remove an MCP server configuration.

mcp enable

Enable an MCP server.

mcp disable

Disable an MCP server.

login

Authenticate with OpenHands Cloud.
OptionDescription
--server-url URLOpenHands server URL (default: https://app.all-hands.dev)
Examples:

logout

Log out from OpenHands Cloud.
OptionDescription
--server-url URLServer URL to log out from (if not specified, logs out from all)
Examples:

Interactive Commands

Commands available inside the CLI (prefix with /):
CommandDescription
/helpDisplay available commands
/newStart a new conversation
/historyToggle conversation history
/confirmConfigure confirmation settings
/condenseCondense conversation history
/skillsView loaded skills, hooks, and MCPs
/feedbackSend anonymous feedback about CLI
/exitExit the application

Command Palette

Press Ctrl+P (or Ctrl+\) to open the command palette for quick access to:
OptionDescription
HistoryToggle conversation history panel
KeysShow keyboard shortcuts
MCPView MCP server configurations
MaximizeMaximize/restore window
PlanView agent plan
QuitQuit the application
ScreenshotTake a screenshot
SettingsConfigure LLM model, API keys, and other settings
ThemeToggle color theme

Changing Your Model

Via Settings UI

  1. Press Ctrl+P to open the command palette
  2. Select Settings
  3. Choose your LLM provider and model
  4. Save changes (no restart required)

Via Configuration File

Edit ~/.openhands/agent_settings.json and change the model field:

Via Environment Variables

Temporarily override your model without changing saved configuration:
Changes made with --override-with-envs are not persisted.

Environment Variables

VariableDescription
LLM_API_KEYAPI key for your LLM provider
LLM_MODELModel to use (requires --override-with-envs)
LLM_BASE_URLCustom LLM base URL (requires --override-with-envs)
OPENHANDS_CLOUD_URLDefault cloud server URL
OPENHANDS_VERSIONDocker image version for openhands serve

Exit Codes

CodeMeaning
0Success
1Error or task failed
2Invalid arguments

Configuration Files

FilePurpose
~/.openhands/agent_settings.jsonLLM configuration and agent settings
~/.openhands/cli_config.jsonCLI preferences (e.g., critic enabled)
~/.openhands/mcp.jsonMCP server configurations
~/.openhands/conversations/Conversation history

See Also