한국어
문서
설정

설정

OpenCode는 커스터마이징을 위해 JSON 설정 시스템을 사용합니다. 설정 스키마는 opencode.ai/config.json에 정의되어 있어 에디터 유효성 검사와 자동완성을 지원합니다.

형식 지원

OpenCode는 JSONJSONC (주석이 있는 JSON) 형식을 모두 지원합니다.

{
  "$schema": "https://opencode.ai/config.json",
  "theme": "opencode",
  "model": "anthropic/claude-sonnet-4-5",
  "autoupdate": true
}

설정 위치 및 우선순위

설정은 대체되지 않고 병합됩니다. 로드 순서 (나중 소스가 충돌 시 우선):

  1. 원격 설정.well-known/opencode의 조직 기본값
  2. 글로벌 설정~/.config/opencode/opencode.json의 사용자 설정
  3. 사용자 정의 설정OPENCODE_CONFIG 환경 변수
  4. 프로젝트 설정 – 프로젝트 루트의 opencode.json
  5. .opencode 디렉토리 – 에이전트, 명령어, 플러그인
  6. 인라인 설정OPENCODE_CONFIG_CONTENT 환경 변수

글로벌 설정

~/.config/opencode/opencode.json에 사용자 전체 설정 배치:

{
  "theme": "catppuccin",
  "model": "anthropic/claude-sonnet-4-5"
}

프로젝트 설정

프로젝트별 설정을 위해 프로젝트 루트에 opencode.json 추가.

사용자 정의 경로

export OPENCODE_CONFIG=/path/to/config.json
opencode run "Hello world"

설정 스키마

TUI 설정

{
  "tui": {
    "scroll_speed": 3,
    "scroll_acceleration": {
      "enabled": true
    },
    "diff_style": "auto"
  }
}

서버 설정

{
  "server": {
    "port": 4096,
    "hostname": "0.0.0.0",
    "mdns": true,
    "cors": ["http://localhost:5173"]
  }
}

도구 설정

{
  "tools": {
    "write": false,
    "bash": false
  }
}

모델 및 프로바이더

{
  "provider": {},
  "model": "anthropic/claude-sonnet-4-5",
  "small_model": "anthropic/claude-haiku-4-5"
}

에이전트

{
  "agent": {
    "code-reviewer": {
      "description": "Reviews code for best practices",
      "model": "anthropic/claude-sonnet-4-5",
      "prompt": "You are a code reviewer...",
      "tools": {
        "write": false,
        "edit": false
      }
    }
  }
}

사용자 정의 명령어

{
  "command": {
    "test": {
      "template": "Run full test suite with coverage report.",
      "description": "Run tests with coverage",
      "agent": "build"
    }
  }
}

권한

{
  "permission": {
    "edit": "ask",
    "bash": "ask"
  }
}

컨텍스트 압축

{
  "compaction": {
    "auto": true,
    "prune": true
  }
}

MCP 서버

{
  "mcp": {}
}

플러그인

{
  "plugin": ["opencode-helicone-session", "@my-org/custom-plugin"]
}

변수 치환

환경 변수

{
  "model": "{env:OPENCODE_MODEL}",
  "provider": {
    "anthropic": {
      "options": {
        "apiKey": "{env:ANTHROPIC_API_KEY}"
      }
    }
  }
}

파일 내용

{
  "provider": {
    "openai": {
      "options": {
        "apiKey": "{file:~/.secrets/openai-key}"
      }
    }
  }
}