Provides API endpoints related to operations
Summary
Functions
List agents
Write log
List skills
Remove auth credentials
Set auth credentials
List commands
Get configuration
List config providers
Update configuration
Subscribe to events
Get MCP resources
List sessions
Create workspace
List workspaces
Remove workspace
List files
Read file
Get file status
Find files
Find symbols
Find text
Get formatter status
Get global configuration
Update global configuration
Dispose instance
Get global events
Get health
Dispose instance
Get LSP status
Add MCP server
Authenticate MCP OAuth
Complete MCP OAuth
Remove MCP OAuth
Start MCP OAuth
post /mcp/{name}/connect
post /mcp/{name}/disconnect
Get MCP status
delete /session/{sessionID}/message/{messageID}/part/{partID}
patch /session/{sessionID}/message/{messageID}/part/{partID}
Get paths
List pending permissions
Respond to permission request
Respond to permission
Get current project
List all projects
Update project
Get provider auth methods
List providers
OAuth authorize
OAuth callback
Connect to PTY session
Create PTY session
Get PTY session
List PTY sessions
Remove PTY session
Update PTY session
List pending questions
Reject question request
Reply to question request
Abort session
Send command
Create session
Delete session
Delete message
Get message diff
Fork session
Initialize session
List sessions
Get session messages
Send message
Send async message
Revert message
Share session
Run shell command
Get session status
Summarize session
Get session todos
Restore reverted messages
Unshare session
Update session
List tool IDs
List tools
Append TUI prompt
Clear TUI prompt
Get next TUI request
Submit TUI response
Execute TUI command
Open help dialog
Open models dialog
Open sessions dialog
Open themes dialog
Publish TUI event
Select session
Show TUI toast
Submit TUI prompt
Get VCS info
Create worktree
List worktrees
Remove worktree
Reset worktree
Types
@type config_providers_200_json_resp() :: %{ default: map(), providers: [OpenCode.Generated.Provider.t()] }
@type find_text_200_json_resp() :: %{ absolute_offset: number(), line_number: number(), lines: find_text_200_json_resp_lines(), path: find_text_200_json_resp_path(), submatches: [find_text_200_json_resp_submatches()] }
@type find_text_200_json_resp_lines() :: %{text: String.t()}
@type find_text_200_json_resp_path() :: %{text: String.t()}
@type find_text_200_json_resp_submatches() :: %{ end: number(), match: find_text_200_json_resp_submatches_match(), start: number() }
@type find_text_200_json_resp_submatches_match() :: %{text: String.t()}
@type global_health_200_json_resp() :: %{healthy: true, version: String.t()}
@type mcp_auth_remove_200_json_resp() :: %{success: true}
@type mcp_auth_start_200_json_resp() :: %{authorization_url: String.t()}
@type provider_list_200_json_resp() :: %{ all: [provider_list_200_json_resp_all()], connected: [String.t()], default: map() }
@type session_command_200_json_resp() :: %{ info: OpenCode.Generated.AssistantMessage.t(), parts: [ OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t() ] }
@type session_message_200_json_resp() :: %{ info: OpenCode.Generated.AssistantMessage.t() | OpenCode.Generated.UserMessage.t(), parts: [ OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t() ] }
@type session_messages_200_json_resp() :: %{ info: OpenCode.Generated.AssistantMessage.t() | OpenCode.Generated.UserMessage.t(), parts: [ OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t() ] }
@type session_prompt_200_json_resp() :: %{ info: OpenCode.Generated.AssistantMessage.t(), parts: [ OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t() ] }
Functions
@spec app_agents(opts :: keyword()) :: {:ok, [OpenCode.Generated.Agent.t()]} | :error
List agents
Get a list of all available AI agents in the OpenCode system.
Options
directoryworkspace
@spec app_log(body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Write log
Write a log entry to the server logs with specified level and metadata.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec app_skills(opts :: keyword()) :: {:ok, [app_skills_200_json_resp()]} | :error
List skills
Get a list of all available skills in the OpenCode system.
Options
directoryworkspace
@spec auth_remove(providerID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Remove auth credentials
Remove authentication credentials
@spec auth_set( providerID :: String.t(), body :: OpenCode.Generated.ApiAuth.t() | OpenCode.Generated.OAuth.t() | OpenCode.Generated.WellKnownAuth.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Set auth credentials
Set authentication credentials
Request Body
Content Types: application/json
@spec command_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.Command.t()]} | :error
List commands
Get a list of all available commands in the OpenCode system.
Options
directoryworkspace
@spec config_get(opts :: keyword()) :: {:ok, OpenCode.Generated.Config.t()} | :error
Get configuration
Retrieve the current OpenCode configuration settings and preferences.
Options
directoryworkspace
@spec config_providers(opts :: keyword()) :: {:ok, config_providers_200_json_resp()} | :error
List config providers
Get a list of all configured AI providers and their default models.
Options
directoryworkspace
@spec config_update(body :: OpenCode.Generated.Config.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.Config.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Update configuration
Update OpenCode configuration settings and preferences.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec event_subscribe(opts :: keyword()) :: {:ok, OpenCode.Generated.EventCommandExecuted.t() | OpenCode.Generated.EventFileEdited.t() | OpenCode.Generated.EventFileWatcherUpdated.t() | OpenCode.Generated.EventGlobalDisposed.t() | OpenCode.Generated.EventInstallationUpdateAvailable.t() | OpenCode.Generated.EventInstallationUpdated.t() | OpenCode.Generated.EventLspClientDiagnostics.t() | OpenCode.Generated.EventLspUpdated.t() | OpenCode.Generated.EventMcpBrowserOpenFailed.t() | OpenCode.Generated.EventMcpToolsChanged.t() | OpenCode.Generated.EventMessagePartDelta.t() | OpenCode.Generated.EventMessagePartRemoved.t() | OpenCode.Generated.EventMessagePartUpdated.t() | OpenCode.Generated.EventMessageRemoved.t() | OpenCode.Generated.EventMessageUpdated.t() | OpenCode.Generated.EventPermissionAsked.t() | OpenCode.Generated.EventPermissionReplied.t() | OpenCode.Generated.EventProjectUpdated.t() | OpenCode.Generated.EventPtyCreated.t() | OpenCode.Generated.EventPtyDeleted.t() | OpenCode.Generated.EventPtyExited.t() | OpenCode.Generated.EventPtyUpdated.t() | OpenCode.Generated.EventQuestionAsked.t() | OpenCode.Generated.EventQuestionRejected.t() | OpenCode.Generated.EventQuestionReplied.t() | OpenCode.Generated.EventServerConnected.t() | OpenCode.Generated.EventServerInstanceDisposed.t() | OpenCode.Generated.EventSessionCompacted.t() | OpenCode.Generated.EventSessionCreated.t() | OpenCode.Generated.EventSessionDeleted.t() | OpenCode.Generated.EventSessionDiff.t() | OpenCode.Generated.EventSessionError.t() | OpenCode.Generated.EventSessionIdle.t() | OpenCode.Generated.EventSessionStatus.t() | OpenCode.Generated.EventSessionUpdated.t() | OpenCode.Generated.EventTodoUpdated.t() | OpenCode.Generated.EventTuiCommandExecute.t() | OpenCode.Generated.EventTuiPromptAppend.t() | OpenCode.Generated.EventTuiSessionSelect.t() | OpenCode.Generated.EventTuiToastShow.t() | OpenCode.Generated.EventVcsBranchUpdated.t() | OpenCode.Generated.EventWorkspaceFailed.t() | OpenCode.Generated.EventWorkspaceReady.t() | OpenCode.Generated.EventWorktreeFailed.t() | OpenCode.Generated.EventWorktreeReady.t()} | :error
Subscribe to events
Get events
Options
directoryworkspace
Get MCP resources
Get all available MCP resources from connected servers. Optionally filter by name.
Options
directoryworkspace
@spec experimental_session_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.GlobalSession.t()]} | :error
List sessions
Get a list of all OpenCode sessions across projects, sorted by most recently updated. Archived sessions are excluded by default.
Options
directory: Filter sessions by project directoryworkspaceroots: Only return root sessions (no parentID)start: Filter sessions updated on or after this timestamp (milliseconds since epoch)cursor: Return sessions updated before this timestamp (milliseconds since epoch)search: Filter sessions by title (case-insensitive)limit: Maximum number of sessions to returnarchived: Include archived sessions (default false)
@spec experimental_workspace_create(body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Workspace.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Create workspace
Create a workspace for the current project.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec experimental_workspace_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.Workspace.t()]} | :error
List workspaces
List all workspaces.
Options
directoryworkspace
@spec experimental_workspace_remove(id :: String.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.Workspace.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Remove workspace
Remove an existing workspace.
Options
directoryworkspace
@spec file_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.FileNode.t()]} | :error
List files
List files and directories in a specified path.
Options
directoryworkspacepath
@spec file_read(opts :: keyword()) :: {:ok, OpenCode.Generated.FileContent.t()} | :error
Read file
Read the content of a specified file.
Options
directoryworkspacepath
@spec file_status(opts :: keyword()) :: {:ok, [OpenCode.Generated.File.t()]} | :error
Get file status
Get the git status of all files in the project.
Options
directoryworkspace
Find files
Search for files or directories by name or pattern in the project directory.
Options
directoryworkspacequerydirstypelimit
@spec find_symbols(opts :: keyword()) :: {:ok, [OpenCode.Generated.Symbol.t()]} | :error
Find symbols
Search for workspace symbols like functions, classes, and variables using LSP.
Options
directoryworkspacequery
@spec find_text(opts :: keyword()) :: {:ok, [find_text_200_json_resp()]} | :error
Find text
Search for text patterns across files in the project using ripgrep.
Options
directoryworkspacepattern
@spec formatter_status(opts :: keyword()) :: {:ok, [OpenCode.Generated.FormatterStatus.t()]} | :error
Get formatter status
Get formatter status
Options
directoryworkspace
@spec global_config_get(opts :: keyword()) :: {:ok, OpenCode.Generated.Config.t()} | :error
Get global configuration
Retrieve the current global OpenCode configuration settings and preferences.
@spec global_config_update(body :: OpenCode.Generated.Config.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.Config.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Update global configuration
Update global OpenCode configuration settings and preferences.
Request Body
Content Types: application/json
Dispose instance
Clean up and dispose all OpenCode instances, releasing all resources.
@spec global_event(opts :: keyword()) :: {:ok, OpenCode.Generated.GlobalEvent.t()} | :error
Get global events
Subscribe to global events from the OpenCode system using server-sent events.
@spec global_health(opts :: keyword()) :: {:ok, global_health_200_json_resp()} | :error
Get health
Get health information about the OpenCode server.
Dispose instance
Clean up and dispose the current OpenCode instance, releasing all resources.
Options
directoryworkspace
@spec lsp_status(opts :: keyword()) :: {:ok, [OpenCode.Generated.LSPStatus.t()]} | :error
Get LSP status
Get LSP server status
Options
directoryworkspace
@spec mcp_add(body :: map(), opts :: keyword()) :: {:ok, map()} | {:error, OpenCode.Generated.BadRequestError.t()}
Add MCP server
Dynamically add a new Model Context Protocol (MCP) server to the system.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec mcp_auth_authenticate(name :: String.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.MCPStatusConnected.t() | OpenCode.Generated.MCPStatusDisabled.t() | OpenCode.Generated.MCPStatusFailed.t() | OpenCode.Generated.MCPStatusNeedsAuth.t() | OpenCode.Generated.MCPStatusNeedsClientRegistration.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Authenticate MCP OAuth
Start OAuth flow and wait for callback (opens browser)
Options
directoryworkspace
@spec mcp_auth_callback(name :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.MCPStatusConnected.t() | OpenCode.Generated.MCPStatusDisabled.t() | OpenCode.Generated.MCPStatusFailed.t() | OpenCode.Generated.MCPStatusNeedsAuth.t() | OpenCode.Generated.MCPStatusNeedsClientRegistration.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Complete MCP OAuth
Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec mcp_auth_remove(name :: String.t(), opts :: keyword()) :: {:ok, mcp_auth_remove_200_json_resp()} | {:error, OpenCode.Generated.NotFoundError.t()}
Remove MCP OAuth
Remove OAuth credentials for an MCP server
Options
directoryworkspace
@spec mcp_auth_start(name :: String.t(), opts :: keyword()) :: {:ok, mcp_auth_start_200_json_resp()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Start MCP OAuth
Start OAuth authentication flow for a Model Context Protocol (MCP) server.
Options
directoryworkspace
post /mcp/{name}/connect
Connect an MCP server
Options
directoryworkspace
post /mcp/{name}/disconnect
Disconnect an MCP server
Options
directoryworkspace
Get MCP status
Get the status of all Model Context Protocol (MCP) servers.
Options
directoryworkspace
@spec part_delete( sessionID :: String.t(), messageID :: String.t(), partID :: String.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
delete /session/{sessionID}/message/{messageID}/part/{partID}
Delete a part from a message
Options
directoryworkspace
@spec part_update( sessionID :: String.t(), messageID :: String.t(), partID :: String.t(), body :: OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t(), opts :: keyword() ) :: {:ok, OpenCode.Generated.AgentPart.t() | OpenCode.Generated.CompactionPart.t() | OpenCode.Generated.FilePart.t() | OpenCode.Generated.PatchPart.t() | OpenCode.Generated.ReasoningPart.t() | OpenCode.Generated.RetryPart.t() | OpenCode.Generated.SnapshotPart.t() | OpenCode.Generated.StepFinishPart.t() | OpenCode.Generated.StepStartPart.t() | OpenCode.Generated.SubtaskPart.t() | OpenCode.Generated.TextPart.t() | OpenCode.Generated.ToolPart.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
patch /session/{sessionID}/message/{messageID}/part/{partID}
Update a part in a message
Options
directoryworkspace
Request Body
Content Types: application/json
@spec path_get(opts :: keyword()) :: {:ok, OpenCode.Generated.Path.t()} | :error
Get paths
Retrieve the current working directory and related path information for the OpenCode instance.
Options
directoryworkspace
@spec permission_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.PermissionRequest.t()]} | :error
List pending permissions
Get all pending permission requests across all sessions.
Options
directoryworkspace
@spec permission_reply(requestID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Respond to permission request
Approve or deny a permission request from the AI assistant.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec permission_respond( sessionID :: String.t(), permissionID :: String.t(), body :: map(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Respond to permission
Approve or deny a permission request from the AI assistant.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec project_current(opts :: keyword()) :: {:ok, OpenCode.Generated.Project.t()} | :error
Get current project
Retrieve the currently active project that OpenCode is working with.
Options
directoryworkspace
@spec project_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.Project.t()]} | :error
List all projects
Get a list of projects that have been opened with OpenCode.
Options
directoryworkspace
@spec project_update(projectID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Project.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Update project
Update project properties such as name, icon, and commands.
Options
directoryworkspace
Request Body
Content Types: application/json
Get provider auth methods
Retrieve available authentication methods for all AI providers.
Options
directoryworkspace
@spec provider_list(opts :: keyword()) :: {:ok, provider_list_200_json_resp()} | :error
List providers
Get a list of all available AI providers, including both available and connected ones.
Options
directoryworkspace
@spec provider_oauth_authorize( providerID :: String.t(), body :: map(), opts :: keyword() ) :: {:ok, OpenCode.Generated.ProviderAuthAuthorization.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
OAuth authorize
Initiate OAuth authorization for a specific AI provider to get an authorization URL.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec provider_oauth_callback( providerID :: String.t(), body :: map(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
OAuth callback
Handle the OAuth callback from a provider after user authorization.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec pty_connect(ptyID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.NotFoundError.t()}
Connect to PTY session
Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
Options
directoryworkspace
@spec pty_create(body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Pty.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Create PTY session
Create a new pseudo-terminal (PTY) session for running shell commands and processes.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec pty_get(ptyID :: String.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.Pty.t()} | {:error, OpenCode.Generated.NotFoundError.t()}
Get PTY session
Retrieve detailed information about a specific pseudo-terminal (PTY) session.
Options
directoryworkspace
@spec pty_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.Pty.t()]} | :error
List PTY sessions
Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
Options
directoryworkspace
@spec pty_remove(ptyID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.NotFoundError.t()}
Remove PTY session
Remove and terminate a specific pseudo-terminal (PTY) session.
Options
directoryworkspace
@spec pty_update(ptyID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Pty.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Update PTY session
Update properties of an existing pseudo-terminal (PTY) session.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec question_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.QuestionRequest.t()]} | :error
List pending questions
Get all pending question requests across all sessions.
Options
directoryworkspace
@spec question_reject(requestID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Reject question request
Reject a question request from the AI assistant.
Options
directoryworkspace
@spec question_reply(requestID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Reply to question request
Provide answers to a question request from the AI assistant.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_abort(sessionID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Abort session
Abort an active session and stop any ongoing AI processing or command execution.
Options
directoryworkspace
@spec session_command(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, session_command_200_json_resp()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Send command
Send a new command to a session for execution by the AI assistant.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_create(body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Session.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Create session
Create a new OpenCode session for interacting with AI assistants and managing conversations.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_delete(sessionID :: String.t(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Delete session
Delete a session and permanently remove all associated data, including messages and history.
Options
directoryworkspace
@spec session_delete_message( sessionID :: String.t(), messageID :: String.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Delete message
Permanently delete a specific message (and all of its parts) from a session. This does not revert any file changes that may have been made while processing the message.
Options
directoryworkspace
@spec session_diff(sessionID :: String.t(), opts :: keyword()) :: {:ok, [OpenCode.Generated.FileDiff.t()]} | :error
Get message diff
Get the file changes (diff) that resulted from a specific user message in the session.
Options
directoryworkspacemessageID
@spec session_fork(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Session.t()} | :error
Fork session
Create a new session by forking an existing session at a specific message point.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_init(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Initialize session
Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.Session.t()]} | :error
List sessions
Get a list of all OpenCode sessions, sorted by most recently updated.
Options
directory: Filter sessions by project directoryworkspaceroots: Only return root sessions (no parentID)start: Filter sessions updated on or after this timestamp (milliseconds since epoch)search: Filter sessions by title (case-insensitive)limit: Maximum number of sessions to return
@spec session_message( sessionID :: String.t(), messageID :: String.t(), opts :: keyword() ) :: {:ok, session_message_200_json_resp()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Get message
Retrieve a specific message from a session by its message ID.
Options
directoryworkspace
@spec session_messages(sessionID :: String.t(), opts :: keyword()) :: {:ok, [session_messages_200_json_resp()]} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Get session messages
Retrieve all messages in a session, including user prompts and AI responses.
Options
directoryworkspacelimit
@spec session_prompt(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, session_prompt_200_json_resp()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Send message
Create and send a new message to a session, streaming the AI response.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_prompt_async(sessionID :: String.t(), body :: map(), opts :: keyword()) :: :ok | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Send async message
Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_revert(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Session.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Revert message
Revert a specific message in a session, undoing its effects and restoring the previous state.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_shell(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.AssistantMessage.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Run shell command
Execute a shell command within the session context and return the AI's response.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_status(opts :: keyword()) :: {:ok, map()} | {:error, OpenCode.Generated.BadRequestError.t()}
Get session status
Retrieve the current status of all sessions, including active, idle, and completed states.
Options
directoryworkspace
@spec session_summarize(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Summarize session
Generate a concise summary of the session using AI compaction to preserve key information.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec session_todo(sessionID :: String.t(), opts :: keyword()) :: {:ok, [OpenCode.Generated.Todo.t()]} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Get session todos
Retrieve the todo list associated with a specific session, showing tasks and action items.
Options
directoryworkspace
@spec session_unrevert(sessionID :: String.t(), opts :: keyword()) :: {:ok, OpenCode.Generated.Session.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Restore reverted messages
Restore all previously reverted messages in a session.
Options
directoryworkspace
@spec session_update(sessionID :: String.t(), body :: map(), opts :: keyword()) :: {:ok, OpenCode.Generated.Session.t()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Update session
Update properties of an existing session, such as title or other metadata.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec tool_ids(opts :: keyword()) :: {:ok, [String.t()]} | {:error, OpenCode.Generated.BadRequestError.t()}
List tool IDs
Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
Options
directoryworkspace
@spec tool_list(opts :: keyword()) :: {:ok, [OpenCode.Generated.ToolListItem.t()]} | {:error, OpenCode.Generated.BadRequestError.t()}
List tools
Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
Options
directoryworkspaceprovidermodel
@spec tui_append_prompt(body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Append TUI prompt
Append prompt to the TUI
Options
directoryworkspace
Request Body
Content Types: application/json
Clear TUI prompt
Clear the prompt
Options
directoryworkspace
@spec tui_control_next(opts :: keyword()) :: {:ok, tui_control_next_200_json_resp()} | :error
Get next TUI request
Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
Options
directoryworkspace
Submit TUI response
Submit a response to the TUI request queue to complete a pending request.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec tui_execute_command(body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Execute TUI command
Execute a TUI command (e.g. agent_cycle)
Options
directoryworkspace
Request Body
Content Types: application/json
Open help dialog
Open the help dialog in the TUI to display user assistance information.
Options
directoryworkspace
Open models dialog
Open the model dialog
Options
directoryworkspace
Open sessions dialog
Open the session dialog
Options
directoryworkspace
Open themes dialog
Open the theme dialog
Options
directoryworkspace
@spec tui_publish( body :: OpenCode.Generated.EventTuiCommandExecute.t() | OpenCode.Generated.EventTuiPromptAppend.t() | OpenCode.Generated.EventTuiSessionSelect.t() | OpenCode.Generated.EventTuiToastShow.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Publish TUI event
Publish a TUI event
Options
directoryworkspace
Request Body
Content Types: application/json
@spec tui_select_session(body :: map(), opts :: keyword()) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t() | OpenCode.Generated.NotFoundError.t()}
Select session
Navigate the TUI to display the specified session.
Options
directoryworkspace
Request Body
Content Types: application/json
Show TUI toast
Show a toast notification in the TUI
Options
directoryworkspace
Request Body
Content Types: application/json
Submit TUI prompt
Submit the prompt
Options
directoryworkspace
@spec vcs_get(opts :: keyword()) :: {:ok, OpenCode.Generated.VcsInfo.t()} | :error
Get VCS info
Retrieve version control system (VCS) information for the current project, such as git branch.
Options
directoryworkspace
@spec worktree_create( body :: OpenCode.Generated.WorktreeCreateInput.t(), opts :: keyword() ) :: {:ok, OpenCode.Generated.Worktree.t()} | {:error, OpenCode.Generated.BadRequestError.t()}
Create worktree
Create a new git worktree for the current project and run any configured startup scripts.
Options
directoryworkspace
Request Body
Content Types: application/json
List worktrees
List all sandbox worktrees for the current project.
Options
directoryworkspace
@spec worktree_remove( body :: OpenCode.Generated.WorktreeRemoveInput.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Remove worktree
Remove a git worktree and delete its branch.
Options
directoryworkspace
Request Body
Content Types: application/json
@spec worktree_reset( body :: OpenCode.Generated.WorktreeResetInput.t(), opts :: keyword() ) :: {:ok, boolean()} | {:error, OpenCode.Generated.BadRequestError.t()}
Reset worktree
Reset a worktree branch to the primary default branch.
Options
directoryworkspace
Request Body
Content Types: application/json