@melodyoftears/opencode-qwen-auth 1.3.1 โ 1.3.3
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.
- package/README.md +171 -185
- package/README.zh-CN.md +69 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,194 +1,180 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
##
|
|
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
|
|
64
|
-
- The plugin
|
|
65
|
-
- No need to copy/paste codes or press Enter
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
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
|
-
##
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
##
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
src/
|
|
170
|
-
โโโ constants.ts # OAuth endpoints, models config
|
|
171
|
-
โโโ types.ts # TypeScript interfaces
|
|
172
|
-
โโโ index.ts # Main plugin entry point
|
|
173
|
-
โโโ
|
|
174
|
-
|
|
175
|
-
โโโ
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
## Support
|
|
171
|
+
|
|
172
|
+
If this project helps you, you can buy me a coffee:
|
|
173
|
+
|
|
174
|
+
<p align="center">
|
|
175
|
+
<img src="assets/ไปๆฌพ็ .png" alt="Payment QR Code" width="300">
|
|
176
|
+
</p>
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
MIT
|
package/README.zh-CN.md
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OpenCode Qwen Auth ๆไปถ
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-

|
|
5
|
-

|
|
3
|
+
ไฝฟ็จ qwen.ai ่ดฆๅทไธบ OpenCode CLI ็ปๅฝใ่ฏฅๆไปถๅฏ่ฎฉไฝ ไฝฟ็จ Qwen OAuth ๆจกๅ๏ผ`coder-model` ไธ `vision-model`๏ผ๏ผไบซๅๆฏๅคฉๅ
่ดน่ฏทๆฑ้ขๅบฆ๏ผๆ ้ API Key ๆไฟก็จๅกใ
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
<img src="assets/screenshot.png" alt="OpenCode with Qwen Code" width="800">
|
|
9
|
-
</p>
|
|
10
|
-
|
|
11
|
-
**ไฝฟ็จไฝ ็ qwen.ai ่ดฆๅทไธบ OpenCode CLI ็ปๅฝใ** ่ฏฅๆไปถๅฏ่ฎฉไฝ ไฝฟ็จ Qwen OAuth ๆจกๅ๏ผ`coder-model` ไธ `vision-model`๏ผ๏ผไบซๅ **ๆฏๅคฉ 2,000 ๆฌกๅ
่ดน่ฏทๆฑ**๏ผๆ ้ API Key ๆไฟก็จๅกใ
|
|
5
|
+
[English](./README.md)
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
## ๅ่ฝ
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
- OAuth Device Flow (RFC 8628) - ๅบไบๆต่งๅจ็ๅฎๅ
จ็ปๅฝ
|
|
10
|
+
- PKCE ๆฏๆ (RFC 7636) - ๅขๅผบๅ
ฌๅ
ฑๅฎขๆท็ซฏๅฎๅ
จๆง
|
|
11
|
+
- ่ชๅจ่ฝฎ่ฏข - ๆๆๅฎๆๅ่ชๅจๆฃๆต๏ผๆ ้ๆๅจ่พๅ
ฅ
|
|
12
|
+
- Token ่ชๅจๅทๆฐ - ่ฟๆๅ่ชๅจ็ปญๆ
|
|
13
|
+
- ๅ
ผๅฎน qwen-code - ๅค็จ `~/.qwen/oauth_creds.json` ๅญๆฎ
|
|
14
|
+
- ๅ
่ดน้ขๅบฆ - ้่ฟ OAuth ๆฏๅคฉ 2,000 ๆฌก่ฏทๆฑ
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
- โก **่ชๅจ่ฝฎ่ฏข**๏ผๆๆๅฎๆๅ่ชๅจๆฃๆต๏ผๆ ้ๆๅจๅ่ฝฆ
|
|
19
|
-
- ๐ **ๅ
่ดน้ขๅบฆ**๏ผๆฏๅคฉ 2,000 ๆฌก่ฏทๆฑ
|
|
20
|
-
- ๐ง **่ถ
้ฟไธไธๆ**๏ผๆฏๆๆ้ซ 1M ไธไธๆๆจกๅ
|
|
21
|
-
- ๐ **่ชๅจ็ปญๆ**๏ผToken ่ฟๆๅ่ชๅจๅทๆฐ
|
|
22
|
-
- ๐ **ๅ
ผๅฎน qwen-code**๏ผๅค็จ `~/.qwen/oauth_creds.json` ๅญๆฎ
|
|
16
|
+
## ๅ็ฝฎๆกไปถ
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
- ๅทฒๅฎ่ฃ
OpenCode CLI
|
|
19
|
+
- ไธไธช qwen.ai ่ดฆๅท๏ผๅฏๅ
่ดนๆณจๅ๏ผ
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
- ไธไธช [qwen.ai](https://chat.qwen.ai) ่ดฆๅท๏ผๅฏๅ
่ดนๆณจๅ๏ผ
|
|
21
|
+
## ๅฎ่ฃ
|
|
28
22
|
|
|
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
|
|
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
|
-
-
|
|
65
|
-
|
|
66
|
-
> [!TIP]
|
|
67
|
-
> ๅจ OpenCode TUI ไธญ๏ผ**Qwen Code** provider ไผ่ชๅจๅบ็ฐๅจ provider ๅ่กจใ
|
|
56
|
+
- ๆไปถ่ชๅจ่ฝฎ่ฏขๅนถๆฃๆตๆๆๅฎๆ
|
|
57
|
+
- ๆ ้ๅคๅถ้ช่ฏ็ ๆๆๅจๅ่ฝฆ
|
|
68
58
|
|
|
69
|
-
##
|
|
59
|
+
## ๅฏ็จๆจกๅ
|
|
70
60
|
|
|
71
|
-
| ๆจกๅ | ID | ่พๅ
ฅ | ่พๅบ | ไธไธๆ | ๆๅคง่พๅบ |
|
|
72
|
-
|
|
73
|
-
| Qwen Coder (Qwen 3.5 Plus) | `coder-model` | text | text | 1M tokens | 65,536 tokens |
|
|
74
|
-
| Qwen VL Plus (Vision) | `vision-model` | text, image | text | 128K tokens | 8,192 tokens |
|
|
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
|
-
|
|
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,35 @@ bun run typecheck
|
|
|
160
146
|
cd ~/.opencode && npm install
|
|
161
147
|
```
|
|
162
148
|
|
|
163
|
-
##
|
|
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
|
+
## ๆฏๆ
|
|
171
|
+
|
|
172
|
+
ๅฆๆ่ฟไธช้กน็ฎๅธฎๅฉๅฐไฝ ๏ผๅฏไปฅ่ฏทๆๅๆฏๅๅก๏ผ
|
|
173
|
+
|
|
174
|
+
<p align="center">
|
|
175
|
+
<img src="assets/ไปๆฌพ็ .png" alt="ไปๆฌพ็ " width="300">
|
|
176
|
+
</p>
|
|
177
|
+
|
|
178
|
+
## ่ฎธๅฏ่ฏ
|
|
164
179
|
|
|
165
180
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@melodyoftears/opencode-qwen-auth",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|