floe-guard 0.15.0 → 0.15.2

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 CHANGED
@@ -64,6 +64,24 @@ const adv = guard.advisory();
64
64
  const model = adv.nearLimit ? openai("gpt-4o-mini") : openai("gpt-4o");
65
65
  ```
66
66
 
67
+ ## Request-sized estimates
68
+
69
+ To ensure the ceiling is enforced on the first run or for a call much larger than the previous one, you can price the actual incoming request using `estimateCall()` and pass the estimate to `reserve()` or `check()`:
70
+
71
+ ```ts
72
+ const est = guard.estimateCall("gpt-4o", 12_000, 4_096);
73
+ const handle = guard.reserve(est); // throws BudgetExceeded NOW if this call alone would cross
74
+ try {
75
+ const response = await callYourLlm({ model: "gpt-4o", ... });
76
+ guard.settle("gpt-4o", response.usage.promptTokens, response.usage.completionTokens, { reserved: handle });
77
+ } catch (err) {
78
+ guard.release(handle);
79
+ throw err;
80
+ }
81
+ ```
82
+
83
+ If the model is unpriceable, `estimateCall()` returns `undefined` and `reserve(undefined)` / `check(undefined)` fall back gracefully to the last-cost prediction.
84
+
67
85
  ## Tool spend under the same ceiling
68
86
 
69
87
  Paid tool calls (Apollo, Exa, scrapers) burn the same budget as tokens. The
@@ -76,15 +76,40 @@ function preCall(guard, options = {}) {
76
76
  // src/cost_map.json
77
77
  var cost_map_default = {
78
78
  __meta__: {
79
- generated_at: "2026-08-17",
79
+ generated_at: "2026-08-24",
80
80
  source: "LiteLLM public model prices (bundled snapshot); voice rates verified from vendor list pages"
81
81
  },
82
+ "chat-latest": {
83
+ input_cost_per_token: 5e-6,
84
+ output_cost_per_token: 3e-5,
85
+ litellm_provider: "openai",
86
+ mode: "chat",
87
+ cache_read_input_token_cost: 5e-7
88
+ },
82
89
  "chatgpt-4o-latest": {
83
90
  input_cost_per_token: 5e-6,
84
91
  output_cost_per_token: 15e-6,
85
92
  litellm_provider: "openai",
86
93
  mode: "chat"
87
94
  },
95
+ "claude-3-5-haiku-20241022": {
96
+ input_cost_per_token: 8e-7,
97
+ output_cost_per_token: 4e-6,
98
+ litellm_provider: "anthropic",
99
+ mode: "chat"
100
+ },
101
+ "claude-3-5-sonnet-20240620": {
102
+ input_cost_per_token: 3e-6,
103
+ output_cost_per_token: 15e-6,
104
+ litellm_provider: "anthropic",
105
+ mode: "chat"
106
+ },
107
+ "claude-3-5-sonnet-20241022": {
108
+ input_cost_per_token: 3e-6,
109
+ output_cost_per_token: 15e-6,
110
+ litellm_provider: "anthropic",
111
+ mode: "chat"
112
+ },
88
113
  "claude-3-7-sonnet-20250219": {
89
114
  input_cost_per_token: 3e-6,
90
115
  output_cost_per_token: 15e-6,
@@ -293,6 +318,22 @@ var cost_map_default = {
293
318
  cache_read_input_token_cost: 2e-7,
294
319
  cache_creation_input_token_cost: 25e-7
295
320
  },
321
+ "daybreak-blue-latest": {
322
+ input_cost_per_token: 4e-6,
323
+ output_cost_per_token: 2e-5,
324
+ litellm_provider: "openai",
325
+ mode: "chat",
326
+ cache_read_input_token_cost: 4e-7,
327
+ cache_creation_input_token_cost: 5e-6
328
+ },
329
+ "daybreak-red-latest": {
330
+ input_cost_per_token: 125e-7,
331
+ output_cost_per_token: 75e-6,
332
+ litellm_provider: "openai",
333
+ mode: "chat",
334
+ cache_read_input_token_cost: 125e-8,
335
+ cache_creation_input_token_cost: 15625e-9
336
+ },
296
337
  "ft:gpt-3.5-turbo": {
297
338
  input_cost_per_token: 3e-6,
298
339
  output_cost_per_token: 6e-6,
@@ -384,7 +425,7 @@ var cost_map_default = {
384
425
  output_cost_per_token: 4e-7,
385
426
  litellm_provider: "gemini",
386
427
  mode: "chat",
387
- cache_read_input_token_cost: 375e-10
428
+ cache_read_input_token_cost: 25e-9
388
429
  },
389
430
  "gemini-2.0-flash-lite": {
390
431
  input_cost_per_token: 75e-9,
@@ -535,12 +576,18 @@ var cost_map_default = {
535
576
  mode: "chat",
536
577
  cache_read_input_token_cost: 3e-8
537
578
  },
579
+ "gemini-3.5-live-translate-preview": {
580
+ input_cost_per_token: 35e-7,
581
+ output_cost_per_token: 21e-6,
582
+ litellm_provider: "gemini",
583
+ mode: "chat"
584
+ },
538
585
  "gemini-3.6-flash": {
539
- input_cost_per_token: 15e-7,
540
- output_cost_per_token: 75e-7,
586
+ input_cost_per_token: 75e-8,
587
+ output_cost_per_token: 375e-8,
541
588
  litellm_provider: "gemini",
542
589
  mode: "chat",
543
- cache_read_input_token_cost: 15e-8
590
+ cache_read_input_token_cost: 75e-9
544
591
  },
545
592
  "gemini-3.7-flash": {
546
593
  input_cost_per_token: 75e-8,
@@ -1027,12 +1074,20 @@ var cost_map_default = {
1027
1074
  cache_read_input_token_cost: 5e-7
1028
1075
  },
1029
1076
  "gpt-5.6": {
1030
- input_cost_per_token: 5e-6,
1031
- output_cost_per_token: 3e-5,
1077
+ input_cost_per_token: 4e-6,
1078
+ output_cost_per_token: 2e-5,
1032
1079
  litellm_provider: "openai",
1033
1080
  mode: "chat",
1034
- cache_read_input_token_cost: 5e-7,
1035
- cache_creation_input_token_cost: 625e-8
1081
+ cache_read_input_token_cost: 4e-7,
1082
+ cache_creation_input_token_cost: 5e-6
1083
+ },
1084
+ "gpt-5.6-cyber": {
1085
+ input_cost_per_token: 125e-7,
1086
+ output_cost_per_token: 75e-6,
1087
+ litellm_provider: "openai",
1088
+ mode: "chat",
1089
+ cache_read_input_token_cost: 125e-8,
1090
+ cache_creation_input_token_cost: 15625e-9
1036
1091
  },
1037
1092
  "gpt-5.6-luna": {
1038
1093
  input_cost_per_token: 2e-7,
@@ -1043,12 +1098,12 @@ var cost_map_default = {
1043
1098
  cache_creation_input_token_cost: 25e-8
1044
1099
  },
1045
1100
  "gpt-5.6-sol": {
1046
- input_cost_per_token: 5e-6,
1047
- output_cost_per_token: 3e-5,
1101
+ input_cost_per_token: 4e-6,
1102
+ output_cost_per_token: 2e-5,
1048
1103
  litellm_provider: "openai",
1049
1104
  mode: "chat",
1050
- cache_read_input_token_cost: 5e-7,
1051
- cache_creation_input_token_cost: 625e-8
1105
+ cache_read_input_token_cost: 4e-7,
1106
+ cache_creation_input_token_cost: 5e-6
1052
1107
  },
1053
1108
  "gpt-5.6-terra": {
1054
1109
  input_cost_per_token: 2e-6,
@@ -1298,24 +1353,6 @@ var cost_map_default = {
1298
1353
  rate: 4e-3,
1299
1354
  provider: "twilio"
1300
1355
  }
1301
- },
1302
- "claude-3-5-sonnet-20241022": {
1303
- input_cost_per_token: 3e-6,
1304
- output_cost_per_token: 15e-6,
1305
- litellm_provider: "anthropic",
1306
- mode: "chat"
1307
- },
1308
- "claude-3-5-sonnet-20240620": {
1309
- input_cost_per_token: 3e-6,
1310
- output_cost_per_token: 15e-6,
1311
- litellm_provider: "anthropic",
1312
- mode: "chat"
1313
- },
1314
- "claude-3-5-haiku-20241022": {
1315
- input_cost_per_token: 8e-7,
1316
- output_cost_per_token: 4e-6,
1317
- litellm_provider: "anthropic",
1318
- mode: "chat"
1319
1356
  }
1320
1357
  };
1321
1358