Chuyển đến nội dung chính
OpenCode là AI coding agent mạnh mẽ có thể được cấu hình để sử dụng models của VibeCodeCheap.

Bước 1: Cài đặt OpenCode

Cách dễ nhất để cài đặt OpenCode là thông qua install script.
curl -fsSL https://opencode.ai/install | bash
Bạn cũng có thể cài đặt với npm:
npm install -g opencode-ai

Bước 2: Cấu hình Custom Provider

  1. Truy cập VibeCodeCheap API Console để lấy API key.
  2. Chạy opencode auth login và cuộn xuống chọn Other để tạo custom provider.
$ opencode
opencode auth login
 Add credential

 Select provider
 ...
 Anthropic

  1. Nhập VibeCodeCheap API key của bạn.
 Add credential

 Enter your API key
 lm_...

  1. Tạo hoặc cập nhật file cấu hình opencode.json:
    • Global config (~/.config/opencode/opencode.json) - cấu hình người dùng
    • Project config (opencode.json trong thư mục project) - cấu hình riêng cho project
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "anthropic": {
      "options": {
        "baseURL": "https://api.vibecodecheap.com/v1/ai/v1"
      }
    }
  }
}
Xem Models để biết tất cả models có sẵn.
  1. Chạy opencode và sử dụng lệnh /models để chọn Claude Opus 4.5 hoặc Claude Sonnet 4.5 trong Anthropic.
KHÔNG chọn “Claude Opus 4.5 (latest)” hoặc “Claude Sonnet 4.5 (latest)” - đây là các model mặc định của Anthropic và sẽ không sử dụng API của VibeCodeCheap.
$ opencode
/models

Share

Tính năng share của OpenCode cho phép bạn tạo public links đến conversations, giúp cộng tác với teammates hoặc nhận trợ giúp từ người khác.

Cách hoạt động

Khi bạn share một conversation, OpenCode:
  1. Tạo unique public URL cho session của bạn
  2. Sync conversation history lên servers
  3. Làm conversation có thể truy cập qua shareable link — opencode.ai/s/<share-id>

Share

Mặc định, conversations không được share tự động. Bạn có thể share thủ công bằng lệnh /share:
/share

Un-share

Để ngừng share conversation và xóa khỏi public access:
/unshare

IDE Extensions

OpenCode tích hợp với VS Code, Cursor, hoặc bất kỳ IDE nào hỗ trợ terminal.

Installation

Để cài đặt OpenCode trên VS Code và các forks phổ biến như Cursor, Windsurf, VSCodium:
  1. Mở VS Code
  2. Mở integrated terminal
  3. Chạy opencode - extension tự động cài đặt

Usage

  • Quick Launch: Sử dụng Cmd+Esc (Mac) hoặc Ctrl+Esc (Windows/Linux) để mở OpenCode trong split terminal view.
  • New Session: Sử dụng Cmd+Shift+Esc (Mac) hoặc Ctrl+Shift+Esc (Windows/Linux) để bắt đầu session mới.
  • Context Awareness: Tự động share selection hoặc tab hiện tại với OpenCode.
  • File Reference Shortcuts: Sử dụng Cmd+Option+K (Mac) hoặc Alt+Ctrl+K (Linux/Windows) để insert file references. Ví dụ @File#L37-42.

GitHub Workflow

OpenCode tích hợp với GitHub workflow. Mention /opencode hoặc /oc trong comment, và OpenCode sẽ thực thi tasks trong GitHub Actions runner.

Features

  • Triage issues: Yêu cầu OpenCode xem xét issue và giải thích.
  • Fix and implement: Yêu cầu OpenCode fix issue hoặc implement feature. OpenCode sẽ làm việc trong branch mới và submit PR với tất cả changes.
  • Secure: OpenCode chạy bên trong GitHub runners của bạn.

Installation

Chạy lệnh sau trong project có GitHub repo:
opencode github install

Examples

  • Explain an issue: Thêm comment này trong GitHub issue.
    /opencode explain this issue
    
  • Fix an issue: Trong GitHub issue:
    /opencode fix this
    
  • Review PRs and make changes: Comment trên GitHub PR.
    Delete the attachment from S3 when the note is removed /oc
    

Resources