---
title: Working with OpenCode
description: Use the providers you have signed in to with the OpenCode CLI as AI providers in Octarine.
---

OpenCode is an open-source coding agent that can connect to many model providers. In Octarine, it can act as an AI provider for the Writing Assistant and Ask Octarine. Any provider you have signed in to with OpenCode becomes available in Octarine without pasting its API key again.

> OpenCode support requires a Pro License in Octarine.

## When To Use OpenCode

Use OpenCode when you already manage several model providers through it, or want to use a provider or subscription that OpenCode supports and Octarine does not offer directly.

It is a good fit for:

- Reaching many providers and models from one sign-in place.
- Asking broad questions in Ask Octarine that need the full agent path.
- Keeping credentials in the OpenCode CLI instead of adding each provider key to Octarine.

If you only need a single provider with an API key, configure it directly in [Configuring AI](/working-with-ai/setting-things-up) instead.

## Step 1: Install OpenCode

Install the OpenCode CLI using the official instructions:

[OpenCode installation](https://opencode.ai/docs/)

After installation, make sure the `opencode` command is available from your terminal.

```bash
opencode --version
```

Octarine looks for `opencode` on your `PATH` and in the usual install locations, including `~/.opencode/bin`, `~/.local/bin`, Homebrew, Bun, and global npm folders.

## Step 2: Connect Providers

Sign in to one or more providers from your terminal:

```bash
opencode auth login
```

OpenCode asks which provider to connect and how to authenticate. Run the command again to add more providers.

You can also start sign-in from Octarine: open **Settings -> AI -> Accounts -> OpenCode** and click **Open OpenCode login**. Octarine opens a terminal window running the same command.

See OpenCode's [provider docs](https://opencode.ai/docs/providers/) for the providers it supports and how each one signs in.

## Step 3: Connect OpenCode In Octarine

Open **Settings -> AI -> Accounts** and choose **OpenCode**.

Octarine reads which providers OpenCode has credentials for. You do not paste API keys into Octarine; credentials stay with the OpenCode CLI.

Click **Refresh status**. When at least one provider is connected, the page shows a **Connected** badge and lists the connected providers. If the page says the CLI was not found or is not signed in, finish the earlier steps and refresh again.

## Step 4: Pick An OpenCode Model

Once OpenCode is connected, Octarine lists the models OpenCode reports, written as `provider/model`, under **OpenCode** in the model picker. Choose one from the Ask Octarine model selector or the Writing Assistant's model menu.

## Using OpenCode With Ask Octarine

OpenCode models are treated as tool-capable in Ask Octarine, so they can use the full agent flow: search notes, read relevant files, follow links, and answer from the workspace context they gathered. How well this works depends on the model you choose; pick a model that handles tool calls reliably.

This is useful for messy questions such as:

- "What did I decide about the launch plan across my project and daily notes?"
- "Find the thread where I changed my mind about pricing."
- "Create a short brief from @Projects/Mobile and last week's Daily Desk."

Web search is not available with OpenCode models. Use a provider that supports it when your question needs current outside context.

## Using OpenCode With Writing Assistant

In the Writing Assistant, OpenCode can rewrite the text you selected. The inline tool does not add `@` mentions or web search; use Ask Octarine when the request needs workspace context.

Each request starts an OpenCode process, so very short edits can feel slower than with a direct API provider.

## What Octarine Runs

Octarine runs every OpenCode request in an isolated temporary environment:

- Octarine copies only your OpenCode sign-in credentials into it.
- Your OpenCode configuration, agents, plugins, and MCP servers are not loaded.
- OpenCode's built-in tools, such as file editing and shell commands, are denied.
- Ask Octarine's own tools are the only tools available, and they follow the same workspace access, exclusions, and write approval as any other provider.

## Troubleshooting

If OpenCode does not connect:

- Make sure the `opencode` command works in your terminal.
- Run `opencode auth login` and connect at least one provider, then click **Refresh status** in Octarine.
- Run `opencode models` in your terminal to check which models OpenCode can see.
- Update OpenCode if your local version is old.
- Restart Octarine after installing OpenCode, especially if Octarine was already open.

Available models depend on the providers you connect in OpenCode and their plans. For current setup details, use the [OpenCode docs](https://opencode.ai/docs/).

#### Quick Answers

### Can Octarine use OpenCode as an AI provider?

Yes. Octarine can use the providers you have signed in to with the OpenCode CLI for Writing Assistant and Ask Octarine.

### Do I need to paste API keys for OpenCode providers?

No. Sign in with `opencode auth login`, and Octarine uses those credentials through the OpenCode CLI.

### Does Octarine use my OpenCode configuration or plugins?

No. Octarine runs OpenCode in an isolated environment with only your sign-in credentials. Your configuration, agents, plugins, and MCP servers are not loaded.

### What should I try if OpenCode does not connect?

Make sure the `opencode` command works in your terminal, run `opencode auth login` to connect a provider, refresh status in Octarine, and restart Octarine if you installed OpenCode while it was open.
