Skip to main content

OpenCode

The OpenCode app launches a detachable remote VS Code session pre-configured with OpenCode's CLI, ready to use as soon as the session starts.

The OpenCode app offers workspace management features, allowing you to store, sync, and restore interactive workspaces across sessions. This ensures your work, including ~/.config/opencode session state, is preserved and can be easily accessed in future sessions.

The OpenCode session is set up using a Klique Orchestrator. When configuring an app instance, select a queue, and the Klique Orchestrator servicing that queue will set up the remote environment. When setup is complete, the instance dashboard displays the session ID and a link to open the VS Code session with OpenCode ready to use.

Token usage for the session is metered by an outbound proxy and reported back to the parent task, so consumption is visible in the instance dashboard's LLM usage charts regardless of which AI provider is used. Routing calls through the LLM Gateway (the default; see Profile below) additionally surfaces the session's usage in the AI Usage Dashboard and lets administrators enforce wallet budgets and rate limits on it.

The application monitors the session's LLM token activity and shuts down if it is inactive for a specified maximum idle time.

Klique MCP Server

This session comes pre-connected to the Klique MCP server, with its tools and built-in skills already available. Ask OpenCode to work with your Klique projects, tasks, models, and apps directly, with no manual connection or installation step.

App Insights​

The App insights section of an OpenCode instance's dashboard shows:

  • Status indicator
    • Active instance - App instance is running and is actively in use
    • Loading instance - App instance is setting up
    • Idle instance - App instance is idle
    • Stopped instance - App instance is stopped
  • Idle time, and the idle time after which the instance automatically stops
  • Restored Workspace - If a previous session's workspace was restored, this displays that session's ID
  • Session - The current session ID, with a link to the instance's console log
  • Open OpenCode - Link to the VS Code session with OpenCode ready to use. Click Copy link to copy the link.
  • LLM usage over time:
    • LLM Input Tokens
    • LLM Output Tokens
    • LLM Requests (cumulative)
    • LLM Latency (ms)
  • Resource utilization over time:
    • Monitoring CPU
    • Monitoring GPU
  • Console Log - The console log shows the instance's activity, including setup progress, status changes, and error messages
Embedding Visualizations

You can embed plots from App insights into Reports. Klique also supports embedding resources in third-party platforms that support embedded content (e.g. Notion). These visualizations are updated live as the app instance(s) updates. Hover over the plot and click Embed code to copy the embed code, and navigate to a report to paste the embed code.

Configuration​

To launch an instance, see Launching an Instance. The launch form has the following fields by default. Administrators can customize field names, options, and defaults.

  • Session Name - Name for the app instance. This will appear in the instance list. Leave blank to auto-generate.
  • Compute Resource – The Queue serviced by the Klique Orchestrator that will run the OpenCode session.
  • OpenCode Session Project - The project where the app instance is created. Type a name to create a new project, or select an existing one.
  • Model
    • I already have an API key in my Vault - Call OpenCode's service directly using an OPENCODE_API_KEY stored in your User Vault, without entering a key in the form. The session fails at launch if the key is not in the vault.
    • Force direct OpenCode Service access - Call OpenCode's service directly instead of through the LLM Gateway, using the key provided in OpenCode API Key.
    • Profile - The LLM Gateway Profile to route model calls through. The session uses the Profile's default model. Required unless the session calls OpenCode's service directly.
    • OpenCode API Key - The API key for direct OpenCode access.
    • Update OpenCode at Session Start - When enabled, updates the OpenCode CLI to the latest version when the session starts. Requires internet access; without it, the session keeps the image-baked version. When disabled, the session pins to the image-baked version.
  • Git Access - Optional overrides for the Git identity and credentials used in the session. Leave a field blank to use the value from your User Vault.
    • Git Display Name - Git's global user.name for commits
    • Git Display Email - Git's global user.email for commits
    • Git Username - Username for Git access
    • Git Personal Access Token / App Password - Token for Git access
  • Advanced
    • Restore Workspace from Previous Session (Session-ID) - Select a previous OpenCode session to restore its workspace. Leave blank for a fresh start. On relaunch, this is prefilled with the current session ID.
    • Container Image - Base runtime image for the session container. Every option includes Python and Node.js: Default adds Rust and Go, and Rust and Go add a single language. Type any other image reference to use a custom container; it must have the OpenCode CLI, Node.js, and code-server pre-installed.
    • Environment Variables - One KEY=value per line. Injected into every shell inside the session via /etc/profile.d/opencode.sh. Lines starting with # are ignored.
    • Persistent Workspace Path - Directory snapshotted when the session closes and restored when a new session restores this one. Defaults to ~/, so dotfiles, ~/.config/opencode state, and cloned repos all persist across sessions. Leave blank for an ephemeral session.
    • Workspace Store Timeout (Minutes) - Maximum time allowed to store the workspace when the session closes. Applies only when a Persistent Workspace Path is set.
    • Idle Shutdown (Hours) - Maximum idle time after which the app instance shuts down. Select None to disable.
    • Init Script - Bash script that runs once when the instance boots
  • Share Access - The user groups to share the app instance with. Leave empty to keep the instance visible only to you and tenant administrators. See Sharing an Instance.