Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

opencode-alibaba-qwen-cli-auth

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

opencode-alibaba-qwen-cli-auth

Alibaba Qwen OAuth authentication plugin for opencode - use your Qwen account instead of API keys

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

opencode-alibaba-qwen-cli-auth

npm version Tests

Plugin OAuth cho OpenCode để dùng mô hình Qwen qua tài khoản Qwen, không cần tự quản lý DashScope API key.

Mục tiêu và phạm vi

  • Dùng OAuth Device Authorization Grant (RFC 8628) để đăng nhập tài khoản Qwen.
  • Tối ưu cho nhu cầu phát triển cá nhân.
  • Không thay thế mô hình triển khai production/commercial bằng DashScope API key.

Lưu ý tuân thủ

Khi dùng plugin này, bạn tự chịu trách nhiệm tuân thủ các chính sách của Qwen/Alibaba:

Nếu bạn cần môi trường production hoặc thương mại, nên dùng DashScope API key: https://dashscope.console.aliyun.com/

Tính năng chính

  • Xác thực OAuth qua opencode auth login.
  • Tự động làm mới token trước khi hết hạn (đệm 5 phút).
  • Dùng resource_url từ token để xác định API base URL động, có fallback an toàn.
  • Chuẩn hóa model về coder-model khi gửi lên Qwen Portal API.
  • Hỗ trợ QWEN_MODE để điều chỉnh cách bridge prompt giữa OpenCode và Qwen.
  • Hỗ trợ debug và request logging qua biến môi trường.
  • Chuẩn hóa stream SSE về dạng OpenAI-compatible chunks.

Yêu cầu

  • Tài khoản Qwen.
  • OpenCode.
  • Node.js >=20 (nếu bạn build/test package từ source).

Cài đặt nhanh

Thêm plugin vào file cấu hình OpenCode:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-alibaba-qwen-cli-auth"],
  "model": "alibaba/coder-model"
}

Sau đó chạy đăng nhập:

opencode auth login

Chọn Alibaba -> Qwen Account (OAuth).

Sử dụng

opencode run "tạo file hello world" --model=alibaba/coder-model
opencode chat --model=alibaba/coder-model

Lưu ý: luôn dùng tiền tố provider alibaba/ trong cấu hình model của OpenCode.

Cấu hình nâng cao

QWEN_MODE

Ưu tiên cấu hình:

  • Biến môi trường QWEN_MODE
  • File ~/.opencode/qwen/auth-config.json
  • Mặc định true

Ví dụ file ~/.opencode/qwen/auth-config.json:

{
  "qwenMode": true
}

Giá trị hợp lệ qua env:

  • Bật: QWEN_MODE=1 hoặc QWEN_MODE=true
  • Tắt: QWEN_MODE=0 hoặc QWEN_MODE=false

Logging và debug

  • Bật debug log:
DEBUG_QWEN_PLUGIN=1 opencode run "your prompt"
  • Bật log request chi tiết ra file:
ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode run "your prompt"

Đường dẫn log: ~/.opencode/logs/qwen-plugin/

Dữ liệu cục bộ plugin

  • Token OAuth: ~/.opencode/qwen/oauth_token.json
  • Cấu hình plugin: ~/.opencode/qwen/auth-config.json
  • Cache prompt: ~/.opencode/cache/

Khắc phục sự cố

Authentication required. Please run: opencode auth login

Token không tồn tại hoặc refresh thất bại. Chạy lại:

opencode auth login

Lỗi hết thời gian xác thực thiết bị

Quá trình xác thực device code đã timeout hoặc code đã hết hạn. Chạy lại opencode auth login và xác nhận trong trình duyệt sớm hơn.

Lỗi 429 (rate limit)

Server đang giới hạn tần suất. Giảm tốc độ gửi request và thử lại sau.

Model không chạy đúng

Kiểm tra bạn đang dùng đúng model trong OpenCode:

model: alibaba/coder-model

Làm sạch trạng thái xác thực

  • macOS/Linux:
rm -rf ~/.opencode/qwen/
  • PowerShell:
Remove-Item -Recurse -Force "$HOME/.opencode/qwen"

Sau đó đăng nhập lại bằng opencode auth login.

Dành cho phát triển package

npm run build
npm run typecheck
npm run test
npm run lint

Liên kết

Giấy phép

MIT

Keywords

opencode

FAQs

Package last updated on 22 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts