Journalguides

Field guide / 6 min read

How to use ISH API with OpenCode

A practical OpenCode setup guide for api.ish.chat, including provider config, model names, streaming checks, and usage tracking.

Aug 21, 20266 min readBy ISH Team
How to use ISH API with OpenCode
Advertisement

OpenCode works well with ISH because it can use an OpenAI-compatible provider. That means you can point OpenCode at api.ish.chat, choose an ISH model, and keep usage visible in the same API dashboard as your other connector traffic.

This guide gives you the practical setup, the config shape, and the common fixes when OpenCode seems to hang or cannot find a model.

What you need

Before changing OpenCode, make sure you have:

  • An ISH account.
  • Purchased API balance. Connector/API calls do not spend the free daily chat balance.
  • An API key from api.ish.chat/keys.

Keys start with ish_live_. Copy the key when you create it, because the full value is shown only once.

Use the OpenAI-compatible endpoint

OpenCode should use:

https://api.ish.chat/v1

This is different from Claude Code. Claude Code uses the Anthropic-compatible origin without /v1, but OpenCode’s OpenAI-compatible provider should include /v1.

Create or edit:

~/.config/opencode/opencode.json

You can also keep a project-level opencode.json in a repo when you want one project to use ISH and another project to use a different provider.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "ish/claude-sonnet-4.6",
  "small_model": "ish/claude-haiku-4.5",
  "provider": {
    "ish": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "ISH API",
      "options": {
        "baseURL": "https://api.ish.chat/v1"
      },
      "models": {
        "claude-haiku-4.5": {
          "name": "Claude Haiku 4.5",
          "limit": {
            "context": 200000,
            "output": 8192
          }
        },
        "claude-sonnet-4.6": {
          "name": "Claude Sonnet 4.6",
          "limit": {
            "context": 200000,
            "output": 8192
          }
        },
        "claude-opus-4.8": {
          "name": "Claude Opus 4.8",
          "limit": {
            "context": 200000,
            "output": 8192
          }
        }
      }
    }
  }
}

The ish/... prefix keeps the OpenCode model list tidy. ISH maps that to the canonical model ID before routing.

Add your API key

If you use OpenCode auth storage, add the key under the same provider ID:

{
  "ish": {
    "type": "api",
    "key": "ish_live_your_key_here"
  }
}

If you prefer environment variables, export the OpenAI-style values before starting OpenCode:

export OPENAI_API_KEY="ish_live_your_key_here"
export OPENAI_BASE_URL="https://api.ish.chat/v1"

Restart OpenCode after changing either config or auth. A half-reloaded config is one of the easiest ways to waste time debugging.

Verify inside OpenCode

Start OpenCode:

opencode

Open the model picker:

/models

Pick:

ish/claude-sonnet-4.6

Then send a tiny prompt:

Reply exactly: ISH_OK

After it completes, open api.ish.chat/usage. You should see the request, model, input usage, output usage, charged amount, and status.

Supported model names

For OpenCode, these are good defaults:

OpenCode modelRouted model
ish/claude-haiku-4.5claude-haiku-4.5
ish/claude-sonnet-4.6claude-sonnet-4.6
ish/claude-opus-4.8claude-opus-4.8

You can also use canonical model IDs directly, such as claude-sonnet-4.6. The ish/... form is just cleaner when you have multiple providers in OpenCode.

Test with curl

If OpenCode is not responding, test the endpoint directly:

curl https://api.ish.chat/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-haiku-4.5",
    "messages": [
      { "role": "user", "content": "Reply exactly: ISH_OK" }
    ],
    "max_tokens": 64
  }'

If curl works but OpenCode does not, the key and endpoint are fine. Look at local config loading, provider ID mismatch, or a stale OpenCode process.

Streaming notes

OpenCode may wait a few seconds before the first visible token, especially on heavier models or larger project context. That does not always mean streaming is broken.

Check the API dashboard:

  • If no request appears, OpenCode did not reach ISH.
  • If a request appears and succeeds, ISH received it and charged it.
  • If a request appears with an error, the status row will usually tell you whether it was auth, balance, model, or upstream failure.

Common errors

OpenCode loops or shows no response

Make sure the provider ID is the same everywhere. If your provider is called ish, the model should look like ish/claude-sonnet-4.6 and the auth entry should also be under ish.

Then quit OpenCode fully and start it again.

Model not found

Use a known model:

ish/claude-sonnet-4.6

or:

claude-sonnet-4.6

Avoid old aliases from other services. ISH supports its own model IDs and common ISH aliases.

401 authentication error

The key is missing, revoked, or copied incorrectly. Generate a fresh key from api.ish.chat/keys, update your OpenCode auth, and restart.

Insufficient balance

Add balance from the API dashboard. OpenCode is connector/API usage, so it does not spend free daily web usage.

Why the dashboard matters

Coding agents can send more context than the prompt you typed. A simple request can include project instructions, selected files, tool results, and previous conversation state.

ISH logs the request so you can see what happened instead of guessing from a local CLI session total. That is the real advantage of routing OpenCode through a proper API dashboard: fewer mystery charges, fewer invisible retries, and a cleaner audit trail.

Useful links:

#ish-api#opencode#coding-agents#developer-tools
Advertisement

Keep reading

Related stories

Browse the archive