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.
Files changed (2) hide show
  1. package/dist/index.js +9 -12
  2. 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
- * Khong can custom fetch - SDK tu xu ly streaming va headers
83
+ * Pattern giong plugin tham chieu opencode-qwencode-auth
84
84
  */
85
85
  async loader(getAuth, provider) {
86
- const auth = await getAuth();
87
- // Chi xu ly OAuth, bo qua API key auth
88
- if (auth.type !== "oauth") {
89
- return {};
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: baseUrl,
96
+ baseURL: DEFAULT_QWEN_BASE_URL,
100
97
  };
101
98
  },
102
99
  methods: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-qwen-cli-auth",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Qwen OAuth authentication plugin for opencode - use your Qwen account instead of API keys",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",