Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenCode CLI reference - Slash commands

OpenCode slash commands

OpenCode documents 15 slash commands, including /connect, /compact and /details. You type these inside an interactive OpenCode session. Each row gives the docs' description, accepted values and an example where one is documented.

Last verified 1 official pageFull OpenCode reference

OpenCode slash commands
CommandDescriptionExample
/connect

Adds a provider to OpenCode by selecting from available providers and adding their API keys.

Docs: /connect
/connect
/compact

Compacts the current session.

Alias: /summarize. Keybind: ctrl+x c

Docs: /compact
/compact
/details

Toggles tool execution details.

Docs: /details
/details
/editor

Opens an external editor (from EDITOR) for composing messages.

Keybind: ctrl+x e

Docs: /editor
/editor
/exit

Exits OpenCode.

Aliases: /quit, /q. Keybind: ctrl+x q

Docs: /exit
/exit
/export

Exports the current conversation to Markdown and opens it in the editor set in EDITOR.

Keybind: ctrl+x x

Docs: /export
/export
/help

Shows the help dialog.

Docs: /help
/help
/init

Guided setup for creating or updating AGENTS.md; scans the repo and may ask targeted questions.

Docs: /init
/init
/models

Lists available models.

Keybind: ctrl+x m

Docs: /models
/models
/new

Starts a new session.

Alias: /clear. Keybind: ctrl+x n

Docs: /new
/new
/redo

Redoes a previously undone message, restoring file changes; only available after /undo and requires a Git repository.

Keybind: ctrl+x r

Docs: /redo
/redo
/sessions

Lists and switches between sessions.

Aliases: /resume, /continue. Keybind: ctrl+x l

Docs: /sessions
/sessions
/themes

Lists available themes.

Keybind: ctrl+x t

Docs: /themes
/themes
/thinking

Toggles visibility of thinking/reasoning blocks; does not change the model's reasoning (use ctrl+t to cycle variants).

Docs: /thinking
/thinking
/undo

Undoes the last message, removing the latest user message, subsequent responses and file changes; requires a Git repository.

Keybind: ctrl+x u

Docs: /undo
/undo

The rest of the OpenCode reference

FAQ

How many slash commands does OpenCode have?

The official OpenCode docs list 15 slash commands, including /connect, /compact and /details. All of them are in the table above, in the docs' order.

What does /connect do in OpenCode?

Adds a provider to OpenCode by selecting from available providers and adding their API keys.

Where are OpenCode slash commands documented?

On 1 official docs page at opencode.ai, last read on October 17, 2026. Every row in the table links the exact section it came from.

More on OpenCode

Sources

Last verified . Names and examples are copied verbatim from the official page below, and every row above links the exact section it came from.

Newsletter

Know when your tools change

One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.