@acosmi/sdk-ts 2.19.6 → 2.20.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/CHANGELOG.md +11 -0
- package/README.md +3 -2
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node/adapters/anthropic.cjs.map +1 -1
- package/dist/node/adapters/anthropic.d.cts +1 -1
- package/dist/node/adapters/anthropic.d.ts +1 -1
- package/dist/node/adapters/anthropic.mjs.map +1 -1
- package/dist/node/adapters/openai.cjs.map +1 -1
- package/dist/node/adapters/openai.d.cts +2 -2
- package/dist/node/adapters/openai.d.ts +2 -2
- package/dist/node/adapters/openai.mjs.map +1 -1
- package/dist/node/{format-CKpXSSqY.d.cts → format-BBXu82tQ.d.cts} +67 -2
- package/dist/node/{format-CKpXSSqY.d.ts → format-BBXu82tQ.d.ts} +67 -2
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +4 -4
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/{openai-CH0wnJXv.d.ts → openai-BNJe_o8L.d.ts} +1 -1
- package/dist/node/{openai-ByUO-cSR.d.cts → openai-DauG8pfK.d.cts} +1 -1
- package/docs//345/274/200/345/217/221/344/270/216/345/217/221/345/270/203/346/211/213/345/206/214.md +15 -1
- package/package.json +1 -1
|
@@ -256,8 +256,25 @@ interface ManagedModel {
|
|
|
256
256
|
defaultToolIds?: string[];
|
|
257
257
|
/** 该模型对当前用户档位是否被限制策略锁定 (limit_policy allowedModels 不含)。true=展示但置灰+升级引导。enforced 关/解析失败=false。 */
|
|
258
258
|
locked?: boolean;
|
|
259
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* 是否属于"免费会员可用"分区 (PLAN:FREE 档 allowedModels 内)。与当前用户档位无关 (仅分类)。
|
|
261
|
+
*
|
|
262
|
+
* **语义不变, 但不再是展示分区的依据**: 订阅双池之后, 「哪些模型先扣精选免费池」由
|
|
263
|
+
* {@link ManagedModel.freePoolEligible} 表达, 与 FREE 档的 allowedModels 是两套独立的集合
|
|
264
|
+
* (两者可以不一致: 某模型可以 `freePoolEligible: true` 而 `freeTier: false`, 反之亦然)。
|
|
265
|
+
* 新代码不要再用本字段分区或打"精选"角标。字段保留只为老客户端零破坏 (方案 D-14)。
|
|
266
|
+
*/
|
|
260
267
|
freeTier?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* [订阅双池 P5 / D-14] 该模型当前是否有资格先扣**精选免费池 F** (池类 FREE, 或仍在限免期内的 PROMO_FREE)。
|
|
270
|
+
* 网关随 `effective-model-policy` 的 `freePoolModels` 投影下发, 与 {@link QuotaSummaryFreePool.eligibleModels}
|
|
271
|
+
* 同源。用于模型选择器的「精选」角标。
|
|
272
|
+
*
|
|
273
|
+
* **缺席 = 老网关 (还没有双池), 不是 `false`**: `true` = 有资格; `false` = 明确没有 (走付费池 P);
|
|
274
|
+
* `undefined` = 网关不知道这件事。展示端只在 `=== true` 时画角标, 绝不在 `!== false` 时画。
|
|
275
|
+
* 限免到期是随时间翻转的: 同一模型今天 `true`、截止后 `false`, 不要缓存跨过 `promo_until`。
|
|
276
|
+
*/
|
|
277
|
+
freePoolEligible?: boolean;
|
|
261
278
|
/**
|
|
262
279
|
* 上游 gateway 为此模型启用的请求格式列表
|
|
263
280
|
* 取值: "anthropic" | "openai"
|
|
@@ -380,10 +397,42 @@ interface QuotaSummarySubscriptionPool {
|
|
|
380
397
|
*/
|
|
381
398
|
boosterNextExpiresAt?: string;
|
|
382
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* 精选免费池视图 — QuotaSummary.freePool 的形状 (订阅双池 P5 / D-14, SDK 2.20.0 起)。
|
|
402
|
+
*
|
|
403
|
+
* 付费合同里随每个订阅周期一起发放的**精选免费池 F**: 只能被池类为 FREE / 限免中的 PROMO_FREE 的模型
|
|
404
|
+
* 先扣, 用完后同一请求自动溢出扣付费池 P ({@link QuotaSummarySubscriptionPool}, 语义不变)。
|
|
405
|
+
* quota / used / remaining 的单位与 subscriptionPool 一致, 为**微 Credits** (÷1000 = Credits)。
|
|
406
|
+
*
|
|
407
|
+
* **和 `freeTotalEtu` / `freeBuckets` 不是一回事**: 后者是 GENERIC (注册赠送 / 邀请奖励 / 试用)
|
|
408
|
+
* 桶合计, 与订阅合同无关; `freePool` 是付费合同自带的那一半额度。两者不可相加, 也不可互相替代。
|
|
409
|
+
*/
|
|
410
|
+
interface QuotaSummaryFreePool {
|
|
411
|
+
/** 池总额度 (微 Credits) */
|
|
412
|
+
quota: number;
|
|
413
|
+
/** 已用额度 (微 Credits) */
|
|
414
|
+
used: number;
|
|
415
|
+
/** 剩余额度 (微 Credits) */
|
|
416
|
+
remaining: number;
|
|
417
|
+
/** 到期时间 (ISO-8601); 网关未下发时缺失, 口径同 {@link QuotaSummarySubscriptionPool.expiresAt} */
|
|
418
|
+
expiresAt?: string;
|
|
419
|
+
/** 恒为 `'MICRO_CREDIT'` */
|
|
420
|
+
unit: 'MICRO_CREDIT';
|
|
421
|
+
/**
|
|
422
|
+
* 当前有资格扣本池的模型 id 集合 = 池类 FREE ∪ 仍在限免期的 PROMO_FREE (如 `deepseek-flash`)。
|
|
423
|
+
* **可以是空数组**: `[]` = 网关明确说「此刻没有任何模型有资格」, 与字段缺席不是一回事。
|
|
424
|
+
*/
|
|
425
|
+
eligibleModels: string[];
|
|
426
|
+
}
|
|
427
|
+
/** 计量口径: `OFFICIAL_CNY` = 1 Credit = ¥0.000001 官方价 (新合同); `COST_CNY` = 成本口径 (老合同)。 */
|
|
428
|
+
type QuotaSummaryCreditUnit = 'OFFICIAL_CNY' | 'COST_CNY';
|
|
383
429
|
/**
|
|
384
430
|
* GET /api/v4/entitlements/quota-summary 返回体, 调用 client.getQuotaSummary 获取.
|
|
385
431
|
*
|
|
386
432
|
* 设计目的: 个人中心钱包栏一次性展示"我还有多少免费 + 多少付费"+ 各自最近到期时间.
|
|
433
|
+
*
|
|
434
|
+
* 注意「免费」一词有两层含义: `freeTotalEtu` / `freeBuckets` 是 GENERIC 赠送桶 (与合同无关);
|
|
435
|
+
* 订阅合同自带的精选免费池是 {@link QuotaSummary.freePool}。
|
|
387
436
|
*/
|
|
388
437
|
interface QuotaSummary {
|
|
389
438
|
/** GENERIC (免费/赠送) alive 桶 tokenRemaining 求和 */
|
|
@@ -410,6 +459,22 @@ interface QuotaSummary {
|
|
|
410
459
|
* (÷1000 = Credits)。缺席 = 老网关, 或当前没有 alive 付费桶 —— 两种都不可当 0 处理。
|
|
411
460
|
*/
|
|
412
461
|
subscriptionPool?: QuotaSummarySubscriptionPool;
|
|
462
|
+
/**
|
|
463
|
+
* [订阅双池 P5 / D-14, 2.20.0] 精选免费池 F。`subscriptionPool` 的语义**不变**, 恒为付费池 P。
|
|
464
|
+
*
|
|
465
|
+
* **缺席 = 老合同 (没有 F), 或老网关 (还不认识 F) —— 两种都不可当 0 读**: 把缺席画成
|
|
466
|
+
* 「精选额度 0 / 已用满」是在向老合同用户断言一件不存在的事。展示端只在 `freePool !== undefined`
|
|
467
|
+
* 时画第二条进度条。
|
|
468
|
+
*/
|
|
469
|
+
freePool?: QuotaSummaryFreePool;
|
|
470
|
+
/**
|
|
471
|
+
* [订阅双池 P5 / D-14, 2.20.0] 本响应里所有 Credit 数值的计量口径, 让客户端把 Credits 换算成 ¥ 时能标注口径。
|
|
472
|
+
* `OFFICIAL_CNY` = 新合同 (1 Credit = ¥0.000001 官方价); `COST_CNY` = 老合同 (成本口径)。
|
|
473
|
+
*
|
|
474
|
+
* **缺席 = 老网关, 不能当任一取值读**; 尤其不能默认成 `OFFICIAL_CNY` 去乘 ¥ 单价。
|
|
475
|
+
* 类型是闭集, 但网关将来新增口径时旧版 SDK 会原样透出未知字符串 —— 消费端对未知值应按「不换算」处理。
|
|
476
|
+
*/
|
|
477
|
+
creditUnit?: QuotaSummaryCreditUnit;
|
|
413
478
|
}
|
|
414
479
|
/**
|
|
415
480
|
* GET /api/v4/entitlements/window-reset/summary 返回体, 调用 client.getWindowResetSummary 获取.
|
|
@@ -705,4 +770,4 @@ interface ProviderAdapter {
|
|
|
705
770
|
};
|
|
706
771
|
}
|
|
707
772
|
|
|
708
|
-
export {
|
|
773
|
+
export { bucketInfoIsCommercial as $, type SourcesEventParseResult as A, BucketClassCommercial as B, type ChatContentBlock as C, type StreamEvent as D, type EffortConfig as E, type StreamSettlement as F, type GeoLoc as G, ThinkingHigh as H, type ImageGenerationRequest as I, ThinkingHighMinMaxTokens as J, ThinkingLow as K, ThinkingMax as L, type ManagedModel as M, ThinkingMaxFallbackMaxTokens as N, type OutputConfig as O, type ProviderAdapter as P, type QuotaSummary as Q, type RerankDocument as R, type ServerTool as S, type ThinkingConfig as T, ThinkingOff as U, type VideoGenerationRequest as V, type VideoTaskResponse as W, type WebSearchConfig as X, type WebSearchSource as Y, type WindowLimitStatus as Z, type WindowResetSummary as _, BucketClassGeneric as a, bucketRowIsCommercial as a0, classifySourcesEvent as a1, newThinkingConfig as a2, newWebSearchTool as a3, parseSettlement as a4, parseSourcesEvent as a5, type BucketInfo as b, type BucketRow as c, type ChatMessage as d, type ChatRequest as e, type ChatResponse as f, type ChatUsage as g, type EmbeddingData as h, type EmbeddingRequest as i, type EmbeddingResponse as j, type ImageGenerationResponse as k, type InputModality as l, type InputModalityTag as m, type ModelCapabilities as n, type MultimodalContent as o, ProviderFormat as p, type QuotaSummaryCreditUnit as q, type QuotaSummaryFreePool as r, type QuotaSummarySubscriptionPool as s, type RerankQuery as t, type RerankRequest as u, type RerankResponse as v, type RerankResult as w, ServerToolTypeWebSearch as x, type SourcesEvent as y, type SourcesEventIssueCode as z };
|
|
@@ -256,8 +256,25 @@ interface ManagedModel {
|
|
|
256
256
|
defaultToolIds?: string[];
|
|
257
257
|
/** 该模型对当前用户档位是否被限制策略锁定 (limit_policy allowedModels 不含)。true=展示但置灰+升级引导。enforced 关/解析失败=false。 */
|
|
258
258
|
locked?: boolean;
|
|
259
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* 是否属于"免费会员可用"分区 (PLAN:FREE 档 allowedModels 内)。与当前用户档位无关 (仅分类)。
|
|
261
|
+
*
|
|
262
|
+
* **语义不变, 但不再是展示分区的依据**: 订阅双池之后, 「哪些模型先扣精选免费池」由
|
|
263
|
+
* {@link ManagedModel.freePoolEligible} 表达, 与 FREE 档的 allowedModels 是两套独立的集合
|
|
264
|
+
* (两者可以不一致: 某模型可以 `freePoolEligible: true` 而 `freeTier: false`, 反之亦然)。
|
|
265
|
+
* 新代码不要再用本字段分区或打"精选"角标。字段保留只为老客户端零破坏 (方案 D-14)。
|
|
266
|
+
*/
|
|
260
267
|
freeTier?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* [订阅双池 P5 / D-14] 该模型当前是否有资格先扣**精选免费池 F** (池类 FREE, 或仍在限免期内的 PROMO_FREE)。
|
|
270
|
+
* 网关随 `effective-model-policy` 的 `freePoolModels` 投影下发, 与 {@link QuotaSummaryFreePool.eligibleModels}
|
|
271
|
+
* 同源。用于模型选择器的「精选」角标。
|
|
272
|
+
*
|
|
273
|
+
* **缺席 = 老网关 (还没有双池), 不是 `false`**: `true` = 有资格; `false` = 明确没有 (走付费池 P);
|
|
274
|
+
* `undefined` = 网关不知道这件事。展示端只在 `=== true` 时画角标, 绝不在 `!== false` 时画。
|
|
275
|
+
* 限免到期是随时间翻转的: 同一模型今天 `true`、截止后 `false`, 不要缓存跨过 `promo_until`。
|
|
276
|
+
*/
|
|
277
|
+
freePoolEligible?: boolean;
|
|
261
278
|
/**
|
|
262
279
|
* 上游 gateway 为此模型启用的请求格式列表
|
|
263
280
|
* 取值: "anthropic" | "openai"
|
|
@@ -380,10 +397,42 @@ interface QuotaSummarySubscriptionPool {
|
|
|
380
397
|
*/
|
|
381
398
|
boosterNextExpiresAt?: string;
|
|
382
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* 精选免费池视图 — QuotaSummary.freePool 的形状 (订阅双池 P5 / D-14, SDK 2.20.0 起)。
|
|
402
|
+
*
|
|
403
|
+
* 付费合同里随每个订阅周期一起发放的**精选免费池 F**: 只能被池类为 FREE / 限免中的 PROMO_FREE 的模型
|
|
404
|
+
* 先扣, 用完后同一请求自动溢出扣付费池 P ({@link QuotaSummarySubscriptionPool}, 语义不变)。
|
|
405
|
+
* quota / used / remaining 的单位与 subscriptionPool 一致, 为**微 Credits** (÷1000 = Credits)。
|
|
406
|
+
*
|
|
407
|
+
* **和 `freeTotalEtu` / `freeBuckets` 不是一回事**: 后者是 GENERIC (注册赠送 / 邀请奖励 / 试用)
|
|
408
|
+
* 桶合计, 与订阅合同无关; `freePool` 是付费合同自带的那一半额度。两者不可相加, 也不可互相替代。
|
|
409
|
+
*/
|
|
410
|
+
interface QuotaSummaryFreePool {
|
|
411
|
+
/** 池总额度 (微 Credits) */
|
|
412
|
+
quota: number;
|
|
413
|
+
/** 已用额度 (微 Credits) */
|
|
414
|
+
used: number;
|
|
415
|
+
/** 剩余额度 (微 Credits) */
|
|
416
|
+
remaining: number;
|
|
417
|
+
/** 到期时间 (ISO-8601); 网关未下发时缺失, 口径同 {@link QuotaSummarySubscriptionPool.expiresAt} */
|
|
418
|
+
expiresAt?: string;
|
|
419
|
+
/** 恒为 `'MICRO_CREDIT'` */
|
|
420
|
+
unit: 'MICRO_CREDIT';
|
|
421
|
+
/**
|
|
422
|
+
* 当前有资格扣本池的模型 id 集合 = 池类 FREE ∪ 仍在限免期的 PROMO_FREE (如 `deepseek-flash`)。
|
|
423
|
+
* **可以是空数组**: `[]` = 网关明确说「此刻没有任何模型有资格」, 与字段缺席不是一回事。
|
|
424
|
+
*/
|
|
425
|
+
eligibleModels: string[];
|
|
426
|
+
}
|
|
427
|
+
/** 计量口径: `OFFICIAL_CNY` = 1 Credit = ¥0.000001 官方价 (新合同); `COST_CNY` = 成本口径 (老合同)。 */
|
|
428
|
+
type QuotaSummaryCreditUnit = 'OFFICIAL_CNY' | 'COST_CNY';
|
|
383
429
|
/**
|
|
384
430
|
* GET /api/v4/entitlements/quota-summary 返回体, 调用 client.getQuotaSummary 获取.
|
|
385
431
|
*
|
|
386
432
|
* 设计目的: 个人中心钱包栏一次性展示"我还有多少免费 + 多少付费"+ 各自最近到期时间.
|
|
433
|
+
*
|
|
434
|
+
* 注意「免费」一词有两层含义: `freeTotalEtu` / `freeBuckets` 是 GENERIC 赠送桶 (与合同无关);
|
|
435
|
+
* 订阅合同自带的精选免费池是 {@link QuotaSummary.freePool}。
|
|
387
436
|
*/
|
|
388
437
|
interface QuotaSummary {
|
|
389
438
|
/** GENERIC (免费/赠送) alive 桶 tokenRemaining 求和 */
|
|
@@ -410,6 +459,22 @@ interface QuotaSummary {
|
|
|
410
459
|
* (÷1000 = Credits)。缺席 = 老网关, 或当前没有 alive 付费桶 —— 两种都不可当 0 处理。
|
|
411
460
|
*/
|
|
412
461
|
subscriptionPool?: QuotaSummarySubscriptionPool;
|
|
462
|
+
/**
|
|
463
|
+
* [订阅双池 P5 / D-14, 2.20.0] 精选免费池 F。`subscriptionPool` 的语义**不变**, 恒为付费池 P。
|
|
464
|
+
*
|
|
465
|
+
* **缺席 = 老合同 (没有 F), 或老网关 (还不认识 F) —— 两种都不可当 0 读**: 把缺席画成
|
|
466
|
+
* 「精选额度 0 / 已用满」是在向老合同用户断言一件不存在的事。展示端只在 `freePool !== undefined`
|
|
467
|
+
* 时画第二条进度条。
|
|
468
|
+
*/
|
|
469
|
+
freePool?: QuotaSummaryFreePool;
|
|
470
|
+
/**
|
|
471
|
+
* [订阅双池 P5 / D-14, 2.20.0] 本响应里所有 Credit 数值的计量口径, 让客户端把 Credits 换算成 ¥ 时能标注口径。
|
|
472
|
+
* `OFFICIAL_CNY` = 新合同 (1 Credit = ¥0.000001 官方价); `COST_CNY` = 老合同 (成本口径)。
|
|
473
|
+
*
|
|
474
|
+
* **缺席 = 老网关, 不能当任一取值读**; 尤其不能默认成 `OFFICIAL_CNY` 去乘 ¥ 单价。
|
|
475
|
+
* 类型是闭集, 但网关将来新增口径时旧版 SDK 会原样透出未知字符串 —— 消费端对未知值应按「不换算」处理。
|
|
476
|
+
*/
|
|
477
|
+
creditUnit?: QuotaSummaryCreditUnit;
|
|
413
478
|
}
|
|
414
479
|
/**
|
|
415
480
|
* GET /api/v4/entitlements/window-reset/summary 返回体, 调用 client.getWindowResetSummary 获取.
|
|
@@ -705,4 +770,4 @@ interface ProviderAdapter {
|
|
|
705
770
|
};
|
|
706
771
|
}
|
|
707
772
|
|
|
708
|
-
export {
|
|
773
|
+
export { bucketInfoIsCommercial as $, type SourcesEventParseResult as A, BucketClassCommercial as B, type ChatContentBlock as C, type StreamEvent as D, type EffortConfig as E, type StreamSettlement as F, type GeoLoc as G, ThinkingHigh as H, type ImageGenerationRequest as I, ThinkingHighMinMaxTokens as J, ThinkingLow as K, ThinkingMax as L, type ManagedModel as M, ThinkingMaxFallbackMaxTokens as N, type OutputConfig as O, type ProviderAdapter as P, type QuotaSummary as Q, type RerankDocument as R, type ServerTool as S, type ThinkingConfig as T, ThinkingOff as U, type VideoGenerationRequest as V, type VideoTaskResponse as W, type WebSearchConfig as X, type WebSearchSource as Y, type WindowLimitStatus as Z, type WindowResetSummary as _, BucketClassGeneric as a, bucketRowIsCommercial as a0, classifySourcesEvent as a1, newThinkingConfig as a2, newWebSearchTool as a3, parseSettlement as a4, parseSourcesEvent as a5, type BucketInfo as b, type BucketRow as c, type ChatMessage as d, type ChatRequest as e, type ChatResponse as f, type ChatUsage as g, type EmbeddingData as h, type EmbeddingRequest as i, type EmbeddingResponse as j, type ImageGenerationResponse as k, type InputModality as l, type InputModalityTag as m, type ModelCapabilities as n, type MultimodalContent as o, ProviderFormat as p, type QuotaSummaryCreditUnit as q, type QuotaSummaryFreePool as r, type QuotaSummarySubscriptionPool as s, type RerankQuery as t, type RerankRequest as u, type RerankResponse as v, type RerankResult as w, ServerToolTypeWebSearch as x, type SourcesEvent as y, type SourcesEventIssueCode as z };
|