opencode-qwen-cli-auth 2.0.0 → 2.0.1
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/dist/index.js +9 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @repository https://github.com/TVD-00/opencode-qwen-cli-auth
|
|
9
9
|
*/
|
|
10
10
|
import { createPKCE, requestDeviceCode, pollForToken, getApiBaseUrl, saveToken, refreshAccessToken, loadStoredToken } from "./lib/auth/auth.js";
|
|
11
|
-
import { PROVIDER_ID, AUTH_LABELS, DEVICE_FLOW } from "./lib/constants.js";
|
|
11
|
+
import { PROVIDER_ID, AUTH_LABELS, DEVICE_FLOW, DEFAULT_QWEN_BASE_URL } from "./lib/constants.js";
|
|
12
12
|
import { logError, logInfo, LOGGING_ENABLED } from "./lib/logger.js";
|
|
13
13
|
/**
|
|
14
14
|
* Lay access token hop le tu SDK auth state, refresh neu het han
|
|
@@ -80,23 +80,20 @@ export const QwenAuthPlugin = async (_input) => {
|
|
|
80
80
|
provider: PROVIDER_ID,
|
|
81
81
|
/**
|
|
82
82
|
* Loader: lay token + base URL, tra ve cho SDK
|
|
83
|
-
*
|
|
83
|
+
* Pattern giong plugin tham chieu opencode-qwencode-auth
|
|
84
84
|
*/
|
|
85
85
|
async loader(getAuth, provider) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
// Zero cost cho OAuth models (mien phi)
|
|
87
|
+
if (provider?.models) {
|
|
88
|
+
for (const model of Object.values(provider.models)) {
|
|
89
|
+
if (model) model.cost = { input: 0, output: 0 };
|
|
90
|
+
}
|
|
90
91
|
}
|
|
91
92
|
const accessToken = await getValidAccessToken(getAuth);
|
|
92
|
-
if (!accessToken)
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
const baseUrl = getBaseUrl();
|
|
96
|
-
// Tra ve apiKey + baseURL, SDK tu xu ly phan con lai
|
|
93
|
+
if (!accessToken) return null;
|
|
97
94
|
return {
|
|
98
95
|
apiKey: accessToken,
|
|
99
|
-
baseURL:
|
|
96
|
+
baseURL: DEFAULT_QWEN_BASE_URL,
|
|
100
97
|
};
|
|
101
98
|
},
|
|
102
99
|
methods: [
|
package/package.json
CHANGED