dsh-model-allowance 1.0.2 → 1.0.4
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 +4 -0
- package/README.zh.md +4 -0
- package/client.js +353 -9
- package/lib/balance.js +39 -4
- package/lib/providers/deepseek.js +41 -3
- package/lib/providers/{kimi.js → kimi_coding.js} +2 -2
- package/lib/providers/{minimax.js → minimax_cn.js} +5 -5
- package/lib/providers/{opencode.js → opencode_go.js} +2 -2
- package/lib/providers/placeholder.js +580 -0
- package/lib/providers/{zhipu.js → zai.js} +5 -5
- package/lib/providers.js +85 -9
- package/package.json +1 -1
package/lib/providers.js
CHANGED
|
@@ -8,17 +8,55 @@
|
|
|
8
8
|
* module only collects them and answers "which adapter serves this route".
|
|
9
9
|
*
|
|
10
10
|
* The quantity a provider reports is not always money. DeepSeek reports a
|
|
11
|
-
* currency balance; MiniMax, Zhipu, Kimi, and OpenCode
|
|
12
|
-
* allowance. The `kind` field keeps the two apart so
|
|
13
|
-
* thing.
|
|
11
|
+
* currency balance; MiniMax (CN), Zhipu ZAI, Kimi Coding, and OpenCode Go
|
|
12
|
+
* report a subscription allowance. The `kind` field keeps the two apart so
|
|
13
|
+
* the UI can say the right thing.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { deepseekAdapters } from './providers/deepseek.js'
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { kimiCodingAdapters } from './providers/kimi_coding.js'
|
|
18
|
+
import { minimaxCnAdapters } from './providers/minimax_cn.js'
|
|
19
|
+
import { opencodeGoAdapters } from './providers/opencode_go.js'
|
|
20
|
+
import {
|
|
21
|
+
amazonBedrockAdapters,
|
|
22
|
+
anthropicAdapters,
|
|
23
|
+
antLingAdapters,
|
|
24
|
+
azureAdapters,
|
|
25
|
+
basetenAdapters,
|
|
26
|
+
cerebrasAdapters,
|
|
27
|
+
cloudflareAiGatewayAdapters,
|
|
28
|
+
cloudflareWorkersAiAdapters,
|
|
29
|
+
fireworksAdapters,
|
|
30
|
+
githubCopilotAdapters,
|
|
31
|
+
googleAdapters,
|
|
32
|
+
googleVertexAdapters,
|
|
33
|
+
groqAdapters,
|
|
34
|
+
huggingfaceAdapters,
|
|
35
|
+
metaAdapters,
|
|
36
|
+
minimaxAdapters,
|
|
37
|
+
mistralAdapters,
|
|
38
|
+
moonshotaiAdapters,
|
|
39
|
+
moonshotaiCnAdapters,
|
|
40
|
+
nvidiaAdapters,
|
|
41
|
+
openaiAdapters,
|
|
42
|
+
openaiCodexAdapters,
|
|
43
|
+
opencodeAdapters,
|
|
44
|
+
openrouterAdapters,
|
|
45
|
+
qwenTokenPlanAdapters,
|
|
46
|
+
qwenTokenPlanCnAdapters,
|
|
47
|
+
qwenTokenPlanIndividualAdapters,
|
|
48
|
+
radiusAdapters,
|
|
49
|
+
togetherAdapters,
|
|
50
|
+
typesafeAdapters,
|
|
51
|
+
vercelAiGatewayAdapters,
|
|
52
|
+
xaiAdapters,
|
|
53
|
+
xiaomiAdapters,
|
|
54
|
+
xiaomiTokenPlanAmsAdapters,
|
|
55
|
+
xiaomiTokenPlanCnAdapters,
|
|
56
|
+
xiaomiTokenPlanSgpAdapters,
|
|
57
|
+
} from './providers/placeholder.js'
|
|
20
58
|
import { KIND_AMOUNT, KIND_QUOTA } from './providers/shared.js'
|
|
21
|
-
import {
|
|
59
|
+
import { zaiAdapters } from './providers/zai.js'
|
|
22
60
|
|
|
23
61
|
/**
|
|
24
62
|
* @typedef {object} BalanceView
|
|
@@ -80,11 +118,49 @@ import { zhipuAdapters } from './providers/zhipu.js'
|
|
|
80
118
|
* @type {readonly ProviderAdapter[]}
|
|
81
119
|
*/
|
|
82
120
|
export const PROVIDER_ADAPTERS = Object.freeze([
|
|
121
|
+
// Fully implemented adapters
|
|
83
122
|
...deepseekAdapters,
|
|
123
|
+
...minimaxCnAdapters,
|
|
124
|
+
...zaiAdapters,
|
|
125
|
+
...kimiCodingAdapters,
|
|
126
|
+
...opencodeGoAdapters,
|
|
127
|
+
// Placeholder adapters (unsupported status)
|
|
128
|
+
...amazonBedrockAdapters,
|
|
129
|
+
...antLingAdapters,
|
|
130
|
+
...anthropicAdapters,
|
|
131
|
+
...azureAdapters,
|
|
132
|
+
...basetenAdapters,
|
|
133
|
+
...cerebrasAdapters,
|
|
134
|
+
...cloudflareAiGatewayAdapters,
|
|
135
|
+
...cloudflareWorkersAiAdapters,
|
|
136
|
+
...fireworksAdapters,
|
|
137
|
+
...githubCopilotAdapters,
|
|
138
|
+
...googleAdapters,
|
|
139
|
+
...googleVertexAdapters,
|
|
140
|
+
...groqAdapters,
|
|
141
|
+
...huggingfaceAdapters,
|
|
142
|
+
...metaAdapters,
|
|
84
143
|
...minimaxAdapters,
|
|
85
|
-
...
|
|
86
|
-
...
|
|
144
|
+
...mistralAdapters,
|
|
145
|
+
...moonshotaiAdapters,
|
|
146
|
+
...moonshotaiCnAdapters,
|
|
147
|
+
...nvidiaAdapters,
|
|
148
|
+
...openaiAdapters,
|
|
149
|
+
...openaiCodexAdapters,
|
|
87
150
|
...opencodeAdapters,
|
|
151
|
+
...openrouterAdapters,
|
|
152
|
+
...qwenTokenPlanAdapters,
|
|
153
|
+
...qwenTokenPlanCnAdapters,
|
|
154
|
+
...qwenTokenPlanIndividualAdapters,
|
|
155
|
+
...radiusAdapters,
|
|
156
|
+
...togetherAdapters,
|
|
157
|
+
...typesafeAdapters,
|
|
158
|
+
...vercelAiGatewayAdapters,
|
|
159
|
+
...xaiAdapters,
|
|
160
|
+
...xiaomiAdapters,
|
|
161
|
+
...xiaomiTokenPlanAmsAdapters,
|
|
162
|
+
...xiaomiTokenPlanCnAdapters,
|
|
163
|
+
...xiaomiTokenPlanSgpAdapters,
|
|
88
164
|
])
|
|
89
165
|
|
|
90
166
|
/** Route to the adapter serving it, resolved once at load. */
|