@rayadesu/dsh-llm-billing 0.3.7 → 0.3.9

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.
@@ -1,6 +1,14 @@
1
1
  /**
2
2
  * Client-safe balance and spend vocabulary shared by the `billing` Remote,
3
3
  * its generated artifacts, and the web UI.
4
+ *
5
+ * Billing semantics (single source of truth, see billing.ts): every spend is
6
+ * priced per event by its own timestamp — Beijing-time (UTC+8, no DST) hour
7
+ * and weekday, with peak windows Monday–Friday 09:00–12:00 / 14:00–18:00 and
8
+ * weekends always off-peak; cache-hit input, cache-miss input (including
9
+ * cache writes), and output (including reasoning) are billed separately at
10
+ * per-1M-token rates. The published table prices the DeepSeek V4 rows and
11
+ * the MiMo-V2.5 series (flat rate, no peak/off-peak distinction).
4
12
  * @module @rayadesu/dsh-llm-billing/types
5
13
  */
6
14
  import type { SessionId } from '@deepseek-ai/dsh-session';
@@ -22,7 +30,7 @@ export interface DeepSeekBalance {
22
30
  /** Balance lines, one per currency; empty when the provider reports none. */
23
31
  lines: readonly DeepSeekBalanceLine[];
24
32
  }
25
- /** One model's billed spend within one session, priced by the peak/off-peak table. */
33
+ /** One model's billed spend within one session. */
26
34
  export interface DeepSeekSessionSpendModel {
27
35
  /** Wire model id, e.g. `deepseek-v4-flash`. */
28
36
  model: string;
@@ -47,21 +55,21 @@ export interface DeepSeekSessionSpendModel {
47
55
  /** Billed cost of output tokens (reasoning included) in CNY. */
48
56
  outputCost: number;
49
57
  }
50
- /** The billed spend of one session, priced per event by its Beijing-time hour and weekday (peak hours apply Monday–Friday only; weekends are off-peak). */
58
+ /** The billed spend of one session. */
51
59
  export interface DeepSeekSessionSpend {
52
60
  /** Total billed cost in CNY across every priced model. */
53
61
  total: number;
54
62
  /** One row per model that reported usage AND has a pricing row; empty when the session has no priced usage. */
55
63
  models: readonly DeepSeekSessionSpendModel[];
56
64
  }
57
- /** The billed spend of every session on one Beijing-time calendar day, priced per event by its Beijing-time hour and weekday (peak hours apply Monday–Friday only; weekends are off-peak). */
65
+ /** The billed spend of every session on one Beijing-time calendar day. */
58
66
  export interface DeepSeekTodaySpend {
59
67
  /** Total billed cost in CNY across every priced model and every session. */
60
68
  total: number;
61
69
  /** One row per model that reported usage AND has a pricing row; empty when today has no priced usage. */
62
70
  models: readonly DeepSeekSessionSpendModel[];
63
71
  }
64
- /** One session's billed spend on one Beijing-time calendar day, priced per event by its Beijing-time hour and weekday (peak hours apply Monday–Friday only; weekends are off-peak). */
72
+ /** One session's billed spend on one Beijing-time calendar day. */
65
73
  export interface DeepSeekTodaySessionSpend {
66
74
  /** The session's durable identity. */
67
75
  sessionId: SessionId;
@@ -78,9 +86,26 @@ export interface DeepSeekTodaySessionsSpend {
78
86
  /** Sessions with today's spend, sorted by `total` descending. */
79
87
  sessions: readonly DeepSeekTodaySessionSpend[];
80
88
  }
81
- /** The billed cost of one completed Turn, priced per event by its Beijing-time hour and weekday (peak hours apply Monday–Friday only; weekends are off-peak). */
89
+ /** The billed cost of one completed Turn. */
82
90
  export interface DeepSeekTurnSpend {
83
91
  /** Total billed cost in CNY across every priced model in the Turn. */
84
92
  total: number;
85
93
  }
94
+ /** One completed Turn's cost, located by the id of an assistant message inside it. */
95
+ export interface DeepSeekTurnSpendRow {
96
+ /** The durable id of one assistant message inside the Turn. */
97
+ messageId: string;
98
+ /** The Turn's total billed cost in CNY (the same value for every message of the Turn). */
99
+ total: number;
100
+ }
101
+ /**
102
+ * Every completed Turn's billed cost in one session, in log order. One call
103
+ * replaces the per-message `getTurnSpend` fan-out (the transcript renders one
104
+ * row per message; fetching the whole map once is O(log), fetching per row is
105
+ * O(messages × log)).
106
+ */
107
+ export interface DeepSeekSessionTurnSpends {
108
+ /** One row per assistant message inside a completed Turn; a Turn with N assistant messages contributes N rows. */
109
+ turns: readonly DeepSeekTurnSpendRow[];
110
+ }
86
111
  //# sourceMappingURL=types.d.ts.map
@@ -1,6 +1,14 @@
1
1
  /**
2
2
  * Client-safe balance and spend vocabulary shared by the `billing` Remote,
3
3
  * its generated artifacts, and the web UI.
4
+ *
5
+ * Billing semantics (single source of truth, see billing.ts): every spend is
6
+ * priced per event by its own timestamp — Beijing-time (UTC+8, no DST) hour
7
+ * and weekday, with peak windows Monday–Friday 09:00–12:00 / 14:00–18:00 and
8
+ * weekends always off-peak; cache-hit input, cache-miss input (including
9
+ * cache writes), and output (including reasoning) are billed separately at
10
+ * per-1M-token rates. The published table prices the DeepSeek V4 rows and
11
+ * the MiMo-V2.5 series (flat rate, no peak/off-peak distinction).
4
12
  * @module @rayadesu/dsh-llm-billing/types
5
13
  */
6
14
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rayadesu/dsh-llm-billing",
3
3
  "description": "Standalone DeepSeek account-balance and session-spend provider exposed through the billing Remote",
4
- "version": "0.3.7",
4
+ "version": "0.3.9",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -26,6 +26,10 @@
26
26
  "types": "./lib/types/types.d.ts",
27
27
  "default": "./lib/types/types.js"
28
28
  },
29
+ "./projection": {
30
+ "types": "./lib/types/projection.d.ts",
31
+ "default": "./lib/types/projection.js"
32
+ },
29
33
  "./typert": {
30
34
  "types": "./lib/typert.host.d.ts",
31
35
  "default": "./lib/typert.host.js"