@broberg/ai-sdk 0.18.0 → 0.19.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/dist/chunk-V5AQYES2.js +100 -0
- package/dist/chunk-V5AQYES2.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -97
- package/dist/index.js.map +1 -1
- package/dist/pricing.d.ts +40 -0
- package/dist/pricing.js +118 -0
- package/dist/pricing.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/cost/pricing.ts
|
|
2
|
+
var V = "2026-06-02";
|
|
3
|
+
var MS = "2026-06-04-mistral.ai";
|
|
4
|
+
var PRICING = {
|
|
5
|
+
// Anthropic (direct API). DEFAULT_TIER_MAP: fast/cheap=haiku, smart/vision=sonnet, powerful=opus.
|
|
6
|
+
"anthropic:claude-haiku-4-5": {
|
|
7
|
+
inputPer1M: 0.8,
|
|
8
|
+
outputPer1M: 4,
|
|
9
|
+
cacheReadPer1M: 0.08,
|
|
10
|
+
cacheWritePer1M: 1,
|
|
11
|
+
version: V
|
|
12
|
+
},
|
|
13
|
+
"anthropic:claude-sonnet-4-6": {
|
|
14
|
+
inputPer1M: 3,
|
|
15
|
+
outputPer1M: 15,
|
|
16
|
+
cacheReadPer1M: 0.3,
|
|
17
|
+
cacheWritePer1M: 3.75,
|
|
18
|
+
version: V
|
|
19
|
+
},
|
|
20
|
+
"anthropic:claude-opus-4-8": {
|
|
21
|
+
inputPer1M: 15,
|
|
22
|
+
outputPer1M: 75,
|
|
23
|
+
cacheReadPer1M: 1.5,
|
|
24
|
+
cacheWritePer1M: 18.75,
|
|
25
|
+
version: V
|
|
26
|
+
},
|
|
27
|
+
// OpenAI. embedding default tier = text-embedding-3-small (no output tokens).
|
|
28
|
+
"openai:text-embedding-3-small": { inputPer1M: 0.02, outputPer1M: 0, version: V },
|
|
29
|
+
"openai:text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0, version: V },
|
|
30
|
+
"openai:gpt-4o": { inputPer1M: 2.5, outputPer1M: 10, version: V },
|
|
31
|
+
"openai:gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.6, version: V },
|
|
32
|
+
// Whisper is priced per minute, not per token — not representable here; transcribe
|
|
33
|
+
// (F5.6) computes its own cost. Listed as 0 so token-based compute never charges it.
|
|
34
|
+
"openai:whisper-1": { inputPer1M: 0, outputPer1M: 0, version: V },
|
|
35
|
+
// OpenRouter (meta-router — model slugs include the upstream vendor). Slugs use
|
|
36
|
+
// dots (claude-sonnet-4.6) to match OpenRouter's live ids; the dashed forms
|
|
37
|
+
// never matched a real call. Caught by the F014 catalogue research.
|
|
38
|
+
"openrouter:anthropic/claude-sonnet-4.6": { inputPer1M: 3, outputPer1M: 15, version: V },
|
|
39
|
+
// OpenRouter ground-truth $1/$5 — a markup over Anthropic-direct's $0.8/$4
|
|
40
|
+
// (the `anthropic:` entry above). Was masked while the slug used dashes.
|
|
41
|
+
"openrouter:anthropic/claude-haiku-4.5": { inputPer1M: 1, outputPer1M: 5, version: "2026-06-04" },
|
|
42
|
+
"openrouter:google/gemini-2.5-flash": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },
|
|
43
|
+
// Ground-truth from OpenRouter /api/v1/models (was a 0.3 estimate; now 0.279).
|
|
44
|
+
"openrouter:minimax/minimax-m2.7": {
|
|
45
|
+
inputPer1M: 0.279,
|
|
46
|
+
outputPer1M: 1.2,
|
|
47
|
+
version: "2026-06-04"
|
|
48
|
+
},
|
|
49
|
+
// DeepSeek V4 (CN-hosted — NOT GDPR-safe; non-personal-data workloads only).
|
|
50
|
+
// On 2026-05-22 DeepSeek made the "75% off" promo the permanent official price.
|
|
51
|
+
// V4-Pro $0.435/$0.87 is ~34x cheaper than GPT-5.5 on output; flash is cheaper
|
|
52
|
+
// still. Numbers match OpenRouter /api/v1/models 1:1 (no router markup). A strong
|
|
53
|
+
// cheap route for fleet background work once `claude -p` is API-billed (15 Jun).
|
|
54
|
+
"openrouter:deepseek/deepseek-v4-pro": { inputPer1M: 0.435, outputPer1M: 0.87, version: "2026-05-22-deepseek-official" },
|
|
55
|
+
"openrouter:deepseek/deepseek-v4-flash": { inputPer1M: 0.0983, outputPer1M: 0.1966, version: "2026-05-22-deepseek-official" },
|
|
56
|
+
// Google Gemini (direct). Provider key is "gemini" — matches the adapter's
|
|
57
|
+
// usage.provider + the override.provider callers pass. (Image-gen models are
|
|
58
|
+
// priced per-image in the adapter, not here.)
|
|
59
|
+
"gemini:gemini-2.5-flash": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },
|
|
60
|
+
// flash-lite is the default `video` tier (F019) — cheap native video understanding.
|
|
61
|
+
"gemini:gemini-2.5-flash-lite": { inputPer1M: 0.1, outputPer1M: 0.4, version: "2026-06-04-or-xref" },
|
|
62
|
+
// Mistral (direct, La Plateforme). Official prices from mistral.ai/pricing
|
|
63
|
+
// (2026-06-04, per Christian's CD report). EU/Paris-hosted — the designated
|
|
64
|
+
// GDPR-safe provider for client/personal-data workloads (see F015). NB:
|
|
65
|
+
// medium-3.5 is the premium "Vibe" coding tier ($1.5/$7.5); Large 3 ($0.5/$1.5)
|
|
66
|
+
// is the cheaper frontier general-purpose model despite the higher number.
|
|
67
|
+
"mistral:mistral-large-latest": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
68
|
+
"mistral:mistral-large-2512": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
69
|
+
"mistral:mistral-medium-latest": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },
|
|
70
|
+
"mistral:mistral-medium-3.5": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },
|
|
71
|
+
"mistral:mistral-medium-3": { inputPer1M: 0.4, outputPer1M: 2, version: "2026-06-04-or-xref" },
|
|
72
|
+
"mistral:mistral-small-latest": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },
|
|
73
|
+
"mistral:mistral-small-2603": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },
|
|
74
|
+
"mistral:ministral-3b-latest": { inputPer1M: 0.1, outputPer1M: 0.1, version: MS },
|
|
75
|
+
"mistral:ministral-8b-latest": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },
|
|
76
|
+
"mistral:ministral-14b-latest": { inputPer1M: 0.2, outputPer1M: 0.2, version: MS },
|
|
77
|
+
"mistral:magistral-medium-latest": { inputPer1M: 2, outputPer1M: 5, version: MS },
|
|
78
|
+
"mistral:magistral-small-latest": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
79
|
+
"mistral:devstral-latest": { inputPer1M: 0.4, outputPer1M: 2, version: MS },
|
|
80
|
+
"mistral:codestral-latest": { inputPer1M: 0.3, outputPer1M: 0.9, version: MS },
|
|
81
|
+
"mistral:open-mistral-nemo": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },
|
|
82
|
+
// Moderation (F016.4) — per input token; output 0. (OCR is per-page in the adapter.)
|
|
83
|
+
"mistral:mistral-moderation-latest": { inputPer1M: 0.1, outputPer1M: 0, version: MS },
|
|
84
|
+
// Embeddings (F016.5) — per input token.
|
|
85
|
+
"mistral:mistral-embed": { inputPer1M: 0.1, outputPer1M: 0, version: MS },
|
|
86
|
+
"mistral:codestral-embed": { inputPer1M: 0.15, outputPer1M: 0, version: MS }
|
|
87
|
+
};
|
|
88
|
+
function getPrice(provider, model) {
|
|
89
|
+
const exact = PRICING[`${provider}:${model}`];
|
|
90
|
+
if (exact) return exact;
|
|
91
|
+
const base = model.replace(/-\d{8}$/, "");
|
|
92
|
+
if (base !== model) return PRICING[`${provider}:${base}`];
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
PRICING,
|
|
98
|
+
getPrice
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=chunk-V5AQYES2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cost/pricing.ts"],"sourcesContent":["// Versioned per-(provider, model) pricing. F3.6 populates the table + adds tests\n// + MiniMax coverage. F3.1 ships the type + lookup with an empty table, so\n// computeCost returns 0 for every model until F3.6 lands (calls still complete).\nexport interface PricingEntry {\n /** USD per 1M input tokens. */\n inputPer1M: number;\n /** USD per 1M output tokens. */\n outputPer1M: number;\n /** USD per 1M cache-read tokens (falls back to input rate if unset). */\n cacheReadPer1M?: number;\n /** USD per 1M cache-write/creation tokens (falls back to input rate if unset). */\n cacheWritePer1M?: number;\n /** Pricing snapshot version (date or tag) so stale entries are detectable. */\n version: string;\n}\n\n// USD per 1M tokens. Anthropic cache multipliers follow the standard model:\n// cache-read ≈ 0.1× input, cache-write ≈ 1.25× input. Verified against the\n// pricing tables in cms (packages/cms-ai/src/providers) + trail (model-lab).\n// MiniMax M2.7 is an estimate pending confirmation against OpenRouter's live\n// price page — flagged in its version string.\nconst V = \"2026-06-02\";\n// Mistral prices come straight from mistral.ai/pricing (per Christian's CD report).\nconst MS = \"2026-06-04-mistral.ai\";\n\n/** Keyed `${provider}:${model}`. Exported so the catalogue-research job (F014)\n * can enumerate every priced entry and diff it against the live provider lists. */\nexport const PRICING: Record<string, PricingEntry> = {\n // Anthropic (direct API). DEFAULT_TIER_MAP: fast/cheap=haiku, smart/vision=sonnet, powerful=opus.\n \"anthropic:claude-haiku-4-5\": {\n inputPer1M: 0.8,\n outputPer1M: 4.0,\n cacheReadPer1M: 0.08,\n cacheWritePer1M: 1.0,\n version: V,\n },\n \"anthropic:claude-sonnet-4-6\": {\n inputPer1M: 3.0,\n outputPer1M: 15.0,\n cacheReadPer1M: 0.3,\n cacheWritePer1M: 3.75,\n version: V,\n },\n \"anthropic:claude-opus-4-8\": {\n inputPer1M: 15.0,\n outputPer1M: 75.0,\n cacheReadPer1M: 1.5,\n cacheWritePer1M: 18.75,\n version: V,\n },\n\n // OpenAI. embedding default tier = text-embedding-3-small (no output tokens).\n \"openai:text-embedding-3-small\": { inputPer1M: 0.02, outputPer1M: 0, version: V },\n \"openai:text-embedding-3-large\": { inputPer1M: 0.13, outputPer1M: 0, version: V },\n \"openai:gpt-4o\": { inputPer1M: 2.5, outputPer1M: 10.0, version: V },\n \"openai:gpt-4o-mini\": { inputPer1M: 0.15, outputPer1M: 0.6, version: V },\n // Whisper is priced per minute, not per token — not representable here; transcribe\n // (F5.6) computes its own cost. Listed as 0 so token-based compute never charges it.\n \"openai:whisper-1\": { inputPer1M: 0, outputPer1M: 0, version: V },\n\n // OpenRouter (meta-router — model slugs include the upstream vendor). Slugs use\n // dots (claude-sonnet-4.6) to match OpenRouter's live ids; the dashed forms\n // never matched a real call. Caught by the F014 catalogue research.\n \"openrouter:anthropic/claude-sonnet-4.6\": { inputPer1M: 3.0, outputPer1M: 15.0, version: V },\n // OpenRouter ground-truth $1/$5 — a markup over Anthropic-direct's $0.8/$4\n // (the `anthropic:` entry above). Was masked while the slug used dashes.\n \"openrouter:anthropic/claude-haiku-4.5\": { inputPer1M: 1.0, outputPer1M: 5.0, version: \"2026-06-04\" },\n \"openrouter:google/gemini-2.5-flash\": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },\n // Ground-truth from OpenRouter /api/v1/models (was a 0.3 estimate; now 0.279).\n \"openrouter:minimax/minimax-m2.7\": {\n inputPer1M: 0.279,\n outputPer1M: 1.2,\n version: \"2026-06-04\",\n },\n // DeepSeek V4 (CN-hosted — NOT GDPR-safe; non-personal-data workloads only).\n // On 2026-05-22 DeepSeek made the \"75% off\" promo the permanent official price.\n // V4-Pro $0.435/$0.87 is ~34x cheaper than GPT-5.5 on output; flash is cheaper\n // still. Numbers match OpenRouter /api/v1/models 1:1 (no router markup). A strong\n // cheap route for fleet background work once `claude -p` is API-billed (15 Jun).\n \"openrouter:deepseek/deepseek-v4-pro\": { inputPer1M: 0.435, outputPer1M: 0.87, version: \"2026-05-22-deepseek-official\" },\n \"openrouter:deepseek/deepseek-v4-flash\": { inputPer1M: 0.0983, outputPer1M: 0.1966, version: \"2026-05-22-deepseek-official\" },\n\n // Google Gemini (direct). Provider key is \"gemini\" — matches the adapter's\n // usage.provider + the override.provider callers pass. (Image-gen models are\n // priced per-image in the adapter, not here.)\n \"gemini:gemini-2.5-flash\": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },\n // flash-lite is the default `video` tier (F019) — cheap native video understanding.\n \"gemini:gemini-2.5-flash-lite\": { inputPer1M: 0.1, outputPer1M: 0.4, version: \"2026-06-04-or-xref\" },\n\n // Mistral (direct, La Plateforme). Official prices from mistral.ai/pricing\n // (2026-06-04, per Christian's CD report). EU/Paris-hosted — the designated\n // GDPR-safe provider for client/personal-data workloads (see F015). NB:\n // medium-3.5 is the premium \"Vibe\" coding tier ($1.5/$7.5); Large 3 ($0.5/$1.5)\n // is the cheaper frontier general-purpose model despite the higher number.\n \"mistral:mistral-large-latest\": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },\n \"mistral:mistral-large-2512\": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },\n \"mistral:mistral-medium-latest\": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },\n \"mistral:mistral-medium-3.5\": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },\n \"mistral:mistral-medium-3\": { inputPer1M: 0.4, outputPer1M: 2.0, version: \"2026-06-04-or-xref\" },\n \"mistral:mistral-small-latest\": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },\n \"mistral:mistral-small-2603\": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },\n \"mistral:ministral-3b-latest\": { inputPer1M: 0.1, outputPer1M: 0.1, version: MS },\n \"mistral:ministral-8b-latest\": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },\n \"mistral:ministral-14b-latest\": { inputPer1M: 0.2, outputPer1M: 0.2, version: MS },\n \"mistral:magistral-medium-latest\": { inputPer1M: 2.0, outputPer1M: 5.0, version: MS },\n \"mistral:magistral-small-latest\": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },\n \"mistral:devstral-latest\": { inputPer1M: 0.4, outputPer1M: 2.0, version: MS },\n \"mistral:codestral-latest\": { inputPer1M: 0.3, outputPer1M: 0.9, version: MS },\n \"mistral:open-mistral-nemo\": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },\n // Moderation (F016.4) — per input token; output 0. (OCR is per-page in the adapter.)\n \"mistral:mistral-moderation-latest\": { inputPer1M: 0.1, outputPer1M: 0, version: MS },\n // Embeddings (F016.5) — per input token.\n \"mistral:mistral-embed\": { inputPer1M: 0.1, outputPer1M: 0, version: MS },\n \"mistral:codestral-embed\": { inputPer1M: 0.15, outputPer1M: 0, version: MS },\n};\n\nexport function getPrice(provider: string, model: string): PricingEntry | undefined {\n const exact = PRICING[`${provider}:${model}`];\n if (exact) return exact;\n // Providers ship dated model snapshots, e.g. \"claude-haiku-4-5-20251001\".\n // Strip a trailing -YYYYMMDD and retry the base lookup so a dated variant\n // prices the same as its base model instead of falling through to 0 — a real\n // paid call must never be logged as $0 (F012). Covers openrouter slugs too.\n const base = model.replace(/-\\d{8}$/, \"\");\n if (base !== model) return PRICING[`${provider}:${base}`];\n return undefined;\n}\n"],"mappings":"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","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1945,8 +1945,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
1945
1945
|
* wires the live adapters. */
|
|
1946
1946
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
1947
1947
|
|
|
1948
|
-
declare const VERSION: "0.
|
|
1949
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.
|
|
1948
|
+
declare const VERSION: "0.19.0";
|
|
1949
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.19.0";
|
|
1950
1950
|
|
|
1951
1951
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
1952
1952
|
* per-call override. Model IDs are current at scaffold time; callers pin their
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
resolveModel,
|
|
7
7
|
setAvailability
|
|
8
8
|
} from "./chunk-HVZSYNZ5.js";
|
|
9
|
+
import {
|
|
10
|
+
getPrice
|
|
11
|
+
} from "./chunk-V5AQYES2.js";
|
|
9
12
|
|
|
10
13
|
// src/routing/tier-map.ts
|
|
11
14
|
var DEFAULT_TIER_MAP = {
|
|
@@ -214,101 +217,6 @@ function parseArgs(raw) {
|
|
|
214
217
|
return {};
|
|
215
218
|
}
|
|
216
219
|
|
|
217
|
-
// src/cost/pricing.ts
|
|
218
|
-
var V = "2026-06-02";
|
|
219
|
-
var MS = "2026-06-04-mistral.ai";
|
|
220
|
-
var PRICING = {
|
|
221
|
-
// Anthropic (direct API). DEFAULT_TIER_MAP: fast/cheap=haiku, smart/vision=sonnet, powerful=opus.
|
|
222
|
-
"anthropic:claude-haiku-4-5": {
|
|
223
|
-
inputPer1M: 0.8,
|
|
224
|
-
outputPer1M: 4,
|
|
225
|
-
cacheReadPer1M: 0.08,
|
|
226
|
-
cacheWritePer1M: 1,
|
|
227
|
-
version: V
|
|
228
|
-
},
|
|
229
|
-
"anthropic:claude-sonnet-4-6": {
|
|
230
|
-
inputPer1M: 3,
|
|
231
|
-
outputPer1M: 15,
|
|
232
|
-
cacheReadPer1M: 0.3,
|
|
233
|
-
cacheWritePer1M: 3.75,
|
|
234
|
-
version: V
|
|
235
|
-
},
|
|
236
|
-
"anthropic:claude-opus-4-8": {
|
|
237
|
-
inputPer1M: 15,
|
|
238
|
-
outputPer1M: 75,
|
|
239
|
-
cacheReadPer1M: 1.5,
|
|
240
|
-
cacheWritePer1M: 18.75,
|
|
241
|
-
version: V
|
|
242
|
-
},
|
|
243
|
-
// OpenAI. embedding default tier = text-embedding-3-small (no output tokens).
|
|
244
|
-
"openai:text-embedding-3-small": { inputPer1M: 0.02, outputPer1M: 0, version: V },
|
|
245
|
-
"openai:text-embedding-3-large": { inputPer1M: 0.13, outputPer1M: 0, version: V },
|
|
246
|
-
"openai:gpt-4o": { inputPer1M: 2.5, outputPer1M: 10, version: V },
|
|
247
|
-
"openai:gpt-4o-mini": { inputPer1M: 0.15, outputPer1M: 0.6, version: V },
|
|
248
|
-
// Whisper is priced per minute, not per token — not representable here; transcribe
|
|
249
|
-
// (F5.6) computes its own cost. Listed as 0 so token-based compute never charges it.
|
|
250
|
-
"openai:whisper-1": { inputPer1M: 0, outputPer1M: 0, version: V },
|
|
251
|
-
// OpenRouter (meta-router — model slugs include the upstream vendor). Slugs use
|
|
252
|
-
// dots (claude-sonnet-4.6) to match OpenRouter's live ids; the dashed forms
|
|
253
|
-
// never matched a real call. Caught by the F014 catalogue research.
|
|
254
|
-
"openrouter:anthropic/claude-sonnet-4.6": { inputPer1M: 3, outputPer1M: 15, version: V },
|
|
255
|
-
// OpenRouter ground-truth $1/$5 — a markup over Anthropic-direct's $0.8/$4
|
|
256
|
-
// (the `anthropic:` entry above). Was masked while the slug used dashes.
|
|
257
|
-
"openrouter:anthropic/claude-haiku-4.5": { inputPer1M: 1, outputPer1M: 5, version: "2026-06-04" },
|
|
258
|
-
"openrouter:google/gemini-2.5-flash": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },
|
|
259
|
-
// Ground-truth from OpenRouter /api/v1/models (was a 0.3 estimate; now 0.279).
|
|
260
|
-
"openrouter:minimax/minimax-m2.7": {
|
|
261
|
-
inputPer1M: 0.279,
|
|
262
|
-
outputPer1M: 1.2,
|
|
263
|
-
version: "2026-06-04"
|
|
264
|
-
},
|
|
265
|
-
// DeepSeek V4 (CN-hosted — NOT GDPR-safe; non-personal-data workloads only).
|
|
266
|
-
// On 2026-05-22 DeepSeek made the "75% off" promo the permanent official price.
|
|
267
|
-
// V4-Pro $0.435/$0.87 is ~34x cheaper than GPT-5.5 on output; flash is cheaper
|
|
268
|
-
// still. Numbers match OpenRouter /api/v1/models 1:1 (no router markup). A strong
|
|
269
|
-
// cheap route for fleet background work once `claude -p` is API-billed (15 Jun).
|
|
270
|
-
"openrouter:deepseek/deepseek-v4-pro": { inputPer1M: 0.435, outputPer1M: 0.87, version: "2026-05-22-deepseek-official" },
|
|
271
|
-
"openrouter:deepseek/deepseek-v4-flash": { inputPer1M: 0.0983, outputPer1M: 0.1966, version: "2026-05-22-deepseek-official" },
|
|
272
|
-
// Google Gemini (direct). Provider key is "gemini" — matches the adapter's
|
|
273
|
-
// usage.provider + the override.provider callers pass. (Image-gen models are
|
|
274
|
-
// priced per-image in the adapter, not here.)
|
|
275
|
-
"gemini:gemini-2.5-flash": { inputPer1M: 0.3, outputPer1M: 2.5, version: V },
|
|
276
|
-
// flash-lite is the default `video` tier (F019) — cheap native video understanding.
|
|
277
|
-
"gemini:gemini-2.5-flash-lite": { inputPer1M: 0.1, outputPer1M: 0.4, version: "2026-06-04-or-xref" },
|
|
278
|
-
// Mistral (direct, La Plateforme). Official prices from mistral.ai/pricing
|
|
279
|
-
// (2026-06-04, per Christian's CD report). EU/Paris-hosted — the designated
|
|
280
|
-
// GDPR-safe provider for client/personal-data workloads (see F015). NB:
|
|
281
|
-
// medium-3.5 is the premium "Vibe" coding tier ($1.5/$7.5); Large 3 ($0.5/$1.5)
|
|
282
|
-
// is the cheaper frontier general-purpose model despite the higher number.
|
|
283
|
-
"mistral:mistral-large-latest": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
284
|
-
"mistral:mistral-large-2512": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
285
|
-
"mistral:mistral-medium-latest": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },
|
|
286
|
-
"mistral:mistral-medium-3.5": { inputPer1M: 1.5, outputPer1M: 7.5, version: MS },
|
|
287
|
-
"mistral:mistral-medium-3": { inputPer1M: 0.4, outputPer1M: 2, version: "2026-06-04-or-xref" },
|
|
288
|
-
"mistral:mistral-small-latest": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },
|
|
289
|
-
"mistral:mistral-small-2603": { inputPer1M: 0.1, outputPer1M: 0.3, version: MS },
|
|
290
|
-
"mistral:ministral-3b-latest": { inputPer1M: 0.1, outputPer1M: 0.1, version: MS },
|
|
291
|
-
"mistral:ministral-8b-latest": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },
|
|
292
|
-
"mistral:ministral-14b-latest": { inputPer1M: 0.2, outputPer1M: 0.2, version: MS },
|
|
293
|
-
"mistral:magistral-medium-latest": { inputPer1M: 2, outputPer1M: 5, version: MS },
|
|
294
|
-
"mistral:magistral-small-latest": { inputPer1M: 0.5, outputPer1M: 1.5, version: MS },
|
|
295
|
-
"mistral:devstral-latest": { inputPer1M: 0.4, outputPer1M: 2, version: MS },
|
|
296
|
-
"mistral:codestral-latest": { inputPer1M: 0.3, outputPer1M: 0.9, version: MS },
|
|
297
|
-
"mistral:open-mistral-nemo": { inputPer1M: 0.15, outputPer1M: 0.15, version: MS },
|
|
298
|
-
// Moderation (F016.4) — per input token; output 0. (OCR is per-page in the adapter.)
|
|
299
|
-
"mistral:mistral-moderation-latest": { inputPer1M: 0.1, outputPer1M: 0, version: MS },
|
|
300
|
-
// Embeddings (F016.5) — per input token.
|
|
301
|
-
"mistral:mistral-embed": { inputPer1M: 0.1, outputPer1M: 0, version: MS },
|
|
302
|
-
"mistral:codestral-embed": { inputPer1M: 0.15, outputPer1M: 0, version: MS }
|
|
303
|
-
};
|
|
304
|
-
function getPrice(provider, model) {
|
|
305
|
-
const exact = PRICING[`${provider}:${model}`];
|
|
306
|
-
if (exact) return exact;
|
|
307
|
-
const base = model.replace(/-\d{8}$/, "");
|
|
308
|
-
if (base !== model) return PRICING[`${provider}:${base}`];
|
|
309
|
-
return void 0;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
220
|
// src/cost/usage.ts
|
|
313
221
|
function computeCost(provider, model, inputTokens, outputTokens, cacheReadTokens = 0, cacheCreationTokens = 0) {
|
|
314
222
|
const price = getPrice(provider, model);
|
|
@@ -2893,8 +2801,8 @@ var stubProviders = {
|
|
|
2893
2801
|
};
|
|
2894
2802
|
|
|
2895
2803
|
// src/version.ts
|
|
2896
|
-
var VERSION = "0.
|
|
2897
|
-
var SDK_TAG = "@broberg/ai-sdk@0.
|
|
2804
|
+
var VERSION = "0.19.0";
|
|
2805
|
+
var SDK_TAG = "@broberg/ai-sdk@0.19.0";
|
|
2898
2806
|
|
|
2899
2807
|
// src/availability/refresh.ts
|
|
2900
2808
|
var NOT_REFRESHED = { refreshed: false, checked: 0, markedUnavailable: [] };
|