Developer field guide

OpenCode API & OpenCode vs Claude Code

Looking for a flexible OpenCode API configuration or weighing OpenCode vs Claude Code? OpenCode connects natively to AngelAPI’s OpenAI-compatible gateway in two minutes—letting you switch between DeepSeek, GLM, Kimi, MiniMax, Qwen, and GPT models directly from your terminal with opencode.json and prepaid MYR or USD packs.

Step 1: Install OpenCode & store your AngelAPI credential

npm install -g opencode-ai
opencode

# Inside OpenCode, run:
/connect
# Select:      Other
# Provider ID: angelapi
# API key:     YOUR_ANGELAPI_KEY

Step 2: Configure ~/.config/opencode/opencode.json

Create a global config at ~/.config/opencode/opencode.json (or per-project ./opencode.json) referencing the provider ID angelapi and live online models from the models directory:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "angelapi": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "AngelAPI",
      "options": {
        "baseURL": "https://api.angelapi.cc/v1"
      },
      "models": {
        "glm-5.4": {
          "name": "glm-5.4"
        },
        "deepseek-v4.1-flash": {
          "name": "deepseek-v4.1-flash"
        },
        "kimi-k2.5": {
          "name": "kimi-k2.5"
        }
      }
    }
  }
}

Then run /models inside OpenCode and select any configured model under AngelAPI to start editing files immediately.

OpenCode vs Claude Code comparison

Engineers deciding between OpenCode vs Claude Code usually care most about how effortlessly they can mix multiple open and frontier model families inside daily coding tasks:

Comparison pointOpenCode CLIClaude Code CLI
Gateway endpoint styleNative OpenAI-compatible (https://api.angelapi.cc/v1)Anthropic-compatible (https://api.angelapi.cc)
Credential safety/connect separates secret storage from opencode.jsonUses env vars or ~/.claude/settings.json
Switching model familiesBuilt-in /models picker across configured routesRequires overriding ANTHROPIC_MODEL
Open-source configurabilityFirst-class OSS plugin and per-project config designCustom endpoints supported via gateway compatibility mode

Multi-model workflow strategy in OpenCode

The real advantage of listing three complementary models inside opencode.json is cost control without restarting your terminal. Use DeepSeek V4.1 Flash (×0.0917 est. coding) for quick searches, shell scaffolding, and unit tests; swap via /models to GLM 5.4 (×0.9008 est. coding) or Kimi for large multi-file design refactors—while every call draws cleanly from one shared MYR/USD pack balance. If you ever publish per-project ./opencode.json into Git, keep your real API key strictly inside /connect storage rather than adding plaintext headers inside the file.

Verification, multi-project config, and scripted usage

Before relying on OpenCode for multi-hour coding sprints, run one quick verification flow: inspect loaded provider credentials, confirm target models respond on live status, and test a two-line file creation prompt so you can verify token draw inside your Account Usage log. Keeping project-level./opencode.json files scoped strictly to non-secret model definitions allows your whole engineering team to check clean model presets into Git while every developer injects their personal prepaid AngelAPI key once through /connect.

Developers coming from Anthropic-only workflows often wonder whether OpenCode requires rewriting project docs. Most project instruction Markdown files work across OpenCode, Claude Code, and Cline smoothly because concise coding constraints, repository test commands, and style guidelines help any reasoning model equally. Pair Flash tiers like DeepSeek V4.1 Flash (×0.0917 est. coding) on everyday maintenance tasks with flagship GLM 5.4 or Kimi K3 only when complex architecture asks for heavier capability—cutting overall token draw dramatically across weeks of development. Check all pack options on Pricing or sign up at Create account.

Troubleshooting OpenCode gateway connections

  • Provider auth or 401 errors: Re-run /connect inside OpenCode, verify Provider ID matches angelapi in your opencode.json, and confirm no stale key remains active in Account.
  • Model fails or times out: Check exact spelling of each key under provider.angelapi.models against Status. If a route goes offline upstream, switch immediately with /models.
  • Budget check before deep refactors: Try the RM1.12 starter pack (10M prepaid units) on Pricing and watch live spend inside your account Usage ledger after two coding tasks.
  • Conflicting base URL variables: Verify shell environment overrides are clear if an editor subshell inherited old local proxy settings, and ensure options.baseURL stays pointed cleanly at https://api.angelapi.cc/v1 with no trailing chat path appended.
  • Need media generation from your terminal agent? Pair the same API key with AngelAPI’s hosted MCP connector (https://panel.angelapi.cc/mcp) so image mockups via Nano Banana or video clips via Seedance draw smoothly from the same pack balance without creating additional credentials.

Frequently asked questions

What is OpenCode?

OpenCode is an open-source AI coding CLI built to support multiple OpenAI-compatible and Anthropic-compatible model providers cleanly through one configuration file.

Where does OpenCode store my AngelAPI key?

Running /connect inside OpenCode stores your credential cleanly in OpenCode’s local credential storage while keeping ./opencode.json safe to inspect.

OpenCode vs Claude Code: which is easier with third-party models?

OpenCode treats OpenAI-compatible multi-model gateways as first-class providers out of the box via @ai-sdk/openai-compatible, making GLM, Kimi, and DeepSeek switching effortless.

Related developer guides

Share this guide on Telegram