---
title: Use jusCode with OpenCode
description: Configure SST's OpenCode terminal agent to use jusCode for cheaper, model-agnostic coding.
tldr: Add jusCode as a custom "openai" provider in ~/.opencode/config.json with base_url https://api.juscode.co/v1 and your jcg_ key. Set jusCode-auto as the default model.
slug: opencode
order: 2
updated: 2026-05-25
---

# Use jusCode with OpenCode

[OpenCode](https://opencode.ai) is an open-source terminal coding agent from SST, Claude Code's open-source cousin. It supports any OpenAI-compatible endpoint, which makes jusCode a one-line config change.

## Why route OpenCode through jusCode?

- **Cheaper.** jusCode picks the most cost-effective capable model per call. You stop paying frontier prices for tasks that don't need it.
- **Same UX.** OpenCode behaves identically: autocomplete, edits, multi-file refactors all work.
- **Vendor-independent.** Switch underlying models without touching OpenCode config.

## 30-second setup

### 1. Mint a jusCode key

Sign in at [juscode.co/login](https://juscode.co/login) → [dashboard](https://juscode.co/developer) → **Keys** tab → **Mint key** → copy the `jcg_…` token (shown once).

### 2. Configure OpenCode

OpenCode reads provider config from `~/.opencode/config.json`. Add jusCode as a custom OpenAI-compatible provider:

```json
{
  "providers": {
    "juscode": {
      "type": "openai",
      "base_url": "https://api.juscode.co/v1",
      "api_key": "jcg_your_key_here",
      "models": ["jusCode-auto"]
    }
  },
  "default_provider": "juscode",
  "default_model": "jusCode-auto"
}
```

The model name `jusCode-auto` is a virtual identifier; jusCode picks the actual underlying model. You can also pass any provider-prefixed model id (e.g. `anthropic/claude-sonnet`) and jusCode will honor it.

### 3. Run

```sh
opencode
```

Verify spend on your [jusCode dashboard](https://juscode.co/developer) → Usage tab.

## Pinning a specific model

If you want to override the auto-selector for a session:

```sh
opencode --model "anthropic/claude-sonnet-4.5"
# or
opencode --model "openai/gpt-5"
```

jusCode normalizes provider prefixes; you don't need accounts at each upstream provider.

## What works

- ✅ Streaming responses
- ✅ Tool use (OpenCode's edit / shell / read primitives)
- ✅ Multi-file context
- ✅ System prompts
- ✅ Image inputs (auto-routes to vision-capable model)

## Limits

- **60 RPM** per key, **600 RPM** per tenant (raisable in dashboard)
- **No model fallback at the SDK level.** jusCode handles upstream failures internally and retries with a different provider transparently.

## Uninstall

Remove the jusCode provider from your OpenCode config in one command:

```sh
curl -fsSL https://juscode.co/install/uninstall.sh | sh      # macOS · Linux · WSL
irm https://juscode.co/install/uninstall.ps1 | iex           # Windows PowerShell
```

It removes the `juscode` provider from `~/.opencode/config.json` (and points you to your `config.json.juscode-bak` backup if one exists). OpenCode stays installed. Full details: [Uninstall jusCode](/docs/uninstall/).

## Related

- [Use jusCode with Claude Code](/docs/claude-code/)
- [OpenAI-compatible drop-in for any harness](/docs/openai-drop-in/)
- [API reference](/docs/api-reference/)

---

*Agent-readable raw markdown:* [/docs/opencode.md](/docs/opencode.md)
