# OpenCode Models for Raycast

URL: https://www.raycast.com/intellectronica/opencode-models

> Use AI models from your local OpenCode installation in Raycast AI Chat, Quick AI, and AI Commands.

- Install: raycast://extensions/intellectronica/opencode-models
- Author: [Eleanor Berger](https://www.raycast.com/intellectronica)
- Installs: 3
- Platforms: macOS
- Categories: Developer Tools, Productivity
- Updated: 2026-12-03
- Source: https://github.com/raycast/extensions/tree/e96213e3329793b3fb8f490e208d2d866132f464/extensions/opencode-models/

## Commands

- **Manage Models**: Browse, enable, or disable models from your local OpenCode installation and check service status
- **Refresh Models**: Reload available AI models from your local OpenCode installation

## README

### OpenCode Models

Use AI models configured in your local **OpenCode (`>= 2.0`)** installation inside Raycast AI Chat, Quick AI, and AI Commands — with full support for Raycast AI Extensions tool calling, prompt caching, vision attachments, reasoning effort variants, and clean Raycast system prompts.

#### How This Compares to the OpenCode Extension

| Feature | OpenCode (existing Store extension) | OpenCode Models (this extension) |
| :--- | :--- | :--- |
| **Backend** | OpenCode Console cloud endpoint + API key | Your local OpenCode (`>= 2.0`) installation & providers |
| **Setup** | Requires OpenCode Console API key | Zero-config auto-discovery of local `opencode serve --service` |
| **Providers** | OpenCode Console catalog only | Every provider configured in OpenCode (GitHub Copilot, OpenCode Go, xAI, Anthropic, OpenAI, Ollama, LM Studio, custom endpoints, etc.) |
| **Tool Calling & Caching** | Standard OpenAI-compatible chat endpoint | Full client-executed Raycast AI Extensions loop + OpenCode session prompt caching |

#### Requirements

- **OpenCode CLI `>= 2.0`** installed and configured with at least one enabled provider.
- **macOS** with a **Raycast Pro plan** (required for extension-provided models).

#### Setup

1. Install OpenCode 2.0+ and authenticate one or more providers (e.g. `opencode auth` / `opencode models`).
2. Install **OpenCode Models** in Raycast.
3. Open **Quick AI** or **AI Chat**, click the model picker, and select any model formatted as **`Model Name (Provider)`**.

No manual configuration is required. If the OpenCode background service (`opencode serve --service`) is not already running, the extension automatically finds your `opencode` binary and starts it on demand.

#### How It Works (Architecture & Privacy)

When you run a completion in Raycast:

1. The extension connects to your local OpenCode service using `@opencode/client/service` (or starts `opencode serve --service` if enabled).
2. Inside Raycast's own private support directory (`<supportPath>/opencode-workspace/`), the extension creates a minimal isolated workspace containing `.opencode/plugins/`.
   - **Your normal OpenCode config is never modified**: it never writes to `~/.config/opencode/` or any git repository.
   - Because OpenCode discovers workspace plugins strictly per workspace directory, normal OpenCode TUI/Desktop/CLI sessions outside this workspace are completely unaffected.
3. For each Raycast turn, the location-local bridge plugin:
   - Replaces OpenCode's coding-agent system prompt and global `AGENTS.md` with Raycast's own `request.system` prompt and `temperature`.
   - Exposes **only** the Raycast AI Extension tools requested for that turn (under namespace `rc` with all built-in OpenCode filesystem/shell tools explicitly denied via session permissions).
   - Parks tool calls live via OpenCode RPC while Raycast executes the tools client-side (including any confirmation prompts), then resumes the exact same OpenCode session so **prompt caching** (`cache.read` / `promptCacheKey` / session affinity) and provider reasoning state are preserved across tool loops and multi-turn chats.
4. Sessions are created with an explicit title (preventing unnecessary title-generation requests), tagged `source: "raycast-opencode-models"`, automatically archived once idle so your OpenCode session list stays uncluttered, and garbage-collected after 24 hours (or capped at 50 sessions).

#### Commands

- **Manage Models**: Inspect OpenCode service health and bridge plugin status, search/filter models by provider or enabled state, toggle individual models or entire providers (useful if you already expose a provider through another Raycast extension), view pricing/context/capabilities, clean up cached Raycast sessions, or start the local OpenCode service.
- **Refresh Models**: Re-fetch enabled models from OpenCode and immediately refresh Raycast's model picker.

#### Extension Preferences

All preferences are optional:

- **OpenCode CLI Path**: Explicit path to the `opencode` executable (leave blank for automatic detection across Homebrew, `~/.opencode/bin`, `~/.local/bin`, `~/.bun/bin`, and `PATH`).
- **Server URL**: Connect to a custom or remote `opencode serve` URL instead of local service discovery. *(Note: local workspace bridge features require the server to be able to read `<supportPath>/opencode-workspace`.)*
- **Server Password**: Basic Auth password when using a custom Server URL.
- **Auto-Start Service**: Automatically run `opencode serve --service` when no local `>= 2.0` service is running (enabled by default).

#### Troubleshooting

- **OpenCode CLI not found**: Verify `opencode --version` outputs `2.x` in Terminal, or set **OpenCode CLI Path** to `which opencode`.
- **Newly added models do not appear**: Run **Refresh Models** from Raycast.
- **Resetting Raycast session state**: Run **Clean up Raycast Sessions** inside **Manage Models**.
