OpenCode icon

OpenCode

Interact with OpenCode Server API for AI coding assistant sessions

Message → Send Async

AI-generated

Summary

Fire-and-forget message send to OpenCode without awaiting model response; returns immediately with acceptance status and session metadata.

Inputs

  • sessionMode — Choose how to handle sessions: 'existing' uses a selected session; 'temporary' creates a new session deleted after the API call. Default: 'existing'.
  • sessionId (required) — Select a session for messaging (required when sessionMode is 'existing'). Loaded via getSessions.
  • tempSessionTitle — Title for temporary sessions (for debugging purposes). Default: 'Temporary Chat Session'. Only shown when sessionMode is 'temporary'.
  • message (required) — The message to send. Type: string; UI: rows=4.
  • model — Select a model (optional, uses default if not specified). Format: providerID::modelID maps to payload.model object.
  • referencedFiles — Select files to reference in the message (prepended as @filename). Type: multiOptions; loaded via getFiles.
  • timeout — Request timeout in milliseconds. Default: 300000 (5 minutes).
  • agent — Agent to use for processing the message (optional). Loaded via getAgents.
  • messageID — Reference message ID for context (optional). Default: ''.
  • system — System prompt to prepend to the message (optional). Type: string; UI: rows=4.
  • noReply — Whether to skip waiting for a response (fire and forget). Default: false.
  • tools — Tool definitions in JSON format (optional). Type: string; UI: rows=4; placeholder: '[{...}]'.

Output shape

object

Returns immediately without the model's response text. Temporary sessions are deleted in a finally block after the API call. Session is deleted if temporary mode was used. The returned JSON does not include response text, trim status, or responseKey-wrapped output (these are not consumed by sendAsync per source). Example return: { success: true, message: 'Message sent successfully (async)', sessionId: '...', wasTemporarySession: true/false }.

Links

Discussion