4Z API

OpenCode Setup

Install OpenCode first

Official docs

With Node.js

npm install -g opencode-ai

Configure a provider

https://opencode.ai/docs/providers/

Two places to configure
Provider config (create the file if missing)
~ is the user home directory, e.g. C:\Users\admin on Windows
~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "https://4zapi.com/v1"
      }
    }
  }
}

Here we override the existing Anthropic base URL
API key config
Configure a Claude provider key. In the console, create a key and pick a Claude-related group such as Claude Exclusive.
~/.local/share/opencode/auth.json

{
  "google": {
    "type": "api",
    "key": "1111111111111111111"
  },
  "anthropic": {
    "type": "api",
    "key": "sk-xxxxxxxxxxxxx"
  }
}
Open a terminal

image.png

Type /models

image.png

Pick an Anthropic model

image.png

Start using it

image.png