GitLab Duo
Sử dụng GitLab Duo AI-powered agentic chat với OpenCode.
Tổng quan
GitLab Duo cung cấp AI-powered agentic chat với native tool calling capabilities thông qua Anthropic proxy của GitLab.
OpenCode hỗ trợ kết nối GitLab Duo qua:
- OAuth (khuyến nghị)
- Personal Access Token
Kết nối
Cách 1: Dùng /connect (dễ nhất)
/connect
Chọn GitLab và làm theo hướng dẫn.
Cách 2: Environment variables
export GITLAB_TOKEN=glpat-your-token
Models
Sau khi kết nối, bạn có thể dùng các models:
| Model | Mô tả |
|---|---|
duo-chat-haiku-4-5 | Phản hồi nhanh, tasks đơn giản |
duo-chat-sonnet-4-5 | Cân bằng cho hầu hết workflows |
duo-chat-opus-4-5 | Mạnh nhất, phân tích phức tạp |
Self-Hosted GitLab
Cho GitLab self-hosted instance:
export GITLAB_INSTANCE_URL=https://gitlab.company.com
export GITLAB_TOKEN=glpat-...
Nếu dùng custom AI Gateway:
export GITLAB_AI_GATEWAY_URL=https://ai-gateway.company.com
OAuth cho Self-Hosted
Tạo Application trong Settings → Applications với callback URL http://127.0.0.1:8080/callback và scopes: api, read_user, read_repository.
export GITLAB_OAUTH_CLIENT_ID=your_application_id
GitLab API Tools (Plugin)
Để truy cập GitLab tools (MR, issues, pipelines):
{
"plugin": ["@gitlab/opencode-gitlab-plugin"]
}
Plugin cung cấp: MR reviews, issue tracking, pipeline monitoring.