@jaypie/llm 1.3.16 → 1.3.18

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.
@@ -21,6 +21,8 @@ declare const EFFORT: {
21
21
  };
22
22
  type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
23
23
  declare const MODEL: {
24
+ NOVA_LITE: string;
25
+ NOVA_PRO: string;
24
26
  FABLE: string;
25
27
  OPUS: string;
26
28
  SONNET: string;
@@ -29,6 +31,7 @@ declare const MODEL: {
29
31
  FIREWORKS: {
30
32
  DEEPSEEK: string;
31
33
  GLM: string;
34
+ GPT_OSS: string;
32
35
  KIMI: string;
33
36
  MINIMAX: string;
34
37
  QWEN: string;
@@ -60,10 +63,11 @@ interface LlmModelCost {
60
63
  */
61
64
  cachedInputRead?: number;
62
65
  /**
63
- * Cache-write tokens. A scalar when the rate does not vary by TTL; keyed by
64
- * the same `"5m"` / `"1h"` literals as `LlmCache` when it does, so a cost
65
- * calculation reads the TTL straight off `OperateRequest.cache`. Omitted
66
- * means cache writes bill at the `input` rate.
66
+ * Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
67
+ * the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
68
+ * literals as `LlmCache` when it does, so a cost calculation reads the TTL
69
+ * straight off `OperateRequest.cache`. Omitted means cache writes bill at the
70
+ * `input` rate.
67
71
  */
68
72
  cachedInputWrite?: number | {
69
73
  "1h": number;
@@ -90,34 +94,39 @@ interface LlmModelCost {
90
94
  * - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
91
95
  * data-residency rates are excluded. Sonnet 5 is listed at its standard
92
96
  * $3/$15, not the introductory rate.
93
- * - **Cache writes are Anthropic-only.** Fireworks writes bill at the input
94
- * rate. OpenAI and xAI discount reads automatically and publish no write
95
- * premium. Google charges nothing to write an implicit cache; explicit
96
- * caching bills storage per hour, a unit this table does not carry (and one
97
- * `@jaypie/llm` does not wire).
97
+ * - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
98
+ * for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
99
+ * writes bill at the input rate. OpenAI and xAI discount reads automatically
100
+ * and publish no write premium. Google charges nothing to write an implicit
101
+ * cache; explicit caching bills storage per hour, a unit this table does not
102
+ * carry (and one `@jaypie/llm` does not wire).
98
103
  * - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
99
104
  * Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
100
105
  * above 272K.
101
106
  * - **Text rates.** Gemini prices audio input higher than text/image/video.
102
- * - **Proxies are deliberately absent.** Bedrock (`PROVIDER.BEDROCK.*`) and
103
- * OpenRouter (`MODEL.OPENROUTER.*`) resell many vendors and price per backend
104
- * route, so no single rate is correct for a proxy id. Price those against the
105
- * backend model, or against the proxy's own published rate.
107
+ * - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
108
+ * uncatalogued Bedrock id reselling a third-party model, are another vendor's
109
+ * model behind a gateway, priced per route and per region, so no single rate
110
+ * here would be correct. Price those against the backend model, or against
111
+ * the gateway's own published rate. Amazon's own Nova models are first-class,
112
+ * not proxies, and are priced below at the standard US on-demand rate (`us.`
113
+ * geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
114
+ * modeled).
106
115
  *
107
116
  * Unlisted ids return `undefined` — callers must handle a miss.
108
117
  */
109
118
  declare const COST: Record<string, LlmModelCost>;
110
119
  declare const PROVIDER: {
111
120
  readonly BEDROCK: {
112
- readonly DEFAULT: "amazon.nova-pro-v1:0";
113
- /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
121
+ readonly DEFAULT: string;
122
+ /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
114
123
  readonly MODEL: {
115
- readonly DEFAULT: "amazon.nova-lite-v1:0";
116
- readonly LARGE: "amazon.nova-pro-v1:0";
117
- readonly SMALL: "amazon.nova-lite-v1:0";
118
- readonly TINY: "amazon.nova-micro-v1:0";
124
+ readonly DEFAULT: string;
125
+ readonly LARGE: string;
126
+ readonly SMALL: string;
127
+ readonly TINY: string;
119
128
  };
120
- readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "ai21."];
129
+ readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
121
130
  readonly NAME: "bedrock";
122
131
  readonly REGION: "AWS_REGION";
123
132
  };
@@ -660,7 +669,8 @@ interface LlmExchangeEnvelope {
660
669
  type LlmExchangeCallback = (envelope: LlmExchangeEnvelope) => unknown | Promise<unknown>;
661
670
  /**
662
671
  * Prompt-caching control for operate()/stream().
663
- * - `true` / omitted → caching enabled at the default `"5m"` TTL
672
+ * - `true` / omitted → caching enabled at the adapter's default TTL: `"1h"` on
673
+ * Anthropic, `"5m"` everywhere else
664
674
  * - `false` / `0` → caching disabled
665
675
  * - `"5m"` / `"1h"` → enabled at that TTL (TTL honored by Anthropic/OpenRouter;
666
676
  * other providers ignore it and cache with their own defaults)
@@ -51,7 +51,7 @@ type AnnotatedBedrockResponse = ConverseCommandOutput & {
51
51
  export declare function isCachePointUnsupportedError(error: unknown): boolean;
52
52
  export declare class BedrockAdapter extends BaseProviderAdapter {
53
53
  readonly name: "bedrock";
54
- readonly defaultModel: "amazon.nova-pro-v1:0";
54
+ readonly defaultModel: string;
55
55
  private _modelsFallbackToStructuredOutputTool;
56
56
  private _modelsWithoutTemperature;
57
57
  private _modelsWithoutCachePoint;
@@ -290,7 +290,8 @@ export interface LlmExchangeEnvelope {
290
290
  export type LlmExchangeCallback = (envelope: LlmExchangeEnvelope) => unknown | Promise<unknown>;
291
291
  /**
292
292
  * Prompt-caching control for operate()/stream().
293
- * - `true` / omitted → caching enabled at the default `"5m"` TTL
293
+ * - `true` / omitted → caching enabled at the adapter's default TTL: `"1h"` on
294
+ * Anthropic, `"5m"` everywhere else
294
295
  * - `false` / `0` → caching disabled
295
296
  * - `"5m"` / `"1h"` → enabled at that TTL (TTL honored by Anthropic/OpenRouter;
296
297
  * other providers ignore it and cache with their own defaults)
@@ -1,5 +1,11 @@
1
1
  import { type LlmCache } from "../types/LlmProvider.interface.js";
2
2
  export declare const CACHE_TTL_DEFAULT: "5m";
3
+ /**
4
+ * Anthropic bills a 1h cache write at 2x input (vs 1.25x for 5m) but reads at
5
+ * the same ~0.1x, so an hour of reuse pays for itself after ~three reads and
6
+ * survives the gaps between turns in a long agentic session.
7
+ */
8
+ export declare const CACHE_TTL_ANTHROPIC_DEFAULT: "1h";
3
9
  export type CacheTtl = "5m" | "1h";
4
10
  export interface ResolvedCache {
5
11
  enabled: boolean;
@@ -7,11 +13,13 @@ export interface ResolvedCache {
7
13
  }
8
14
  /**
9
15
  * Normalize the caller-facing `cache` option into a concrete decision.
10
- * - `undefined` / `true` → enabled at the default TTL
16
+ * - `undefined` / `true` → enabled at `defaultTtl`
11
17
  * - `false` / `0` → disabled
12
18
  * - `"5m"` / `"1h"` → enabled at that TTL
13
19
  */
14
- export declare function resolveCache(cache: LlmCache | undefined): ResolvedCache;
20
+ export declare function resolveCache(cache: LlmCache | undefined, { defaultTtl }?: {
21
+ defaultTtl?: CacheTtl;
22
+ }): ResolvedCache;
15
23
  /**
16
24
  * Deterministic short key for providers with automatic, prefix-based caching
17
25
  * (e.g. OpenAI `prompt_cache_key`). Derived from the stable prefix so the same
@@ -16,6 +16,8 @@ export declare const EFFORT: {
16
16
  };
17
17
  export type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
18
18
  export declare const MODEL: {
19
+ NOVA_LITE: string;
20
+ NOVA_PRO: string;
19
21
  FABLE: string;
20
22
  OPUS: string;
21
23
  SONNET: string;
@@ -24,6 +26,7 @@ export declare const MODEL: {
24
26
  FIREWORKS: {
25
27
  DEEPSEEK: string;
26
28
  GLM: string;
29
+ GPT_OSS: string;
27
30
  KIMI: string;
28
31
  MINIMAX: string;
29
32
  QWEN: string;
@@ -55,10 +58,11 @@ export interface LlmModelCost {
55
58
  */
56
59
  cachedInputRead?: number;
57
60
  /**
58
- * Cache-write tokens. A scalar when the rate does not vary by TTL; keyed by
59
- * the same `"5m"` / `"1h"` literals as `LlmCache` when it does, so a cost
60
- * calculation reads the TTL straight off `OperateRequest.cache`. Omitted
61
- * means cache writes bill at the `input` rate.
61
+ * Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
62
+ * the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
63
+ * literals as `LlmCache` when it does, so a cost calculation reads the TTL
64
+ * straight off `OperateRequest.cache`. Omitted means cache writes bill at the
65
+ * `input` rate.
62
66
  */
63
67
  cachedInputWrite?: number | {
64
68
  "1h": number;
@@ -85,34 +89,39 @@ export interface LlmModelCost {
85
89
  * - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
86
90
  * data-residency rates are excluded. Sonnet 5 is listed at its standard
87
91
  * $3/$15, not the introductory rate.
88
- * - **Cache writes are Anthropic-only.** Fireworks writes bill at the input
89
- * rate. OpenAI and xAI discount reads automatically and publish no write
90
- * premium. Google charges nothing to write an implicit cache; explicit
91
- * caching bills storage per hour, a unit this table does not carry (and one
92
- * `@jaypie/llm` does not wire).
92
+ * - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
93
+ * for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
94
+ * writes bill at the input rate. OpenAI and xAI discount reads automatically
95
+ * and publish no write premium. Google charges nothing to write an implicit
96
+ * cache; explicit caching bills storage per hour, a unit this table does not
97
+ * carry (and one `@jaypie/llm` does not wire).
93
98
  * - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
94
99
  * Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
95
100
  * above 272K.
96
101
  * - **Text rates.** Gemini prices audio input higher than text/image/video.
97
- * - **Proxies are deliberately absent.** Bedrock (`PROVIDER.BEDROCK.*`) and
98
- * OpenRouter (`MODEL.OPENROUTER.*`) resell many vendors and price per backend
99
- * route, so no single rate is correct for a proxy id. Price those against the
100
- * backend model, or against the proxy's own published rate.
102
+ * - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
103
+ * uncatalogued Bedrock id reselling a third-party model, are another vendor's
104
+ * model behind a gateway, priced per route and per region, so no single rate
105
+ * here would be correct. Price those against the backend model, or against
106
+ * the gateway's own published rate. Amazon's own Nova models are first-class,
107
+ * not proxies, and are priced below at the standard US on-demand rate (`us.`
108
+ * geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
109
+ * modeled).
101
110
  *
102
111
  * Unlisted ids return `undefined` — callers must handle a miss.
103
112
  */
104
113
  export declare const COST: Record<string, LlmModelCost>;
105
114
  export declare const PROVIDER: {
106
115
  readonly BEDROCK: {
107
- readonly DEFAULT: "amazon.nova-pro-v1:0";
108
- /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
116
+ readonly DEFAULT: string;
117
+ /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
109
118
  readonly MODEL: {
110
- readonly DEFAULT: "amazon.nova-lite-v1:0";
111
- readonly LARGE: "amazon.nova-pro-v1:0";
112
- readonly SMALL: "amazon.nova-lite-v1:0";
113
- readonly TINY: "amazon.nova-micro-v1:0";
119
+ readonly DEFAULT: string;
120
+ readonly LARGE: string;
121
+ readonly SMALL: string;
122
+ readonly TINY: string;
114
123
  };
115
- readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "ai21."];
124
+ readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
116
125
  readonly NAME: "bedrock";
117
126
  readonly REGION: "AWS_REGION";
118
127
  };
@@ -21,6 +21,8 @@ declare const EFFORT: {
21
21
  };
22
22
  type LlmEffort = (typeof EFFORT)[keyof typeof EFFORT];
23
23
  declare const MODEL: {
24
+ NOVA_LITE: string;
25
+ NOVA_PRO: string;
24
26
  FABLE: string;
25
27
  OPUS: string;
26
28
  SONNET: string;
@@ -29,6 +31,7 @@ declare const MODEL: {
29
31
  FIREWORKS: {
30
32
  DEEPSEEK: string;
31
33
  GLM: string;
34
+ GPT_OSS: string;
32
35
  KIMI: string;
33
36
  MINIMAX: string;
34
37
  QWEN: string;
@@ -60,10 +63,11 @@ interface LlmModelCost {
60
63
  */
61
64
  cachedInputRead?: number;
62
65
  /**
63
- * Cache-write tokens. A scalar when the rate does not vary by TTL; keyed by
64
- * the same `"5m"` / `"1h"` literals as `LlmCache` when it does, so a cost
65
- * calculation reads the TTL straight off `OperateRequest.cache`. Omitted
66
- * means cache writes bill at the `input` rate.
66
+ * Cache-write tokens. A scalar when the rate does not vary by TTL (`0` where
67
+ * the provider publishes a free write); keyed by the same `"5m"` / `"1h"`
68
+ * literals as `LlmCache` when it does, so a cost calculation reads the TTL
69
+ * straight off `OperateRequest.cache`. Omitted means cache writes bill at the
70
+ * `input` rate.
67
71
  */
68
72
  cachedInputWrite?: number | {
69
73
  "1h": number;
@@ -90,34 +94,39 @@ interface LlmModelCost {
90
94
  * - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
91
95
  * data-residency rates are excluded. Sonnet 5 is listed at its standard
92
96
  * $3/$15, not the introductory rate.
93
- * - **Cache writes are Anthropic-only.** Fireworks writes bill at the input
94
- * rate. OpenAI and xAI discount reads automatically and publish no write
95
- * premium. Google charges nothing to write an implicit cache; explicit
96
- * caching bills storage per hour, a unit this table does not carry (and one
97
- * `@jaypie/llm` does not wire).
97
+ * - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
98
+ * for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
99
+ * writes bill at the input rate. OpenAI and xAI discount reads automatically
100
+ * and publish no write premium. Google charges nothing to write an implicit
101
+ * cache; explicit caching bills storage per hour, a unit this table does not
102
+ * carry (and one `@jaypie/llm` does not wire).
98
103
  * - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
99
104
  * Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
100
105
  * above 272K.
101
106
  * - **Text rates.** Gemini prices audio input higher than text/image/video.
102
- * - **Proxies are deliberately absent.** Bedrock (`PROVIDER.BEDROCK.*`) and
103
- * OpenRouter (`MODEL.OPENROUTER.*`) resell many vendors and price per backend
104
- * route, so no single rate is correct for a proxy id. Price those against the
105
- * backend model, or against the proxy's own published rate.
107
+ * - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
108
+ * uncatalogued Bedrock id reselling a third-party model, are another vendor's
109
+ * model behind a gateway, priced per route and per region, so no single rate
110
+ * here would be correct. Price those against the backend model, or against
111
+ * the gateway's own published rate. Amazon's own Nova models are first-class,
112
+ * not proxies, and are priced below at the standard US on-demand rate (`us.`
113
+ * geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
114
+ * modeled).
106
115
  *
107
116
  * Unlisted ids return `undefined` — callers must handle a miss.
108
117
  */
109
118
  declare const COST: Record<string, LlmModelCost>;
110
119
  declare const PROVIDER: {
111
120
  readonly BEDROCK: {
112
- readonly DEFAULT: "amazon.nova-pro-v1:0";
113
- /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
121
+ readonly DEFAULT: string;
122
+ /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
114
123
  readonly MODEL: {
115
- readonly DEFAULT: "amazon.nova-lite-v1:0";
116
- readonly LARGE: "amazon.nova-pro-v1:0";
117
- readonly SMALL: "amazon.nova-lite-v1:0";
118
- readonly TINY: "amazon.nova-micro-v1:0";
124
+ readonly DEFAULT: string;
125
+ readonly LARGE: string;
126
+ readonly SMALL: string;
127
+ readonly TINY: string;
119
128
  };
120
- readonly MODEL_MATCH_WORDS: readonly ["amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "meta.llama", "mistral.mistral", "ai21."];
129
+ readonly MODEL_MATCH_WORDS: readonly ["ai21.", "amazon.nova", "amazon.titan", "anthropic.claude", "cohere.command", "deepseek.", "google.gemma", "meta.llama", "mistral.mistral", "moonshotai.", "openai.gpt-oss", "qwen."];
121
130
  readonly NAME: "bedrock";
122
131
  readonly REGION: "AWS_REGION";
123
132
  };
@@ -660,7 +669,8 @@ interface LlmExchangeEnvelope {
660
669
  type LlmExchangeCallback = (envelope: LlmExchangeEnvelope) => unknown | Promise<unknown>;
661
670
  /**
662
671
  * Prompt-caching control for operate()/stream().
663
- * - `true` / omitted → caching enabled at the default `"5m"` TTL
672
+ * - `true` / omitted → caching enabled at the adapter's default TTL: `"1h"` on
673
+ * Anthropic, `"5m"` everywhere else
664
674
  * - `false` / `0` → caching disabled
665
675
  * - `"5m"` / `"1h"` → enabled at that TTL (TTL honored by Anthropic/OpenRouter;
666
676
  * other providers ignore it and cache with their own defaults)
package/dist/esm/index.js CHANGED
@@ -28,6 +28,11 @@ const EFFORT = {
28
28
  HIGHEST: "highest",
29
29
  };
30
30
  const MODEL = {
31
+ // Amazon (Nova; the only first-class models served over Bedrock. Bedrock also
32
+ // resells other vendors, but those routes are not catalogued — reach them by
33
+ // passing the literal id, which determineModelProvider resolves to bedrock.)
34
+ NOVA_LITE: "us.amazon.nova-2-lite-v1:0",
35
+ NOVA_PRO: "amazon.nova-pro-v1:0",
31
36
  // Anthropic
32
37
  FABLE: "claude-fable-5",
33
38
  OPUS: "claude-opus-4-8",
@@ -38,6 +43,7 @@ const MODEL = {
38
43
  FIREWORKS: {
39
44
  DEEPSEEK: "accounts/fireworks/models/deepseek-v4-pro",
40
45
  GLM: "accounts/fireworks/models/glm-5p2",
46
+ GPT_OSS: "accounts/fireworks/models/gpt-oss-120b",
41
47
  KIMI: "accounts/fireworks/models/kimi-k2p7-code",
42
48
  MINIMAX: "accounts/fireworks/models/minimax-m2p7",
43
49
  QWEN: "accounts/fireworks/models/qwen3p7-plus",
@@ -76,23 +82,51 @@ const MODEL = {
76
82
  * - **Standard rate only.** Introductory, batch, flex, priority, fast-mode, and
77
83
  * data-residency rates are excluded. Sonnet 5 is listed at its standard
78
84
  * $3/$15, not the introductory rate.
79
- * - **Cache writes are Anthropic-only.** Fireworks writes bill at the input
80
- * rate. OpenAI and xAI discount reads automatically and publish no write
81
- * premium. Google charges nothing to write an implicit cache; explicit
82
- * caching bills storage per hour, a unit this table does not carry (and one
83
- * `@jaypie/llm` does not wire).
85
+ * - **Cache writes are Anthropic-only.** Bedrock publishes a literal $0 write
86
+ * for Amazon's own models, recorded here as `cachedInputWrite: 0`. Fireworks
87
+ * writes bill at the input rate. OpenAI and xAI discount reads automatically
88
+ * and publish no write premium. Google charges nothing to write an implicit
89
+ * cache; explicit caching bills storage per hour, a unit this table does not
90
+ * carry (and one `@jaypie/llm` does not wire).
84
91
  * - **Short-context tier.** Long-prompt surcharges are not modeled: Gemini 3.1
85
92
  * Pro doubles above 200K, Grok doubles at 200K, GPT-5.5 is 2x in / 1.5x out
86
93
  * above 272K.
87
94
  * - **Text rates.** Gemini prices audio input higher than text/image/video.
88
- * - **Proxies are deliberately absent.** Bedrock (`PROVIDER.BEDROCK.*`) and
89
- * OpenRouter (`MODEL.OPENROUTER.*`) resell many vendors and price per backend
90
- * route, so no single rate is correct for a proxy id. Price those against the
91
- * backend model, or against the proxy's own published rate.
95
+ * - **Proxy routes are deliberately absent.** `MODEL.OPENROUTER.*`, and any
96
+ * uncatalogued Bedrock id reselling a third-party model, are another vendor's
97
+ * model behind a gateway, priced per route and per region, so no single rate
98
+ * here would be correct. Price those against the backend model, or against
99
+ * the gateway's own published rate. Amazon's own Nova models are first-class,
100
+ * not proxies, and are priced below at the standard US on-demand rate (`us.`
101
+ * geo profile for Nova 2 Lite; the `global.` profile is cheaper and is not
102
+ * modeled).
92
103
  *
93
104
  * Unlisted ids return `undefined` — callers must handle a miss.
94
105
  */
95
106
  const COST = {
107
+ // Amazon — AWS Price List API, AmazonBedrock/us-east-1 (published 2026-07-20;
108
+ // us-west-2 identical). https://aws.amazon.com/bedrock/pricing/ renders its
109
+ // tables in JavaScript, so the Price List offer file is the citable source.
110
+ // Nova 2 Lite is quoted at the `us.` geo rate this catalog's id bills against;
111
+ // the `global.` profile is $0.30/$2.50 and is not modeled.
112
+ "amazon.nova-lite-v1:0": {
113
+ cachedInputRead: 0.015,
114
+ cachedInputWrite: 0,
115
+ input: 0.06,
116
+ output: 0.24,
117
+ },
118
+ "amazon.nova-pro-v1:0": {
119
+ cachedInputRead: 0.2,
120
+ cachedInputWrite: 0,
121
+ input: 0.8,
122
+ output: 3.2,
123
+ },
124
+ "us.amazon.nova-2-lite-v1:0": {
125
+ cachedInputRead: 0.0825,
126
+ cachedInputWrite: 0,
127
+ input: 0.33,
128
+ output: 2.75,
129
+ },
96
130
  // Anthropic — https://platform.claude.com/docs/en/about-claude/pricing
97
131
  "claude-3-5-haiku-20241022": {
98
132
  cachedInputRead: 0.08,
@@ -183,6 +217,11 @@ const COST = {
183
217
  input: 1.4,
184
218
  output: 4.4,
185
219
  },
220
+ "accounts/fireworks/models/gpt-oss-120b": {
221
+ cachedInputRead: 0.015,
222
+ input: 0.15,
223
+ output: 0.6,
224
+ },
186
225
  "accounts/fireworks/models/kimi-k2p7-code": {
187
226
  cachedInputRead: 0.19,
188
227
  input: 0.95,
@@ -193,6 +232,14 @@ const COST = {
193
232
  input: 0.3,
194
233
  output: 1.2,
195
234
  },
235
+ // Retired from MODEL.* on 2026-07-21: its structured output is
236
+ // nondeterministic (clean JSON, prose, or an empty array from the same
237
+ // request). Priced here so historic usage stays replayable.
238
+ "accounts/fireworks/models/nemotron-3-ultra-nvfp4": {
239
+ cachedInputRead: 0.12,
240
+ input: 0.6,
241
+ output: 2.4,
242
+ },
196
243
  "accounts/fireworks/models/qwen3p7-plus": {
197
244
  cachedInputRead: 0.08,
198
245
  input: 0.4,
@@ -256,24 +303,28 @@ const GOOGLE_PROVIDER = {
256
303
  const PROVIDER = {
257
304
  // https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html
258
305
  BEDROCK: {
259
- // Bedrock has no MODEL.* catalog entry yet; keep the literal default id.
260
306
  // nova-pro is the Amazon-native model that reliably does tools+structured.
261
- DEFAULT: "amazon.nova-pro-v1:0",
262
- /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT. */
307
+ DEFAULT: MODEL.NOVA_PRO,
308
+ /** @deprecated Size tiers are retired in 2.0. Use PROVIDER.BEDROCK.DEFAULT, or pick a specific model from MODEL.NOVA_*. */
263
309
  MODEL: {
264
- DEFAULT: "amazon.nova-lite-v1:0",
265
- LARGE: "amazon.nova-pro-v1:0",
266
- SMALL: "amazon.nova-lite-v1:0",
267
- TINY: "amazon.nova-micro-v1:0",
310
+ DEFAULT: MODEL.NOVA_LITE,
311
+ LARGE: MODEL.NOVA_PRO,
312
+ SMALL: MODEL.NOVA_LITE,
313
+ TINY: MODEL.NOVA_LITE,
268
314
  },
269
315
  MODEL_MATCH_WORDS: [
316
+ "ai21.",
270
317
  "amazon.nova",
271
318
  "amazon.titan",
272
319
  "anthropic.claude",
273
320
  "cohere.command",
321
+ "deepseek.",
322
+ "google.gemma",
274
323
  "meta.llama",
275
324
  "mistral.mistral",
276
- "ai21.",
325
+ "moonshotai.",
326
+ "openai.gpt-oss",
327
+ "qwen.",
277
328
  ],
278
329
  NAME: "bedrock",
279
330
  REGION: "AWS_REGION",
@@ -740,21 +791,27 @@ function buildExchangeEnvelope({ duration, initialHistoryLength, input, options,
740
791
  }
741
792
 
742
793
  const CACHE_TTL_DEFAULT = "5m";
794
+ /**
795
+ * Anthropic bills a 1h cache write at 2x input (vs 1.25x for 5m) but reads at
796
+ * the same ~0.1x, so an hour of reuse pays for itself after ~three reads and
797
+ * survives the gaps between turns in a long agentic session.
798
+ */
799
+ const CACHE_TTL_ANTHROPIC_DEFAULT = "1h";
743
800
  /**
744
801
  * Normalize the caller-facing `cache` option into a concrete decision.
745
- * - `undefined` / `true` → enabled at the default TTL
802
+ * - `undefined` / `true` → enabled at `defaultTtl`
746
803
  * - `false` / `0` → disabled
747
804
  * - `"5m"` / `"1h"` → enabled at that TTL
748
805
  */
749
- function resolveCache(cache) {
806
+ function resolveCache(cache, { defaultTtl = CACHE_TTL_DEFAULT } = {}) {
750
807
  if (cache === false || cache === 0) {
751
- return { enabled: false, ttl: CACHE_TTL_DEFAULT };
808
+ return { enabled: false, ttl: defaultTtl };
752
809
  }
753
810
  if (cache === "5m" || cache === "1h") {
754
811
  return { enabled: true, ttl: cache };
755
812
  }
756
813
  // undefined or true
757
- return { enabled: true, ttl: CACHE_TTL_DEFAULT };
814
+ return { enabled: true, ttl: defaultTtl };
758
815
  }
759
816
  /**
760
817
  * Deterministic short key for providers with automatic, prefix-based caching
@@ -2566,7 +2623,9 @@ class AnthropicAdapter extends BaseProviderAdapter {
2566
2623
  PROVIDER.ANTHROPIC.MAX_TOKENS.DEFAULT,
2567
2624
  stream: false,
2568
2625
  };
2569
- const cache = resolveCache(request.cache);
2626
+ const cache = resolveCache(request.cache, {
2627
+ defaultTtl: CACHE_TTL_ANTHROPIC_DEFAULT,
2628
+ });
2570
2629
  const cacheControl = cache.enabled
2571
2630
  ? {
2572
2631
  type: "ephemeral",