@warlock.js/ai-anthropic 5.46.0 → 5.47.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 CHANGED
@@ -4,6 +4,13 @@ All notable changes to `@warlock.js/ai-anthropic` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 5.47.0 - 2026-11-06
8
+
9
+ ### Added
10
+
11
+ - `ANTHROPIC_MODEL_PRICING` prices `claude-haiku-5-5`, with `tiers` for prompts above 100,000 tokens (cache reads and writes counted). `ANTHROPIC_MODEL_PRICING_AS_OF` dates the table.
12
+ - `ANTHROPIC_MODEL_LIFECYCLE` and `anthropicLifecycleFor(name)` (alias or dated snapshot) give each model a status, for example `claude-sonnet-4-5` is `retiring` on 2026-11-30 and `claude-opus-4-1` is `retired`.
13
+
7
14
  ## 5.45.0 - 2026-11-05
8
15
 
9
16
  ### Added
package/cjs/index.cjs CHANGED
@@ -48,11 +48,12 @@ const ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER = 2;
48
48
  * 5-minute write rate and `cacheWrite1h` the 1-hour write rate.
49
49
  *
50
50
  * Source: https://platform.claude.com/docs/en/about-claude/pricing,
51
- * "Model pricing" table, fetched 2026-10-17. Standard (global) routing,
52
- * non-batch. Not covered, so pass `pricing` yourself when you need them:
51
+ * "Model pricing" table, as of {@link ANTHROPIC_MODEL_PRICING_AS_OF}.
52
+ * Standard (global) routing, non-batch. Claude Haiku 5.5 carries `tiers`:
53
+ * a request whose prompt (cache reads and writes included) is over
54
+ * 100,000 tokens bills at the higher rates. Not covered, so pass `pricing`
55
+ * yourself when you need them:
53
56
  *
54
- * - Claude Haiku 5.5 — priced by prompt length (higher rates above
55
- * 100,000 prompt tokens), which a flat `ModelPricing` cannot express.
56
57
  * - US-only inference (`inference_geo: "us"`, 1.1x), fast mode, the Batch
57
58
  * API, and Claude on Bedrock / Vertex AI (partner-priced).
58
59
  * - Limited-availability models (Mythos) and retired models.
@@ -61,6 +62,21 @@ const ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER = 2;
61
62
  * entry through {@link anthropicPricingFor}.
62
63
  */
63
64
  const ANTHROPIC_MODEL_PRICING = {
65
+ "claude-haiku-5-5": {
66
+ input: .1,
67
+ output: .5,
68
+ cachedInput: .01,
69
+ cacheWrite: .125,
70
+ cacheWrite1h: .2,
71
+ tiers: [{
72
+ abovePromptTokens: 1e5,
73
+ input: .5,
74
+ output: 2.5,
75
+ cachedInput: .05,
76
+ cacheWrite: .625,
77
+ cacheWrite1h: 1
78
+ }]
79
+ },
64
80
  "claude-fable-5-1": {
65
81
  input: 10,
66
82
  output: 50,
@@ -153,8 +169,10 @@ const ANTHROPIC_MODEL_PRICING = {
153
169
  cacheWrite1h: 2
154
170
  }
155
171
  };
172
+ /** The date the {@link ANTHROPIC_MODEL_PRICING} rates were last checked against Anthropic's pricing page. */
173
+ const ANTHROPIC_MODEL_PRICING_AS_OF = "2026-11-06";
156
174
  /** A trailing `-YYYYMMDD` snapshot date on a Claude model id. */
157
- const SNAPSHOT_SUFFIX = /-\d{8}$/;
175
+ const SNAPSHOT_SUFFIX$1 = /-\d{8}$/;
158
176
  /**
159
177
  * Look up the built-in list price for a Claude model id. Accepts the
160
178
  * alias (`claude-sonnet-4-5`) or a dated snapshot
@@ -163,12 +181,12 @@ const SNAPSHOT_SUFFIX = /-\d{8}$/;
163
181
  *
164
182
  * @example
165
183
  * anthropicPricingFor("claude-haiku-4-5-20251001"); // { input: 1, output: 5, … }
166
- * anthropicPricingFor("claude-haiku-5-5"); // undefined (prompt-length tiers)
184
+ * anthropicPricingFor("claude-haiku-5-5"); // { input: 0.1, output: 0.5, …, tiers: [...] }
167
185
  */
168
186
  function anthropicPricingFor(modelName) {
169
187
  const exact = ANTHROPIC_MODEL_PRICING[modelName];
170
188
  if (exact) return exact;
171
- return ANTHROPIC_MODEL_PRICING[modelName.replace(SNAPSHOT_SUFFIX, "")];
189
+ return ANTHROPIC_MODEL_PRICING[modelName.replace(SNAPSHOT_SUFFIX$1, "")];
172
190
  }
173
191
  /**
174
192
  * Fill the cache-write rates Anthropic derives from the input rate
@@ -2244,14 +2262,95 @@ var AnthropicSDK = class {
2244
2262
  }
2245
2263
  };
2246
2264
 
2265
+ //#endregion
2266
+ //#region ../../packages/ai-anthropic/src/known-lifecycle.ts
2267
+ /**
2268
+ * Where Anthropic's model-deprecations page puts the models in
2269
+ * {@link ANTHROPIC_MODEL_PRICING}, as of {@link ANTHROPIC_MODEL_LIFECYCLE_AS_OF}.
2270
+ * Active models carry no `retiresOn`: Anthropic documents only a
2271
+ * "not sooner than" date for them.
2272
+ *
2273
+ * Source: https://platform.claude.com/docs/en/about-claude/model-deprecations
2274
+ */
2275
+ const ANTHROPIC_MODEL_LIFECYCLE = {
2276
+ "claude-fable-5-1": { status: "current" },
2277
+ "claude-fable-5": { status: "current" },
2278
+ "claude-opus-5-5": { status: "current" },
2279
+ "claude-opus-5": { status: "current" },
2280
+ "claude-opus-4-8": { status: "current" },
2281
+ "claude-opus-4-7": { status: "current" },
2282
+ "claude-opus-4-6": { status: "current" },
2283
+ "claude-opus-4-5": { status: "current" },
2284
+ "claude-sonnet-5-5": { status: "current" },
2285
+ "claude-sonnet-5": { status: "current" },
2286
+ "claude-sonnet-4-6": { status: "current" },
2287
+ "claude-sonnet-4-5": {
2288
+ status: "retiring",
2289
+ retiresOn: "2026-11-30",
2290
+ replacement: "claude-sonnet-5-5"
2291
+ },
2292
+ "claude-haiku-5-5": { status: "current" },
2293
+ "claude-haiku-4-5": { status: "current" },
2294
+ "claude-opus-4-1": {
2295
+ status: "retired",
2296
+ retiresOn: "2026-08-05",
2297
+ replacement: "claude-opus-4-8"
2298
+ },
2299
+ "claude-opus-4": {
2300
+ status: "retired",
2301
+ retiresOn: "2026-06-15",
2302
+ replacement: "claude-opus-4-8"
2303
+ },
2304
+ "claude-sonnet-4": {
2305
+ status: "retired",
2306
+ retiresOn: "2026-06-15",
2307
+ replacement: "claude-sonnet-5-5"
2308
+ },
2309
+ "claude-3-7-sonnet": {
2310
+ status: "retired",
2311
+ retiresOn: "2026-02-19",
2312
+ replacement: "claude-sonnet-5-5"
2313
+ },
2314
+ "claude-3-5-haiku": {
2315
+ status: "retired",
2316
+ retiresOn: "2026-02-19",
2317
+ replacement: "claude-haiku-4-5"
2318
+ },
2319
+ "claude-3-haiku": {
2320
+ status: "retired",
2321
+ retiresOn: "2026-04-20",
2322
+ replacement: "claude-haiku-4-5"
2323
+ }
2324
+ };
2325
+ /** The date {@link ANTHROPIC_MODEL_LIFECYCLE} was last checked against Anthropic's deprecations page. */
2326
+ const ANTHROPIC_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
2327
+ /** A trailing `-YYYYMMDD` snapshot date on a Claude model id. */
2328
+ const SNAPSHOT_SUFFIX = /-\d{8}$/;
2329
+ /**
2330
+ * Look up the lifecycle of a Claude model id. Accepts the alias
2331
+ * (`claude-sonnet-4-5`) or a dated snapshot (`claude-sonnet-4-5-20250929`).
2332
+ * Returns `undefined` for an id the table does not cover.
2333
+ *
2334
+ * @example
2335
+ * anthropicLifecycleFor("claude-sonnet-4-5-20250929"); // { status: "retiring", retiresOn: "2026-11-30", … }
2336
+ */
2337
+ function anthropicLifecycleFor(modelName) {
2338
+ const id = Object.hasOwn(ANTHROPIC_MODEL_LIFECYCLE, modelName) ? modelName : modelName.replace(SNAPSHOT_SUFFIX, "");
2339
+ return Object.hasOwn(ANTHROPIC_MODEL_LIFECYCLE, id) ? ANTHROPIC_MODEL_LIFECYCLE[id] : void 0;
2340
+ }
2341
+
2247
2342
  //#endregion
2248
2343
  exports.ANTHROPIC_BLOCK_FORMAT = ANTHROPIC_BLOCK_FORMAT;
2249
2344
  exports.ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER = ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER;
2250
2345
  exports.ANTHROPIC_CACHE_WRITE_MULTIPLIER = ANTHROPIC_CACHE_WRITE_MULTIPLIER;
2346
+ exports.ANTHROPIC_MODEL_LIFECYCLE = ANTHROPIC_MODEL_LIFECYCLE;
2347
+ exports.ANTHROPIC_MODEL_LIFECYCLE_AS_OF = ANTHROPIC_MODEL_LIFECYCLE_AS_OF;
2251
2348
  exports.ANTHROPIC_MODEL_PRICING = ANTHROPIC_MODEL_PRICING;
2349
+ exports.ANTHROPIC_MODEL_PRICING_AS_OF = ANTHROPIC_MODEL_PRICING_AS_OF;
2252
2350
  exports.ANTHROPIC_SERVER_TOOL_PRICING = ANTHROPIC_SERVER_TOOL_PRICING;
2253
2351
  exports.AnthropicModel = AnthropicModel;
2254
2352
  exports.AnthropicSDK = AnthropicSDK;
2353
+ exports.anthropicLifecycleFor = anthropicLifecycleFor;
2255
2354
  exports.anthropicPricingFor = anthropicPricingFor;
2256
2355
  exports.fromProviderBlocks = fromProviderBlocks;
2257
2356
  exports.inferPreservedThinking = inferPreservedThinking;