@melodyoftears/opencode-qwen-auth 1.3.1 โ†’ 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +163 -185
  2. package/README.zh-CN.md +61 -54
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,194 +1,172 @@
1
- # ๐Ÿค– Qwen Code OAuth Plugin for OpenCode
2
-
3
- ![npm version](https://img.shields.io/npm/v/%40melodyoftears%2Fopencode-qwen-auth)
4
- ![License](https://img.shields.io/github/license/1579364808/opencode-qwen-auth)
5
- ![GitHub stars](https://img.shields.io/github/stars/1579364808/opencode-qwen-auth)
6
-
7
- <p align="center">
8
- <img src="assets/screenshot.png" alt="OpenCode with Qwen Code" width="800">
9
- </p>
10
-
11
- **Authenticate OpenCode CLI with your qwen.ai account.** This plugin enables you to use Qwen OAuth models (`coder-model` and `vision-model`) with **2,000 free requests per day** - no API key or credit card required!
12
-
13
- [๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ๆ–‡ๆกฃ](./README.zh-CN.md)
14
-
15
- ## โœจ Features
16
-
17
- - ๐Ÿ” **OAuth Device Flow** - Secure browser-based authentication (RFC 8628)
18
- - โšก **Automatic Polling** - No need to press Enter after authorizing
19
- - ๐Ÿ†“ **2,000 req/day free** - Generous free tier with no credit card
20
- - ๐Ÿง  **1M context window** - Models with 1 million token context
21
- - ๐Ÿ”„ **Auto-refresh** - Tokens renewed automatically before expiration
22
- - ๐Ÿ”— **qwen-code compatible** - Reuses credentials from `~/.qwen/oauth_creds.json`
23
-
24
- ## ๐Ÿ“‹ Prerequisites
25
-
26
- - [OpenCode CLI](https://opencode.ai) installed
27
- - A [qwen.ai](https://chat.qwen.ai) account (free to create)
28
-
29
- ## ๐Ÿš€ Installation
30
-
31
- ### 1. Install the plugin
32
-
33
- ```bash
1
+ # OpenCode Qwen Auth Plugin
2
+
3
+ Authenticate OpenCode CLI with your qwen.ai account using OAuth Device Flow. This plugin enables you to use Qwen AI models (`coder-model` and `vision-model`) with free daily quota - no API key or credit card required.
4
+
5
+ [ไธญๆ–‡ๆ–‡ๆกฃ](./README.zh-CN.md)
6
+
7
+ ## Features
8
+
9
+ - OAuth Device Flow (RFC 8628) - Secure browser-based authentication
10
+ - PKCE support (RFC 7636) - Enhanced security for public clients
11
+ - Automatic polling - Detects authorization completion without manual input
12
+ - Auto-refresh tokens - Renewed automatically before expiration
13
+ - Compatible with qwen-code - Reuses credentials from `~/.qwen/oauth_creds.json`
14
+ - Free tier - 2,000 requests per day via OAuth
15
+
16
+ ## Prerequisites
17
+
18
+ - OpenCode CLI installed
19
+ - A qwen.ai account (free to create)
20
+
21
+ ## Installation
22
+
23
+ ### 1. Install the plugin
24
+
25
+ ```bash
34
26
  cd ~/.opencode && npm install @melodyoftears/opencode-qwen-auth
35
- ```
36
-
37
- ### 2. Enable the plugin
38
-
39
- Edit `~/.opencode/opencode.jsonc`:
40
-
41
- ```json
42
- {
27
+ ```
28
+
29
+ ### 2. Enable the plugin
30
+
31
+ Edit `~/.opencode/opencode.jsonc`:
32
+
33
+ ```json
34
+ {
43
35
  "plugin": ["@melodyoftears/opencode-qwen-auth"]
44
- }
45
- ```
46
-
47
- ## ๐Ÿ”‘ Usage
48
-
49
- ### 1. Login
50
-
51
- ```bash
52
- opencode auth login
53
- ```
54
-
55
- ### 2. Select Provider
56
-
57
- Choose **"Other"** and type `qwen-code`
58
-
59
- ### 3. Authenticate
60
-
61
- Select **"Qwen Code (qwen.ai OAuth)"**
62
-
63
- - A browser window will open for you to authorize
64
- - The plugin automatically detects when you complete authorization
65
- - No need to copy/paste codes or press Enter!
66
-
67
- > [!TIP]
68
- > In the OpenCode TUI (graphical interface), the **Qwen Code** provider appears automatically in the provider list.
69
-
70
- ## ๐ŸŽฏ Available Models
71
-
72
- | Model | ID | Input | Output | Context | Max Output | Cost |
73
- |-------|----|-------|--------|---------|------------|------|
74
- | Qwen Coder (Qwen 3.5 Plus) | `coder-model` | text | text | 1M tokens | 65,536 tokens | Free |
75
- | Qwen VL Plus (Vision) | `vision-model` | text, image | text | 128K tokens | 8,192 tokens | Free |
76
-
36
+ }
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### 1. Login
42
+
43
+ ```bash
44
+ opencode auth login
45
+ ```
46
+
47
+ ### 2. Select Provider
48
+
49
+ Choose **"Other"** and type `qwen-code`
50
+
51
+ ### 3. Authenticate
52
+
53
+ Select **"Qwen Code (qwen.ai OAuth)"**
54
+
55
+ - A browser window opens automatically for authorization
56
+ - The plugin polls and detects when you complete authorization
57
+ - No need to copy/paste codes or press Enter
58
+
59
+ ## Available Models
60
+
61
+ | Model | ID | Input | Output | Context | Max Output |
62
+ |-------|----|-------|--------|---------|------------|
63
+ | Qwen Coder (Qwen 3.5 Plus) | `coder-model` | text | text | 1M tokens | 65,536 tokens |
64
+ | Qwen VL Plus (Vision) | `vision-model` | text, image | text | 128K tokens | 8,192 tokens |
65
+
77
66
  ### Using a specific model
78
-
67
+
79
68
  ```bash
80
69
  opencode --provider qwen-code --model coder-model
81
70
  opencode --provider qwen-code --model vision-model
82
71
  ```
83
-
84
- ## โš™๏ธ How It Works
85
-
86
- ```
87
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
88
- โ”‚ OpenCode CLI โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ qwen.ai OAuth โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Qwen Models โ”‚
89
- โ”‚ โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚ (Device Flow) โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚ API โ”‚
90
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
91
- ```
92
-
93
- 1. **Device Flow (RFC 8628)**: Opens your browser to `chat.qwen.ai` for authentication
94
- 2. **Automatic Polling**: Detects authorization completion automatically
95
- 3. **Token Storage**: Saves credentials to `~/.qwen/oauth_creds.json`
96
- 4. **Auto-refresh**: Renews tokens 30 seconds before expiration
97
-
98
- ## ๐Ÿ“Š Usage Limits
99
-
100
- | Plan | Rate Limit | Daily Limit |
101
- |------|------------|-------------|
102
- | Free (OAuth) | 60 req/min | 2,000 req/day |
103
-
104
- > [!NOTE]
105
- > Limits reset at midnight UTC. For higher limits, consider using an API key from [DashScope](https://dashscope.aliyun.com).
106
-
107
- ## ๐Ÿ”ง Troubleshooting
108
-
109
- ### Token expired
110
-
111
- The plugin automatically renews tokens. If issues persist:
112
-
113
- ```bash
114
- # Remove old credentials
115
- rm ~/.qwen/oauth_creds.json
116
-
117
- # Re-authenticate
118
- opencode auth login
119
- ```
120
-
121
- ### Provider not showing in `auth login`
122
-
123
- The `qwen-code` provider is added via plugin. In the `opencode auth login` command:
124
-
125
- 1. Select **"Other"**
126
- 2. Type `qwen-code`
127
-
128
- ### Rate limit exceeded (429 errors)
129
-
130
- - Wait until midnight UTC for quota reset
72
+
73
+ ## How It Works
74
+
75
+ 1. **Device Flow**: Opens your browser to `chat.qwen.ai` for authentication
76
+ 2. **Automatic Polling**: Detects authorization completion automatically
77
+ 3. **Token Storage**: Saves credentials to `~/.qwen/oauth_creds.json`
78
+ 4. **Auto-refresh**: Renews tokens 30 seconds before expiration
79
+
80
+ ## Usage Limits
81
+
82
+ | Plan | Rate Limit | Daily Limit |
83
+ |------|------------|-------------|
84
+ | Free (OAuth) | 60 req/min | 2,000 req/day |
85
+
86
+ Limits reset at midnight UTC.
87
+
88
+ ## Troubleshooting
89
+
90
+ ### Token expired
91
+
92
+ The plugin automatically renews tokens. If issues persist:
93
+
94
+ ```bash
95
+ # Remove old credentials
96
+ rm ~/.qwen/oauth_creds.json
97
+
98
+ # Re-authenticate
99
+ opencode auth login
100
+ ```
101
+
102
+ ### Provider not showing in `auth login`
103
+
104
+ The `qwen-code` provider is added via plugin. In the `opencode auth login` command:
105
+
106
+ 1. Select **"Other"**
107
+ 2. Type `qwen-code`
108
+
109
+ ### Rate limit exceeded (429 errors)
110
+
111
+ - Wait until midnight UTC for quota reset
131
112
  - Switch to another Qwen account and login again if quota is exhausted
132
- - Consider [DashScope API](https://dashscope.aliyun.com) for higher limits
133
-
134
- ## ๐Ÿ› ๏ธ Development
135
-
136
- ```bash
137
- # Clone the repository
138
- git clone https://github.com/1579364808/opencode-qwen-auth.git
139
- cd opencode-qwencode-auth
140
-
141
- # Install dependencies
142
- bun install
143
-
144
- # Type check
145
- bun run typecheck
146
- ```
147
-
148
- ### Local testing
149
-
150
- Edit `~/.opencode/package.json`:
151
-
152
- ```json
153
- {
154
- "dependencies": {
113
+
114
+ ## Development
115
+
116
+ ```bash
117
+ # Clone the repository
118
+ git clone https://github.com/1579364808/opencode-qwen-auth.git
119
+ cd opencode-qwencode-auth
120
+
121
+ # Install dependencies
122
+ bun install
123
+
124
+ # Build
125
+ bun run build
126
+
127
+ # Type check
128
+ bun run typecheck
129
+ ```
130
+
131
+ ### Local testing
132
+
133
+ Edit `~/.opencode/package.json`:
134
+
135
+ ```json
136
+ {
137
+ "dependencies": {
155
138
  "@melodyoftears/opencode-qwen-auth": "file:///absolute/path/to/opencode-qwencode-auth"
156
- }
157
- }
158
- ```
159
-
160
- Then reinstall:
161
-
162
- ```bash
163
- cd ~/.opencode && npm install
164
- ```
165
-
166
- ## ๐Ÿ“ Project Structure
167
-
168
- ```
169
- src/
170
- โ”œโ”€โ”€ constants.ts # OAuth endpoints, models config
171
- โ”œโ”€โ”€ types.ts # TypeScript interfaces
172
- โ”œโ”€โ”€ index.ts # Main plugin entry point
173
- โ”œโ”€โ”€ qwen/
174
- โ”‚ โ””โ”€โ”€ oauth.ts # OAuth Device Flow + PKCE
175
- โ””โ”€โ”€ plugin/
176
- โ”œโ”€โ”€ auth.ts # Credentials management
177
- โ””โ”€โ”€ utils.ts # Helper utilities
178
- ```
179
-
180
- ## ๐Ÿ”— Related Projects
181
-
182
- - [qwen-code](https://github.com/QwenLM/qwen-code) - Official Qwen coding CLI
183
- - [OpenCode](https://opencode.ai) - AI-powered CLI for development
184
- - [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) - Similar plugin for Google Gemini
185
-
186
- ## ๐Ÿ“„ License
187
-
188
- MIT
189
-
190
- ---
191
-
192
- <p align="center">
193
- Made with โค๏ธ for the OpenCode community
194
- </p>
139
+ }
140
+ }
141
+ ```
142
+
143
+ Then reinstall:
144
+
145
+ ```bash
146
+ cd ~/.opencode && npm install
147
+ ```
148
+
149
+ ## Project Structure
150
+
151
+ ```
152
+ src/
153
+ โ”œโ”€โ”€ constants.ts # OAuth endpoints, models config
154
+ โ”œโ”€โ”€ types.ts # TypeScript interfaces
155
+ โ”œโ”€โ”€ index.ts # Main plugin entry point
156
+ โ”œโ”€โ”€ cli.ts # CLI helper for manual auth
157
+ โ”œโ”€โ”€ qwen/
158
+ โ”‚ โ””โ”€โ”€ oauth.ts # OAuth Device Flow + PKCE
159
+ โ”œโ”€โ”€ plugin/
160
+ โ”‚ โ”œโ”€โ”€ auth.ts # Credentials management
161
+ โ”‚ โ””โ”€โ”€ utils.ts # Helper utilities
162
+ โ””โ”€โ”€ errors.ts # Error handling
163
+ ```
164
+
165
+ ## Related Projects
166
+
167
+ - [qwen-code](https://github.com/QwenLM/qwen-code) - Official Qwen coding CLI
168
+ - [OpenCode](https://opencode.ai) - AI-powered CLI for development
169
+
170
+ ## License
171
+
172
+ MIT
package/README.zh-CN.md CHANGED
@@ -1,40 +1,32 @@
1
- # ๐Ÿค– OpenCode ็š„ Qwen OAuth ๆ’ไปถ
1
+ # OpenCode Qwen Auth ๆ’ไปถ
2
2
 
3
- ![npm version](https://img.shields.io/npm/v/%40melodyoftears%2Fopencode-qwen-auth)
4
- ![License](https://img.shields.io/github/license/1579364808/opencode-qwen-auth)
5
- ![GitHub stars](https://img.shields.io/github/stars/1579364808/opencode-qwen-auth)
3
+ ไฝฟ็”จ qwen.ai ่ดฆๅทไธบ OpenCode CLI ็™ปๅฝ•ใ€‚่ฏฅๆ’ไปถๅฏ่ฎฉไฝ ไฝฟ็”จ Qwen OAuth ๆจกๅž‹๏ผˆ`coder-model` ไธŽ `vision-model`๏ผ‰๏ผŒไบซๅ—ๆฏๅคฉๅ…่ดน่ฏทๆฑ‚้ขๅบฆ๏ผŒๆ— ้œ€ API Key ๆˆ–ไฟก็”จๅกใ€‚
6
4
 
7
- <p align="center">
8
- <img src="assets/screenshot.png" alt="OpenCode with Qwen Code" width="800">
9
- </p>
5
+ [English](./README.md)
10
6
 
11
- **ไฝฟ็”จไฝ ็š„ qwen.ai ่ดฆๅทไธบ OpenCode CLI ็™ปๅฝ•ใ€‚** ่ฏฅๆ’ไปถๅฏ่ฎฉไฝ ไฝฟ็”จ Qwen OAuth ๆจกๅž‹๏ผˆ`coder-model` ไธŽ `vision-model`๏ผ‰๏ผŒไบซๅ— **ๆฏๅคฉ 2,000 ๆฌกๅ…่ดน่ฏทๆฑ‚**๏ผŒๆ— ้œ€ API Key ๆˆ–ไฟก็”จๅกใ€‚
7
+ ## ๅŠŸ่ƒฝ
12
8
 
13
- [๐Ÿ‡บ๐Ÿ‡ธ English](./README.md)
9
+ - OAuth Device Flow (RFC 8628) - ๅŸบไบŽๆต่งˆๅ™จ็š„ๅฎ‰ๅ…จ็™ปๅฝ•
10
+ - PKCE ๆ”ฏๆŒ (RFC 7636) - ๅขžๅผบๅ…ฌๅ…ฑๅฎขๆˆท็ซฏๅฎ‰ๅ…จๆ€ง
11
+ - ่‡ชๅŠจ่ฝฎ่ฏข - ๆŽˆๆƒๅฎŒๆˆๅŽ่‡ชๅŠจๆฃ€ๆต‹๏ผŒๆ— ้œ€ๆ‰‹ๅŠจ่พ“ๅ…ฅ
12
+ - Token ่‡ชๅŠจๅˆทๆ–ฐ - ่ฟ‡ๆœŸๅ‰่‡ชๅŠจ็ปญๆœŸ
13
+ - ๅ…ผๅฎน qwen-code - ๅค็”จ `~/.qwen/oauth_creds.json` ๅ‡ญๆฎ
14
+ - ๅ…่ดน้ขๅบฆ - ้€š่ฟ‡ OAuth ๆฏๅคฉ 2,000 ๆฌก่ฏทๆฑ‚
14
15
 
15
- ## โœจ ๅŠŸ่ƒฝ
16
+ ## ๅ‰็ฝฎๆกไปถ
16
17
 
17
- - ๐Ÿ” **OAuth Device Flow**๏ผšๅŸบไบŽๆต่งˆๅ™จ็š„ๅฎ‰ๅ…จ็™ปๅฝ•๏ผˆRFC 8628๏ผ‰
18
- - โšก **่‡ชๅŠจ่ฝฎ่ฏข**๏ผšๆŽˆๆƒๅฎŒๆˆๅŽ่‡ชๅŠจๆฃ€ๆต‹๏ผŒๆ— ้œ€ๆ‰‹ๅŠจๅ›ž่ฝฆ
19
- - ๐Ÿ†“ **ๅ…่ดน้ขๅบฆ**๏ผšๆฏๅคฉ 2,000 ๆฌก่ฏทๆฑ‚
20
- - ๐Ÿง  **่ถ…้•ฟไธŠไธ‹ๆ–‡**๏ผšๆ”ฏๆŒๆœ€้ซ˜ 1M ไธŠไธ‹ๆ–‡ๆจกๅž‹
21
- - ๐Ÿ”„ **่‡ชๅŠจ็ปญๆœŸ**๏ผšToken ่ฟ‡ๆœŸๅ‰่‡ชๅŠจๅˆทๆ–ฐ
22
- - ๐Ÿ”— **ๅ…ผๅฎน qwen-code**๏ผšๅค็”จ `~/.qwen/oauth_creds.json` ๅ‡ญๆฎ
18
+ - ๅทฒๅฎ‰่ฃ… OpenCode CLI
19
+ - ไธ€ไธช qwen.ai ่ดฆๅท๏ผˆๅฏๅ…่ดนๆณจๅ†Œ๏ผ‰
23
20
 
24
- ## ๐Ÿ“‹ ๅ‰็ฝฎๆกไปถ
21
+ ## ๅฎ‰่ฃ…
25
22
 
26
- - ๅทฒๅฎ‰่ฃ… [OpenCode CLI](https://opencode.ai)
27
- - ไธ€ไธช [qwen.ai](https://chat.qwen.ai) ่ดฆๅท๏ผˆๅฏๅ…่ดนๆณจๅ†Œ๏ผ‰
28
-
29
- ## ๐Ÿš€ ๅฎ‰่ฃ…
30
-
31
- ### 1) ๅฎ‰่ฃ…ๆ’ไปถ
23
+ ### 1. ๅฎ‰่ฃ…ๆ’ไปถ
32
24
 
33
25
  ```bash
34
26
  cd ~/.opencode && npm install @melodyoftears/opencode-qwen-auth
35
27
  ```
36
28
 
37
- ### 2) ๅฏ็”จๆ’ไปถ
29
+ ### 2. ๅฏ็”จๆ’ไปถ
38
30
 
39
31
  ็ผ–่พ‘ `~/.opencode/opencode.jsonc`๏ผš
40
32
 
@@ -44,34 +36,32 @@ cd ~/.opencode && npm install @melodyoftears/opencode-qwen-auth
44
36
  }
45
37
  ```
46
38
 
47
- ## ๐Ÿ”‘ ไฝฟ็”จ
39
+ ## ไฝฟ็”จ
48
40
 
49
- ### 1) ็™ปๅฝ•
41
+ ### 1. ็™ปๅฝ•
50
42
 
51
43
  ```bash
52
44
  opencode auth login
53
45
  ```
54
46
 
55
- ### 2) ้€‰ๆ‹ฉ Provider
47
+ ### 2. ้€‰ๆ‹ฉ Provider
56
48
 
57
49
  ้€‰ๆ‹ฉ **"Other"**๏ผŒ่พ“ๅ…ฅ `qwen-code`
58
50
 
59
- ### 3) ๅฎŒๆˆๆŽˆๆƒ
51
+ ### 3. ๅฎŒๆˆๆŽˆๆƒ
60
52
 
61
53
  ้€‰ๆ‹ฉ **"Qwen Code (qwen.ai OAuth)"**
62
54
 
63
55
  - ๆต่งˆๅ™จไผš่‡ชๅŠจๆ‰“ๅผ€ๆŽˆๆƒ้กต
64
- - ๆŽˆๆƒๅฎŒๆˆๅŽๆ’ไปถไผš่‡ชๅŠจๆฃ€ๆต‹ๅนถไฟๅญ˜
56
+ - ๆ’ไปถ่‡ชๅŠจ่ฝฎ่ฏขๅนถๆฃ€ๆต‹ๆŽˆๆƒๅฎŒๆˆ
57
+ - ๆ— ้œ€ๅคๅˆถ้ชŒ่ฏ็ ๆˆ–ๆ‰‹ๅŠจๅ›ž่ฝฆ
65
58
 
66
- > [!TIP]
67
- > ๅœจ OpenCode TUI ไธญ๏ผŒ**Qwen Code** provider ไผš่‡ชๅŠจๅ‡บ็Žฐๅœจ provider ๅˆ—่กจใ€‚
59
+ ## ๅฏ็”จๆจกๅž‹
68
60
 
69
- ## ๐ŸŽฏ ๅฏ็”จๆจกๅž‹
70
-
71
- | ๆจกๅž‹ | ID | ่พ“ๅ…ฅ | ่พ“ๅ‡บ | ไธŠไธ‹ๆ–‡ | ๆœ€ๅคง่พ“ๅ‡บ | ่ดน็”จ |
72
- |------|----|------|------|--------|----------|------|
73
- | Qwen Coder (Qwen 3.5 Plus) | `coder-model` | text | text | 1M tokens | 65,536 tokens | Free |
74
- | Qwen VL Plus (Vision) | `vision-model` | text, image | text | 128K tokens | 8,192 tokens | Free |
61
+ | ๆจกๅž‹ | ID | ่พ“ๅ…ฅ | ่พ“ๅ‡บ | ไธŠไธ‹ๆ–‡ | ๆœ€ๅคง่พ“ๅ‡บ |
62
+ |------|----|------|------|--------|----------|
63
+ | Qwen Coder (Qwen 3.5 Plus) | `coder-model` | text | text | 1M tokens | 65,536 tokens |
64
+ | Qwen VL Plus (Vision) | `vision-model` | text, image | text | 128K tokens | 8,192 tokens |
75
65
 
76
66
  ### ๆŒ‡ๅฎšๆจกๅž‹่ฟ่กŒ
77
67
 
@@ -80,33 +70,27 @@ opencode --provider qwen-code --model coder-model
80
70
  opencode --provider qwen-code --model vision-model
81
71
  ```
82
72
 
83
- ## โš™๏ธ ๅทฅไฝœๅŽŸ็†
84
-
85
- ```
86
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
87
- โ”‚ OpenCode CLI โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ qwen.ai OAuth โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Qwen Models โ”‚
88
- โ”‚ โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚ (Device Flow) โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚ API โ”‚
89
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
90
- ```
73
+ ## ๅทฅไฝœๅŽŸ็†
91
74
 
92
75
  1. Device Flow ๆ‰“ๅผ€ `chat.qwen.ai` ๆŽˆๆƒ้กต้ข
93
76
  2. ๆ’ไปถ่‡ชๅŠจ่ฝฎ่ฏขๆŽˆๆƒ็ป“ๆžœ
94
77
  3. ๅ‡ญๆฎไฟๅญ˜ๅˆฐ `~/.qwen/oauth_creds.json`
95
- 4. Access Token ๅœจๅˆฐๆœŸๅ‰่‡ชๅŠจๅˆทๆ–ฐ
78
+ 4. Access Token ๅœจๅˆฐๆœŸๅ‰ 30 ็ง’่‡ชๅŠจๅˆทๆ–ฐ
96
79
 
97
- ## ๐Ÿ“Š ไฝฟ็”จ้™ๅˆถ
80
+ ## ไฝฟ็”จ้™ๅˆถ
98
81
 
99
82
  | ่ฎกๅˆ’ | ้ข‘็އ้™ๅˆถ | ๆฏๆ—ฅ้™ๅˆถ |
100
83
  |------|----------|----------|
101
84
  | ๅ…่ดน๏ผˆOAuth๏ผ‰ | 60 req/min | 2,000 req/day |
102
85
 
103
- > [!NOTE]
104
- > ้…้ข้€šๅธธๆŒ‰ UTC ้›ถ็‚น้‡็ฝฎใ€‚่‹ฅ้œ€ๆ›ด้ซ˜้ขๅบฆ๏ผŒๅฏ่€ƒ่™‘ไฝฟ็”จ [DashScope](https://dashscope.aliyun.com) API Keyใ€‚
86
+ ้…้ขๆŒ‰ UTC ้›ถ็‚น้‡็ฝฎใ€‚
105
87
 
106
- ## ๐Ÿ”ง ๆ•…้šœๆŽ’ๆŸฅ
88
+ ## ๆ•…้šœๆŽ’ๆŸฅ
107
89
 
108
90
  ### Token ่ฟ‡ๆœŸๆˆ–ๅผ‚ๅธธ
109
91
 
92
+ ๆ’ไปถไผš่‡ชๅŠจๅˆทๆ–ฐ Tokenใ€‚ๅฆ‚ไปๆœ‰้—ฎ้ข˜๏ผš
93
+
110
94
  ```bash
111
95
  # ๅˆ ้™คๆ—งๅ‡ญๆฎ
112
96
  rm ~/.qwen/oauth_creds.json
@@ -124,11 +108,10 @@ opencode auth login
124
108
 
125
109
  ### ้‡ๅˆฐ 429 ้™ๆต
126
110
 
127
- - ็ญ‰ๅพ… UTC ้›ถ็‚น้‡็ฝฎ
111
+ - ็ญ‰ๅพ… UTC ้›ถ็‚น้…้ข้‡็ฝฎ
128
112
  - ้…้ข่€—ๅฐฝๆ—ถๅˆ‡ๆข่ดฆๅทๅนถ้‡ๆ–ฐ็™ปๅฝ•
129
- - ้œ€่ฆๆ›ด้ซ˜้ขๅบฆๅฏไฝฟ็”จ DashScope API
130
113
 
131
- ## ๐Ÿ› ๏ธ ๅผ€ๅ‘
114
+ ## ๅผ€ๅ‘
132
115
 
133
116
  ```bash
134
117
  # ๅ…‹้š†ไป“ๅบ“
@@ -138,6 +121,9 @@ cd opencode-qwencode-auth
138
121
  # ๅฎ‰่ฃ…ไพ่ต–
139
122
  bun install
140
123
 
124
+ # ๆž„ๅปบ
125
+ bun run build
126
+
141
127
  # ็ฑปๅž‹ๆฃ€ๆŸฅ
142
128
  bun run typecheck
143
129
  ```
@@ -160,6 +146,27 @@ bun run typecheck
160
146
  cd ~/.opencode && npm install
161
147
  ```
162
148
 
163
- ## ๐Ÿ“„ License
149
+ ## ้กน็›ฎ็ป“ๆž„
150
+
151
+ ```
152
+ src/
153
+ โ”œโ”€โ”€ constants.ts # OAuth ็ซฏ็‚นใ€ๆจกๅž‹้…็ฝฎ
154
+ โ”œโ”€โ”€ types.ts # TypeScript ๆŽฅๅฃ
155
+ โ”œโ”€โ”€ index.ts # ไธปๆ’ไปถๅ…ฅๅฃ
156
+ โ”œโ”€โ”€ cli.ts # ๆ‰‹ๅŠจๆŽˆๆƒ CLI ๅŠฉๆ‰‹
157
+ โ”œโ”€โ”€ qwen/
158
+ โ”‚ โ””โ”€โ”€ oauth.ts # OAuth Device Flow + PKCE
159
+ โ”œโ”€โ”€ plugin/
160
+ โ”‚ โ”œโ”€โ”€ auth.ts # ๅ‡ญๆฎ็ฎก็†
161
+ โ”‚ โ””โ”€โ”€ utils.ts # ๅทฅๅ…ทๅ‡ฝๆ•ฐ
162
+ โ””โ”€โ”€ errors.ts # ้”™่ฏฏๅค„็†
163
+ ```
164
+
165
+ ## ็›ธๅ…ณ้กน็›ฎ
166
+
167
+ - [qwen-code](https://github.com/QwenLM/qwen-code) - Qwen ๅฎ˜ๆ–น CLI
168
+ - [OpenCode](https://opencode.ai) - AI ้ฉฑๅŠจ็š„ๅผ€ๅ‘ CLI
169
+
170
+ ## ่ฎธๅฏ่ฏ
164
171
 
165
172
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melodyoftears/opencode-qwen-auth",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Qwen OAuth authentication plugin for OpenCode - Access Qwen AI models (Coder, Vision) with your qwen.ai account",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",