Back to list
serejaris

opencode-config

by serejaris

52🍴 4📅 Jan 23, 2026

SKILL.md


name: opencode-config description: Use when configuring OpenCode CLI - changing default model, adding providers, setting baseURL, or troubleshooting model selection issues

OpenCode Configuration

Overview

OpenCode config is managed via opencode.json. Configs merge by priority: project > global > remote.

Config Locations

LocationPathPriority
Project./opencode.jsonHighest
Global~/.config/opencode/opencode.jsonMedium
Auth~/.local/share/opencode/auth.jsonCredentials only

Quick Reference

{
  "$schema": "https://opencode.ai/config.json",
  "model": "provider/model-name",
  "small_model": "provider/small-model",
  "provider": {
    "provider-id": {
      "options": {
        "baseURL": "https://api.example.com/v1"
      }
    }
  }
}

Adding Custom Provider

For OpenAI-compatible APIs:

{
  "provider": {
    "my-provider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Display Name",
      "options": {
        "baseURL": "https://api.example.com/v1"
      },
      "models": {
        "model-id": {
          "name": "Model Display Name"
        }
      }
    }
  }
}

Example: Z.AI Coding Plan

Different Z.AI products use different baseURLs:

ProviderbaseURLUse Case
zaihttps://api.z.ai/api/paas/v4Regular Z.AI API
zai-coding-planhttps://api.z.ai/api/coding/paas/v4GLM Coding Plan subscription

Config for Coding Plan:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "zai-coding-plan/glm-4.7",
  "small_model": "zai-coding-plan/glm-4-flash",
  "provider": {
    "zai-coding-plan": {
      "options": {
        "baseURL": "https://api.z.ai/api/coding/paas/v4"
      }
    }
  }
}

Modes Configuration

{
  "mode": {
    "build": {
      "model": "anthropic/claude-sonnet-4-5",
      "tools": { "write": true, "edit": true, "bash": true }
    },
    "plan": {
      "model": "anthropic/claude-haiku-4-5",
      "tools": { "write": false, "edit": false, "bash": false }
    }
  }
}

CLI Commands

CommandDescription
/connectAdd provider credentials
/modelsSelect model
opencode auth loginAdd credentials via CLI
opencode auth listList configured providers

Common Mistakes

MistakeFix
Wrong provider for subscriptionCheck if your subscription uses different baseURL
Missing baseURL for custom providerAdd options.baseURL in provider config
Model not appearing in /modelsCheck auth.json has credentials for provider
Wrong model after config changeRestart OpenCode to reload config

Troubleshooting

  1. Check auth: cat ~/.local/share/opencode/auth.json
  2. Check config: cat ~/.config/opencode/opencode.json
  3. Verify model format: provider-id/model-name
  4. Test provider: Run /models and check if provider appears

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon