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

# Use jusInfer 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 jusInfer a one-line config change.

## Why route OpenCode through jusInfer?

- **Cheaper.** jusInfer 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 jusInfer key

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

### 2. Configure OpenCode

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

```json
{
  "providers": {
    "jusinfer": {
      "type": "openai",
      "base_url": "https://api.jusinfer.com/v1",
      "api_key": "jinf_your_key_here",
      "models": ["jusInfer-auto"]
    }
  },
  "default_provider": "jusinfer",
  "default_model": "jusInfer-auto"
}
```

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

### 3. Run

```sh
opencode
```

Verify spend on your [jusInfer dashboard](https://jusinfer.com/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"
```

jusInfer 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** — jusInfer handles upstream failures internally and retries with a different provider transparently.

## Related

- [Use jusInfer 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)
