# OpenCode > OpenCode documentation. ## Docs - [Agents](https://opencode.mintlify.app/agents.md) - [List agents](https://opencode.mintlify.app/api-reference/agent/list-agents.md): Retrieve currently registered agents. - [List commands](https://opencode.mintlify.app/api-reference/command/list-commands.md): Retrieve currently registered commands. - [Remove credential](https://opencode.mintlify.app/api-reference/credential/remove-credential.md): Remove a stored integration credential. - [Update credential](https://opencode.mintlify.app/api-reference/credential/update-credential.md): Update a stored credential label. - [Evict a loaded location](https://opencode.mintlify.app/api-reference/debug/evict-a-loaded-location.md): Dispose the requested location's cached services so its next use boots them fresh. - [List loaded locations](https://opencode.mintlify.app/api-reference/debug/list-loaded-locations.md): List locations currently loaded by the server. - [Subscribe to events](https://opencode.mintlify.app/api-reference/event/subscribe-to-events.md): Subscribe to native event payloads for the server. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed. - [Find files](https://opencode.mintlify.app/api-reference/filesystem/find-files.md): Find recursively ranked filesystem entries relative to the requested location. - [List directory](https://opencode.mintlify.app/api-reference/filesystem/list-directory.md): List direct children of one directory relative to the requested location. - [Read file](https://opencode.mintlify.app/api-reference/filesystem/read-file.md): Serve one file relative to the requested location. - [Cancel form](https://opencode.mintlify.app/api-reference/form/cancel-form.md): Cancel a pending form. - [Create session form](https://opencode.mintlify.app/api-reference/form/create-session-form.md): Create a form for a session. - [Get form state](https://opencode.mintlify.app/api-reference/form/get-form-state.md): Retrieve the current state for a form. - [Get session form](https://opencode.mintlify.app/api-reference/form/get-session-form.md): Retrieve a form for a session. - [List pending form requests](https://opencode.mintlify.app/api-reference/form/list-pending-form-requests.md): Retrieve pending forms for a location. - [List session forms](https://opencode.mintlify.app/api-reference/form/list-session-forms.md): Retrieve pending forms for a session. - [Reply to form](https://opencode.mintlify.app/api-reference/form/reply-to-form.md): Submit an answer to a pending form. - [Generate text](https://opencode.mintlify.app/api-reference/generate/generate-text.md): Run one stateless model generation at the requested location and return the assistant text. Uses the location's default model when none is specified. - [Check server health](https://opencode.mintlify.app/api-reference/health/check-server-health.md): Check whether the API server is ready to accept requests. - [Begin OAuth connection](https://opencode.mintlify.app/api-reference/integration/begin-oauth-connection.md): Start an OAuth attempt and return the authorization details. - [Cancel OAuth connection](https://opencode.mintlify.app/api-reference/integration/cancel-oauth-connection.md): Cancel an OAuth attempt and release its resources. - [Complete OAuth connection](https://opencode.mintlify.app/api-reference/integration/complete-oauth-connection.md): Complete a code-based OAuth attempt and store the resulting credential. - [Connect with key](https://opencode.mintlify.app/api-reference/integration/connect-with-key.md): Run a key authentication method and store the resulting credential. - [Get integration](https://opencode.mintlify.app/api-reference/integration/get-integration.md): Retrieve one integration and its authentication methods. - [Get OAuth attempt status](https://opencode.mintlify.app/api-reference/integration/get-oauth-attempt-status.md): Poll the current status of an OAuth attempt. - [List integrations](https://opencode.mintlify.app/api-reference/integration/list-integrations.md): Retrieve available integrations and their authentication methods. - [Get location](https://opencode.mintlify.app/api-reference/location/get-location.md): Resolve the requested location or the server default location. - [List MCP resources](https://opencode.mintlify.app/api-reference/mcp/list-mcp-resources.md): Retrieve resources and resource templates from connected MCP servers. - [List MCP servers](https://opencode.mintlify.app/api-reference/mcp/list-mcp-servers.md): Retrieve configured MCP servers and their connection status. - [Get default model](https://opencode.mintlify.app/api-reference/model/get-default-model.md): Retrieve the model used when a session has no explicit model selection. - [List models](https://opencode.mintlify.app/api-reference/model/list-models.md): Retrieve available models ordered by release date. - [Create permission request](https://opencode.mintlify.app/api-reference/permission/create-permission-request.md): Evaluate and, when approval is required, create a permission request for a session. - [Get permission request](https://opencode.mintlify.app/api-reference/permission/get-permission-request.md): Retrieve a pending permission request owned by a session. - [List pending permission requests](https://opencode.mintlify.app/api-reference/permission/list-pending-permission-requests.md): Retrieve pending permission requests for a location. - [List saved permissions](https://opencode.mintlify.app/api-reference/permission/list-saved-permissions.md): Retrieve saved permissions, optionally filtered by project. - [List session permission requests](https://opencode.mintlify.app/api-reference/permission/list-session-permission-requests.md): Retrieve pending permission requests owned by a session. - [Remove saved permission](https://opencode.mintlify.app/api-reference/permission/remove-saved-permission.md): Remove a saved permission by ID. - [Reply to pending permission request](https://opencode.mintlify.app/api-reference/permission/reply-to-pending-permission-request.md): Respond to a pending permission request owned by a session. - [List plugins](https://opencode.mintlify.app/api-reference/plugin/list-plugins.md): Retrieve currently loaded plugins. - [Get current project](https://opencode.mintlify.app/api-reference/project/get-current-project.md): Resolve the project for the requested location. - [List project directories](https://opencode.mintlify.app/api-reference/project/list-project-directories.md): List known local absolute directories for a project. - [List projects](https://opencode.mintlify.app/api-reference/project/list-projects.md): List known projects. - [Delete experimentalproject copy](https://opencode.mintlify.app/api-reference/projectcopy/delete-experimentalproject-copy.md) - [Post experimentalproject copy](https://opencode.mintlify.app/api-reference/projectcopy/post-experimentalproject-copy.md) - [Post experimentalproject copyrefresh](https://opencode.mintlify.app/api-reference/projectcopy/post-experimentalproject-copyrefresh.md) - [Get provider](https://opencode.mintlify.app/api-reference/provider/get-provider.md): Retrieve a single AI provider so clients can inspect its availability and endpoint settings. - [List providers](https://opencode.mintlify.app/api-reference/provider/list-providers.md): Retrieve active AI providers so clients can show provider availability and configuration. - [Connect to PTY session](https://opencode.mintlify.app/api-reference/pty/connect-to-pty-session.md): Establish a WebSocket connection streaming PTY output and accepting terminal input. - [Create PTY session](https://opencode.mintlify.app/api-reference/pty/create-pty-session.md): Create a pseudo-terminal session for a location. - [Create PTY WebSocket token](https://opencode.mintlify.app/api-reference/pty/create-pty-websocket-token.md): Create a short-lived single-use ticket for opening a PTY WebSocket connection. - [Get PTY session](https://opencode.mintlify.app/api-reference/pty/get-pty-session.md): Get one PTY session, including its exit code once exited. - [List PTY sessions](https://opencode.mintlify.app/api-reference/pty/list-pty-sessions.md): List PTY sessions for a location, including exited sessions retained until removal. - [Remove PTY session](https://opencode.mintlify.app/api-reference/pty/remove-pty-session.md): Terminate and remove one PTY session. - [Update PTY session](https://opencode.mintlify.app/api-reference/pty/update-pty-session.md): Update the title or viewport size of one PTY session. - [List pending question requests](https://opencode.mintlify.app/api-reference/question/list-pending-question-requests.md): Retrieve pending question requests for a location. - [List session question requests](https://opencode.mintlify.app/api-reference/question/list-session-question-requests.md): Retrieve pending question requests owned by a session. - [Reject pending question request](https://opencode.mintlify.app/api-reference/question/reject-pending-question-request.md): Reject a pending question request owned by a session. - [Reply to pending question request](https://opencode.mintlify.app/api-reference/question/reply-to-pending-question-request.md): Answer a pending question request owned by a session. - [List references](https://opencode.mintlify.app/api-reference/reference/list-references.md): List references available in the requested location. - [Get server information](https://opencode.mintlify.app/api-reference/server/get-server-information.md): Return the URLs that can be used to connect to this server. - [Activate skill](https://opencode.mintlify.app/api-reference/session/activate-skill.md): Activate a skill for a session by appending a skill message and resuming execution. - [Add synthetic message](https://opencode.mintlify.app/api-reference/session/add-synthetic-message.md): Append a synthetic message to a session and resume execution. - [Background blocking session tools](https://opencode.mintlify.app/api-reference/session/background-blocking-session-tools.md): Move active foreground backgroundable tools for this session into background observation. Idle requests are a no-op. - [Clear staged revert](https://opencode.mintlify.app/api-reference/session/clear-staged-revert.md) - [Commit staged revert](https://opencode.mintlify.app/api-reference/session/commit-staged-revert.md) - [Compact session](https://opencode.mintlify.app/api-reference/session/compact-session.md): Queue a durable session compaction request. - [Create session](https://opencode.mintlify.app/api-reference/session/create-session.md): Create a session at the requested location. - [Delete session](https://opencode.mintlify.app/api-reference/session/delete-session.md): Delete a session and its child sessions. - [Fork session](https://opencode.mintlify.app/api-reference/session/fork-session.md): Create a child session by copying projected history from the parent. When messageID is supplied, copy messages before that boundary. - [Get session](https://opencode.mintlify.app/api-reference/session/get-session.md): Retrieve a session by ID. - [Get session context](https://opencode.mintlify.app/api-reference/session/get-session-context.md): Retrieve the active context messages for a session (all messages after the last compaction). - [Get session message](https://opencode.mintlify.app/api-reference/session/get-session-message.md): Retrieve one projected message owned by the Session. - [Get session messages](https://opencode.mintlify.app/api-reference/session/get-session-messages.md): Retrieve projected messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline. - [Interrupt session execution](https://opencode.mintlify.app/api-reference/session/interrupt-session-execution.md): Interrupt active execution owned by this OpenCode process. Idle interruption is a no-op. - [List active sessions](https://opencode.mintlify.app/api-reference/session/list-active-sessions.md): Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive. - [List instruction entries](https://opencode.mintlify.app/api-reference/session/list-instruction-entries.md): List API-managed instruction entries attached to the session. - [List sessions](https://opencode.mintlify.app/api-reference/session/list-sessions.md): Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list. - [Move session](https://opencode.mintlify.app/api-reference/session/move-session.md): Move a session to another project directory, optionally transferring local changes. - [Put instruction entry](https://opencode.mintlify.app/api-reference/session/put-instruction-entry.md): Attach or replace one durable instruction entry. Changes announce as updates at the next step boundary. - [Read the session log](https://opencode.mintlify.app/api-reference/session/read-the-session-log.md): Experimental durable session event log. Reads events after an exclusive aggregate sequence and continues with live events when follow=true. - [Remove instruction entry](https://opencode.mintlify.app/api-reference/session/remove-instruction-entry.md): Remove one instruction entry; the removal is announced to the model at the next step boundary. - [Rename session](https://opencode.mintlify.app/api-reference/session/rename-session.md): Update the session title. - [Run command](https://opencode.mintlify.app/api-reference/session/run-command.md): Resolve a slash command into prompt input, admit it durably, and schedule execution unless resume is false. - [Run shell command](https://opencode.mintlify.app/api-reference/session/run-shell-command.md): Execute one shell command in the session's working directory. Emits a shell.started event before execution and a shell.ended event with the merged output after. - [Send message](https://opencode.mintlify.app/api-reference/session/send-message.md): Durably admit one session input and schedule agent-loop execution unless resume is false. - [Stage session revert](https://opencode.mintlify.app/api-reference/session/stage-session-revert.md): Stage or move a reversible session boundary and optionally apply its file changes. - [Switch session agent](https://opencode.mintlify.app/api-reference/session/switch-session-agent.md): Switch the agent used by subsequent provider turns. - [Switch session model](https://opencode.mintlify.app/api-reference/session/switch-session-model.md): Switch the model used by subsequent provider turns. - [Wait for session](https://opencode.mintlify.app/api-reference/session/wait-for-session.md): Wait for a session agent loop to become idle. - [Get shell command](https://opencode.mintlify.app/api-reference/shell/get-shell-command.md): Get one shell command, including its status and exit code once exited. - [List running shell commands](https://opencode.mintlify.app/api-reference/shell/list-running-shell-commands.md): List currently running shell commands for a location. Exited commands are not included. - [Read shell output](https://opencode.mintlify.app/api-reference/shell/read-shell-output.md): Page through captured combined output by absolute byte cursor. - [Remove shell command](https://opencode.mintlify.app/api-reference/shell/remove-shell-command.md): Terminate and remove one shell command and its retained output. - [Run shell command](https://opencode.mintlify.app/api-reference/shell/run-shell-command.md): Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output. - [Update shell timeout](https://opencode.mintlify.app/api-reference/shell/update-shell-timeout.md): Replace a running shell command's timeout from now, or clear it with zero. - [List skills](https://opencode.mintlify.app/api-reference/skill/list-skills.md): Retrieve currently registered skills. - [VCS diff](https://opencode.mintlify.app/api-reference/vcs/vcs-diff.md): Diff the working copy against HEAD (mode git) or the default-branch merge base (mode branch) for the requested location. - [VCS status](https://opencode.mintlify.app/api-reference/vcs/vcs-status.md): List uncommitted working-copy changes relative to the requested location. - [API Reference](https://opencode.mintlify.app/api/index.md): OpenCode HTTP API. - [Attachments](https://opencode.mintlify.app/attachments.md) - [Client](https://opencode.mintlify.app/client.md): Connect an application to the OpenCode HTTP API. - [Commands](https://opencode.mintlify.app/commands.md) - [Compaction](https://opencode.mintlify.app/compaction.md) - [Config](https://opencode.mintlify.app/config.md) - [Formatters](https://opencode.mintlify.app/formatters.md) - [Intro](https://opencode.mintlify.app/index.md): Get started with OpenCode. - [Instructions](https://opencode.mintlify.app/instructions.md) - [LSP](https://opencode.mintlify.app/lsp.md) - [MCP servers](https://opencode.mintlify.app/mcp.md) - [Migrate from V1](https://opencode.mintlify.app/migrate-v1.md): Move from OpenCode V1 to the OpenCode 2.0 beta. - [Models](https://opencode.mintlify.app/models.md) - [Permissions](https://opencode.mintlify.app/permissions.md) - [Plugins](https://opencode.mintlify.app/plugins.md): Extend OpenCode with plugins. - [Providers](https://opencode.mintlify.app/providers.md) - [References](https://opencode.mintlify.app/references.md) - [SDK](https://opencode.mintlify.app/sdk/index.md): Embed an OpenCode host in an Effect application. - [Session sharing](https://opencode.mintlify.app/sharing.md) - [Skills](https://opencode.mintlify.app/skills.md) - [Undo](https://opencode.mintlify.app/snapshots.md) - [Troubleshooting](https://opencode.mintlify.app/troubleshooting.md): Diagnose OpenCode startup, server, and session issues. ## OpenAPI Specs - [openapi](https://opencode.mintlify.app/openapi.json)