/** * DeepSeek Open Platform balance and session consumption readout. * * Host half: resolves the harness's own DEEPSEEK_API_KEY credential, queries * the official balance endpoint through a bounded node subprocess (the API key * travels only over the child's stdin), estimates the current session's spend * from durable per-step provider usage (uncached input / cache reads / output) * against the official peak/off-peak price table (peak hours 9-12 and 14-18 * Beijing time). The page pulls everything on * demand over the built-in commands Remote namespace: * * client ctx.remote.commands.execute(sessionId, '/dsh-balance refresh') * -> host command handler -> builds payload -> returns JSON text * client ... '/dsh-balance interval ' / '/dsh-balance prices ' * -> host updates settings and returns a fresh payload * client timer -> periodic '/dsh-balance refresh' per returned nextRefreshMs * (active interval; paused detection interval after 2 quiet cycles) * * The model-facing tool `deepseek_balance` returns the same payload shape. */ import { Context } from '@deepseek-ai/cordis'; export type RateSet = { /** 输入(缓存未命中)每百万 tokens 单价(元)。 */ input: number; /** 输入(缓存命中)每百万 tokens 单价(元)。 */ cacheHit: number; /** 输出每百万 tokens 单价(元)。 */ output: number; }; export type ModelPrices = { /** 新价目表·空闲时段。 */ offPeak: RateSet; /** 新价目表·高峰时段。 */ peak: RateSet; }; export type PriceTable = { models: Record; }; export type BalanceInfo = { currency: string; total_balance: string; granted_balance: string; topped_up_balance: string; }; export type BalanceResult = { ok: true; data: { is_available: boolean; balance_infos: BalanceInfo[]; }; } | { ok: false; error: string; }; export type ConsumptionInfo = { cost: number; uncachedInput: number; cacheRead: number; output: number; model: string | null; currency: string; estimated: boolean; }; export declare const DEFAULT_PRICE_TABLE: PriceTable; export declare const name = "dsh-balance"; export declare const inject: string[]; export declare function apply(ctx: Context): void; //# sourceMappingURL=index.d.ts.map