qwen-opencode-provider 2.0.2 → 2.0.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.
Files changed (2) hide show
  1. package/index.js +12 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -67,17 +67,19 @@ function readApiKeyFromAuth() {
67
67
 
68
68
  log(`[Auth] Auth file contents keys: ${Object.keys(auth).join(', ')}`);
69
69
 
70
- if (auth[PROVIDER_ID]?.apiKey) {
71
- const keyPreview = auth[PROVIDER_ID].apiKey.substring(0, 20) + '...';
72
- log(`[Auth] Found API key for ${PROVIDER_ID}: ${keyPreview}`);
73
- return auth[PROVIDER_ID].apiKey;
74
- } else {
75
- log(`[Auth] No apiKey found for ${PROVIDER_ID}`);
76
-
77
- // Also check other possible keys
78
- for (const key of Object.keys(auth)) {
79
- log(`[Auth] Key ${key}: ${JSON.stringify(auth[key])}`);
70
+ // Try both apiKey and key fields
71
+ const providerAuth = auth[PROVIDER_ID];
72
+ if (providerAuth) {
73
+ const apiKey = providerAuth.apiKey || providerAuth.key || providerAuth.token || null;
74
+ if (apiKey) {
75
+ const keyPreview = apiKey.substring(0, 20) + '...';
76
+ log(`[Auth] Found API key for ${PROVIDER_ID}: ${keyPreview}`);
77
+ return apiKey;
78
+ } else {
79
+ log(`[Auth] Provider exists but no key field: ${JSON.stringify(providerAuth)}`);
80
80
  }
81
+ } else {
82
+ log(`[Auth] No provider found for ${PROVIDER_ID}`);
81
83
  }
82
84
  } else {
83
85
  log(`[Auth] Auth file does not exist`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwen-opencode-provider",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "OpenCode plugin for Qwen API - auto adds provider with 28+ models",
5
5
  "main": "index.js",
6
6
  "type": "module",