@fish-under-sea/magpie-dragonapi 0.3.0 → 1.0.0
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 +30 -13
- package/lib/dashboard.mjs +69 -0
- package/lib/pricing.mjs +35 -4
- package/lib/service.mjs +153 -43
- package/lib/site.mjs +667 -437
- package/lib/usage.mjs +12 -0
- package/package.json +8 -8
- package/page/star.png +0 -0
- package/ui/app.js +4261 -3224
- package/ui/demo.js +44 -4
- package/ui/index.html +421 -335
- package/ui/style.css +3443 -2758
package/ui/demo.js
CHANGED
|
@@ -125,6 +125,8 @@ export function createDemoApi() {
|
|
|
125
125
|
siteName: 'DragonAPI',
|
|
126
126
|
pat: { set: true, hint: 'nap_d****demo', scopes: ['profile:read', 'api_key:read', 'api_key:write'], verified: true },
|
|
127
127
|
currency: { symbol: '$', per: 500000, rate: 1, display: true },
|
|
128
|
+
user: { id: 1, username: 'demo', displayName: '演示账户', group: 'default', balance: '$18.50', balanceRaw: 9250000, used: '$68.19', usedRaw: 34095000 },
|
|
129
|
+
userError: '',
|
|
128
130
|
accounts: {
|
|
129
131
|
'sk-demo': {
|
|
130
132
|
key: 'sk-demo', label: 'gpt-promax · sk-d****demo', group: 'gpt-promax',
|
|
@@ -141,10 +143,21 @@ export function createDemoApi() {
|
|
|
141
143
|
const [start, end] = rangeOf(range);
|
|
142
144
|
return summarizeRows(rows, null, start, end);
|
|
143
145
|
}
|
|
146
|
+
if (path === '/api/subscriptions') {
|
|
147
|
+
return {
|
|
148
|
+
ok: true, billingPreference: 'subscription_first', plansError: '', at: now,
|
|
149
|
+
subscriptions: [
|
|
150
|
+
{ id: 461, planId: 3, title: '演示 · Plus 月度套餐', status: 'active', active: true, endAt: now + 20 * DAY, nextResetAt: now + 3 * DAY, used: '$28.18', total: '$30.00', remaining: '$1.82', progress: 93.93, unlimited: false },
|
|
151
|
+
{ id: 462, planId: 4, title: '演示 · 不限量套餐', status: 'cancelled', active: false, endAt: now - DAY, nextResetAt: null, used: '$42.00', total: '不限量', remaining: '不限量', progress: null, unlimited: true },
|
|
152
|
+
{ id: 463, planId: 3, title: '演示 · 已超额套餐', status: 'expired', active: false, endAt: now - 2 * DAY, nextResetAt: null, used: '$33.00', total: '$30.00', remaining: '-$3.00', progress: 110, unlimited: false },
|
|
153
|
+
],
|
|
154
|
+
plans: [{ id: 3, title: '演示 · Plus 月度套餐', subtitle: '套餐额度与钱包余额分别展示', price: '30 USD', priceAmount: 30, priceCurrency: 'USD', durationUnit: 'month', durationValue: 1, total: '$30.00', unlimited: false, quotaResetPeriod: 'weekly' }],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
144
157
|
if (path === '/api/aff') {
|
|
145
158
|
return {
|
|
146
159
|
ok: true,
|
|
147
|
-
aff: { count: 2, quota: 12500, pending: 12500 },
|
|
160
|
+
aff: { count: 2, quota: 12500, historyQuota: 37500, pending: 12500 },
|
|
148
161
|
code: '0mY4',
|
|
149
162
|
link: 'https://newapi.dragon3api.com/sign-up?aff=0mY4',
|
|
150
163
|
note: '',
|
|
@@ -184,16 +197,43 @@ export function createDemoApi() {
|
|
|
184
197
|
name, vendor,
|
|
185
198
|
kind,
|
|
186
199
|
groups: groups.map((g) => ({ id: g, ratio: G[g], note: '', auto: false })),
|
|
187
|
-
|
|
200
|
+
// 数值也一并给:没有 inputNum 这类数字,切 /1M ↔ /272K 会毫无变化,
|
|
201
|
+
// 演示模式就验不出单位换算。
|
|
202
|
+
pricing: {
|
|
203
|
+
kind: 'token',
|
|
204
|
+
input: `$${inPrice}/M`, output: `$${outPrice}/M`, cache: `$${cachePrice}/M`,
|
|
205
|
+
inputNum: Number(inPrice), outputNum: Number(outPrice), cacheNum: Number(cachePrice),
|
|
206
|
+
},
|
|
188
207
|
desc, ...extra,
|
|
189
208
|
})
|
|
190
209
|
return {
|
|
191
210
|
ok: true,
|
|
192
211
|
models: [
|
|
193
212
|
spec('claude-fable-5-2', 'Anthropic', 'chat', ['claude-cursor', 'claude-max企业'], '3.20', '16.00', '0.08', 'Anthropic 的对话模型,支持 Anthropic 兼容 / OpenAI 兼容端点;按倍率计费。'),
|
|
194
|
-
spec('claude-opus-5-5', 'Anthropic', 'chat', ['claude-kiro', 'claude-kiro正价', 'claude-cursor', 'claude-max企业'], '0.40', '2.00', '0.02', 'Anthropic
|
|
213
|
+
spec('claude-opus-5-5', 'Anthropic', 'chat', ['claude-kiro', 'claude-kiro正价', 'claude-cursor', 'claude-max企业'], '0.40', '2.00', '0.02', 'Anthropic 的对话模型,按量计费;fast 档整单 ×2。', {
|
|
214
|
+
// 真实站点:`tier("standard", …) * (param("speed") == "fast" ? 2 : 1)`。
|
|
215
|
+
// 单档 + 条件倍率,不是上下文分档。
|
|
216
|
+
pricing: {
|
|
217
|
+
kind: 'flat',
|
|
218
|
+
input: '$0.40/M', output: '$2.00/M', cache: '$0.02/M',
|
|
219
|
+
inputNum: 0.4, outputNum: 2, cacheNum: 0.02,
|
|
220
|
+
tierCount: 1,
|
|
221
|
+
note: '表达式计费(standard);整单倍率 speed=fast ×2',
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
195
224
|
spec('claude-sonnet-5-5', 'Anthropic', 'chat', ['claude-kiro', 'claude-kiro正价', 'claude-max企业'], '0.20', '1.00', '0.01', 'Anthropic 的对话模型,按倍率计费。'),
|
|
196
|
-
spec('gpt-6.1-sol', 'OpenAI', 'chat', ['gpt-plus', 'gpt-pro', 'gpt-promax'], '1.75', '14.00', '0.18', '通用推理与工具调用,支持多轮工作流。'
|
|
225
|
+
spec('gpt-6.1-sol', 'OpenAI', 'chat', ['gpt-plus', 'gpt-pro', 'gpt-promax'], '1.75', '14.00', '0.18', '通用推理与工具调用,支持多轮工作流。', {
|
|
226
|
+
// 真实站点上这个模型的表达式是 `len <= 272000 ? short_context : long_context`。
|
|
227
|
+
// 卡片上表给的是 ≤272K 那一档(与 /1M 同源),/272K 只是把单价折成
|
|
228
|
+
// 每 272K token;272K 以上那档只在详情抽屉的分档表里出现。
|
|
229
|
+
pricing: {
|
|
230
|
+
kind: 'tiered',
|
|
231
|
+
input: '$1.75/M', output: '$14.00/M', cache: '$0.18/M',
|
|
232
|
+
inputNum: 1.75, outputNum: 14, cacheNum: 0.18,
|
|
233
|
+
tierCount: 2,
|
|
234
|
+
note: '2 档(short_context / long_context),上表是「short_context」档(≤272K);整单倍率 service_tier=priority/fast/ultrafast ×2',
|
|
235
|
+
},
|
|
236
|
+
}),
|
|
197
237
|
spec('gemini-3-pro-preview', 'Google', 'chat', ['gemini'], '2.00', '12.00', '0.20', '多模态理解与复杂推理。'),
|
|
198
238
|
spec('deepseek-v3.2', 'DeepSeek', 'chat', ['国模'], '0.28', '0.42', '0.03', '通用对话、代码与中文写作。'),
|
|
199
239
|
spec('gpt-image-2.6', 'OpenAI', 'image', ['image'], '0.04', '0', '0', '根据提示生成或编辑图像。', { pricing: { kind: 'perimage', input: '$0.20/张', output: '$0.20/张' } }),
|