@broberg/ai-sdk 0.20.0 → 0.21.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.
|
@@ -53,6 +53,14 @@ var PRICING = {
|
|
|
53
53
|
// cheap route for fleet background work once `claude -p` is API-billed (15 Jun).
|
|
54
54
|
"openrouter:deepseek/deepseek-v4-pro": { inputPer1M: 0.435, outputPer1M: 0.87, version: "2026-05-22-deepseek-official" },
|
|
55
55
|
"openrouter:deepseek/deepseek-v4-flash": { inputPer1M: 0.0983, outputPer1M: 0.1966, version: "2026-05-22-deepseek-official" },
|
|
56
|
+
// DeepSeek DIRECT API (provider "deepseek", F030 non-PII secondary). Rates from
|
|
57
|
+
// api-docs.deepseek.com 2026-06-30 ($0.14/$0.28 per 1M; both map to deepseek-v4-flash).
|
|
58
|
+
// `deepseek-chat` (non-thinking) + `deepseek-reasoner` (thinking) DEPRECATE 2026-07-24.
|
|
59
|
+
// (The bare `deepseek-v4-flash` basename is already priced via the openrouter entry
|
|
60
|
+
// above — kept distinct here to avoid a basename collision in the F027 pricing-API.)
|
|
61
|
+
// Verify against a real key when it lands.
|
|
62
|
+
"deepseek:deepseek-chat": { inputPer1M: 0.14, outputPer1M: 0.28, version: "2026-06-30-deepseek-direct" },
|
|
63
|
+
"deepseek:deepseek-reasoner": { inputPer1M: 0.14, outputPer1M: 0.28, version: "2026-06-30-deepseek-direct" },
|
|
56
64
|
// Google Gemini (direct). Provider key is "gemini" — matches the adapter's
|
|
57
65
|
// usage.provider + the override.provider callers pass. (Image-gen models are
|
|
58
66
|
// priced per-image in the adapter, not here.)
|
|
@@ -97,4 +105,4 @@ export {
|
|
|
97
105
|
PRICING,
|
|
98
106
|
getPrice
|
|
99
107
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-IZG5UZH5.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 // DeepSeek DIRECT API (provider \"deepseek\", F030 non-PII secondary). Rates from\n // api-docs.deepseek.com 2026-06-30 ($0.14/$0.28 per 1M; both map to deepseek-v4-flash).\n // `deepseek-chat` (non-thinking) + `deepseek-reasoner` (thinking) DEPRECATE 2026-07-24.\n // (The bare `deepseek-v4-flash` basename is already priced via the openrouter entry\n // above — kept distinct here to avoid a basename collision in the F027 pricing-API.)\n // Verify against a real key when it lands.\n \"deepseek:deepseek-chat\": { inputPer1M: 0.14, outputPer1M: 0.28, version: \"2026-06-30-deepseek-direct\" },\n \"deepseek:deepseek-reasoner\": { inputPer1M: 0.14, outputPer1M: 0.28, version: \"2026-06-30-deepseek-direct\" },\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":";AAqBA,IAAM,IAAI;AAEV,IAAM,KAAK;AAIJ,IAAM,UAAwC;AAAA;AAAA,EAEnD,8BAA8B;AAAA,IAC5B,YAAY;AAAA,IAC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AAE,YAAY,KAAK,aAAa,GAAG,SAAS,GAAG;AAAA;AAAA,EAEpF,yBAAyB,EAAE,YAAY,KAAK,aAAa,GAAG,SAAS,GAAG;AAAA,EACxE,2BAA2B,EAAE,YAAY,MAAM,aAAa,GAAG,SAAS,GAAG;AAC7E;AAEO,SAAS,SAAS,UAAkB,OAAyC;AAClF,QAAM,QAAQ,QAAQ,GAAG,QAAQ,IAAI,KAAK,EAAE;AAC5C,MAAI,MAAO,QAAO;AAKlB,QAAM,OAAO,MAAM,QAAQ,WAAW,EAAE;AACxC,MAAI,SAAS,MAAO,QAAO,QAAQ,GAAG,QAAQ,IAAI,IAAI,EAAE;AACxD,SAAO;AACT;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1819,6 +1819,11 @@ declare function requestyAdapter(config?: {
|
|
|
1819
1819
|
title?: string;
|
|
1820
1820
|
}): ProviderAdapter;
|
|
1821
1821
|
|
|
1822
|
+
declare function deepseekAdapter(config?: {
|
|
1823
|
+
apiKey?: string;
|
|
1824
|
+
baseUrl?: string;
|
|
1825
|
+
}): ProviderAdapter;
|
|
1826
|
+
|
|
1822
1827
|
declare function mistralAdapter(config?: {
|
|
1823
1828
|
apiKey?: string;
|
|
1824
1829
|
baseUrl?: string;
|
|
@@ -1962,6 +1967,9 @@ declare const defaultProviders: Record<string, ProviderAdapter>;
|
|
|
1962
1967
|
declare const anthropicApiAdapter: ProviderAdapter;
|
|
1963
1968
|
/** Anthropic adapter stub (subprocess / `claude -p` path). */
|
|
1964
1969
|
declare const anthropicSubprocessAdapter: ProviderAdapter;
|
|
1970
|
+
/** Mistral adapter stub — covers the default text/vision tiers (F030: fast/smart/
|
|
1971
|
+
* powerful/vision/cheap all default to Mistral EU after the Anthropic phase-out). */
|
|
1972
|
+
declare const mistralStubAdapter: ProviderAdapter;
|
|
1965
1973
|
/** OpenAI adapter stub — covers the embedding default tier + a chat fallback. */
|
|
1966
1974
|
declare const openaiStubAdapter: ProviderAdapter;
|
|
1967
1975
|
/** fal.ai adapter stub — image generation (real one in fal.ts, F5.3). */
|
|
@@ -1971,16 +1979,20 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
1971
1979
|
* wires the live adapters. */
|
|
1972
1980
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
1973
1981
|
|
|
1974
|
-
declare const VERSION: "0.
|
|
1975
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.
|
|
1982
|
+
declare const VERSION: "0.21.0";
|
|
1983
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.21.0";
|
|
1976
1984
|
|
|
1977
1985
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
1978
|
-
* per-call override.
|
|
1979
|
-
*
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
1982
|
-
*
|
|
1983
|
-
*
|
|
1986
|
+
* per-call override.
|
|
1987
|
+
*
|
|
1988
|
+
* F030 — Anthropic API phase-out: `ANTHROPIC_API_KEY` was globally removed, so the
|
|
1989
|
+
* default cloud route may NOT hit Anthropic Console. `fast`/`smart`/`powerful`/
|
|
1990
|
+
* `vision` now default to **Mistral EU** (Paris-hosted, Schrems II-safe — so every
|
|
1991
|
+
* default text/vision call is GDPR-safe by default). Claude stays reachable as a
|
|
1992
|
+
* NON-default quality fallback for non-PII via `override:{provider:"openrouter",
|
|
1993
|
+
* model:"anthropic/claude-…"}`. DeepSeek (CN) is the opt-in non-PII secondary
|
|
1994
|
+
* (`provider:"deepseek"`), never a default. Magistral (reasoning) / mistral-large
|
|
1995
|
+
* for vision are per-call overrides, not defaults (don't pay the premium on all). */
|
|
1984
1996
|
declare const DEFAULT_TIER_MAP: Record<Tier, TierSpec>;
|
|
1985
1997
|
/**
|
|
1986
1998
|
* Resolve a Tier to a concrete TierSpec.
|
|
@@ -2295,4 +2307,4 @@ interface StreamTransportRequest extends TransportRequest {
|
|
|
2295
2307
|
*/
|
|
2296
2308
|
declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
|
|
2297
2309
|
|
|
2298
|
-
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, computeCost, createAI, deepinfraAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, visionInputSchema };
|
|
2310
|
+
export { AZURE_DANISH_VOICES, AZURE_DANISH_VOICE_LIST, type AiClient, type AiConfig, type AzureVoiceInfo, type BatchJob, type BatchRequestItem, type BatchResultItem, type BflAdapterConfig, type BflCredits, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostQuery, type CostSink, type CostSummary, type CostSummaryQuery, type CostTimeseriesQuery, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type LoraWeight, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RefreshOptions, type RefreshResult, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TrainStyleInput, type TrainStyleRequest, type TrainStyleResult, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsCostClientConfig, UpmetricsCostError, type UpmetricsCostRow, type UpmetricsCostSummary, type UpmetricsCostTimeseries, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, azureAdapter, bflAdapter, bflCredits, chatInputSchema, computeCost, createAI, deepinfraAdapter, deepseekAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, listAzureDanishVoices, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, mistralStubAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, refreshAvailability, requestyAdapter, resetRefreshState, resetRegistry, resolveAzureVoice, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsCostClient, upmetricsSink, usdFromMicro, visionInputSchema };
|
package/dist/index.js
CHANGED
|
@@ -8,17 +8,21 @@ import {
|
|
|
8
8
|
} from "./chunk-HVZSYNZ5.js";
|
|
9
9
|
import {
|
|
10
10
|
getPrice
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IZG5UZH5.js";
|
|
12
12
|
|
|
13
13
|
// src/routing/tier-map.ts
|
|
14
14
|
var DEFAULT_TIER_MAP = {
|
|
15
|
-
fast: { provider: "
|
|
16
|
-
smart: { provider: "
|
|
17
|
-
powerful: { provider: "
|
|
15
|
+
fast: { provider: "mistral", model: "mistral-small-latest", transport: "http" },
|
|
16
|
+
smart: { provider: "mistral", model: "mistral-large-latest", transport: "http" },
|
|
17
|
+
powerful: { provider: "mistral", model: "mistral-large-latest", transport: "http" },
|
|
18
18
|
cheap: { provider: "mistral", model: "mistral-small-latest", transport: "http" },
|
|
19
|
-
|
|
19
|
+
// Vision: small-latest (vision-capable, cheap EU) is the default; override to
|
|
20
|
+
// mistral-large-latest for demanding image/spatial/composition work.
|
|
21
|
+
vision: { provider: "mistral", model: "mistral-small-latest", transport: "http" },
|
|
20
22
|
// Native video understanding — Gemini leads; flash-lite is the cheap default (F019).
|
|
23
|
+
// NOT Anthropic → out of the F030 phase-out (its own EU epic if/when needed).
|
|
21
24
|
video: { provider: "gemini", model: "gemini-2.5-flash-lite", transport: "http" },
|
|
25
|
+
// NOT Anthropic → out of F030 (EU-embedding migration is its own future epic).
|
|
22
26
|
embedding: { provider: "openai", model: "text-embedding-3-small", transport: "http" }
|
|
23
27
|
};
|
|
24
28
|
function resolveTier(tier, override, configMap) {
|
|
@@ -1074,6 +1078,18 @@ function requestyAdapter(config = {}) {
|
|
|
1074
1078
|
});
|
|
1075
1079
|
}
|
|
1076
1080
|
|
|
1081
|
+
// src/providers/deepseek.ts
|
|
1082
|
+
function deepseekAdapter(config = {}) {
|
|
1083
|
+
return makeOpenAICompatibleAdapter({
|
|
1084
|
+
name: "deepseek",
|
|
1085
|
+
// → key DEEPSEEK_API_KEY
|
|
1086
|
+
baseUrl: config.baseUrl ?? "https://api.deepseek.com/v1",
|
|
1087
|
+
apiKey: config.apiKey,
|
|
1088
|
+
// Direct API returns no usage.cost → price from the table (not response).
|
|
1089
|
+
costFromResponseField: false
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1077
1093
|
// src/providers/mistral.ts
|
|
1078
1094
|
var MISTRAL_OCR_PRICE_PER_PAGE = 2e-3;
|
|
1079
1095
|
var VOXTRAL_PRICE_PER_MIN = {
|
|
@@ -1887,6 +1903,7 @@ var defaultProviders = {
|
|
|
1887
1903
|
deepinfra: deepinfraAdapter(),
|
|
1888
1904
|
openrouter: openrouterAdapter(),
|
|
1889
1905
|
requesty: requestyAdapter(),
|
|
1906
|
+
deepseek: deepseekAdapter(),
|
|
1890
1907
|
mistral: mistralAdapter(),
|
|
1891
1908
|
elevenlabs: elevenlabsAdapter(),
|
|
1892
1909
|
azure: azureAdapter(),
|
|
@@ -2851,6 +2868,21 @@ var anthropicSubprocessAdapter = {
|
|
|
2851
2868
|
return { text: `[stub:anthropic-subprocess] ${lastUserText(req)}`, usage };
|
|
2852
2869
|
}
|
|
2853
2870
|
};
|
|
2871
|
+
var mistralStubAdapter = {
|
|
2872
|
+
name: "mistral",
|
|
2873
|
+
async chat(req) {
|
|
2874
|
+
return {
|
|
2875
|
+
text: `[stub:mistral] ${lastUserText(req)}`,
|
|
2876
|
+
usage: stubUsage("mistral", req.spec.model, "http", "chat")
|
|
2877
|
+
};
|
|
2878
|
+
},
|
|
2879
|
+
async vision(req) {
|
|
2880
|
+
return {
|
|
2881
|
+
text: `[stub:mistral:vision] ${lastUserText(req)}`,
|
|
2882
|
+
usage: stubUsage("mistral", req.spec.model, "http", "vision")
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2854
2886
|
var openaiStubAdapter = {
|
|
2855
2887
|
name: "openai",
|
|
2856
2888
|
async chat(req) {
|
|
@@ -2877,13 +2909,14 @@ var falStubAdapter = {
|
|
|
2877
2909
|
};
|
|
2878
2910
|
var stubProviders = {
|
|
2879
2911
|
anthropic: anthropicApiAdapter,
|
|
2912
|
+
mistral: mistralStubAdapter,
|
|
2880
2913
|
openai: openaiStubAdapter,
|
|
2881
2914
|
fal: falStubAdapter
|
|
2882
2915
|
};
|
|
2883
2916
|
|
|
2884
2917
|
// src/version.ts
|
|
2885
|
-
var VERSION = "0.
|
|
2886
|
-
var SDK_TAG = "@broberg/ai-sdk@0.
|
|
2918
|
+
var VERSION = "0.21.0";
|
|
2919
|
+
var SDK_TAG = "@broberg/ai-sdk@0.21.0";
|
|
2887
2920
|
|
|
2888
2921
|
// src/availability/refresh.ts
|
|
2889
2922
|
var NOT_REFRESHED = { refreshed: false, checked: 0, markedUnavailable: [] };
|
|
@@ -3246,6 +3279,7 @@ export {
|
|
|
3246
3279
|
computeCost,
|
|
3247
3280
|
createAI,
|
|
3248
3281
|
deepinfraAdapter,
|
|
3282
|
+
deepseekAdapter,
|
|
3249
3283
|
defaultProviders,
|
|
3250
3284
|
discordSink,
|
|
3251
3285
|
elevenlabsAdapter,
|
|
@@ -3265,6 +3299,7 @@ export {
|
|
|
3265
3299
|
makeOpenAICompatibleAdapter,
|
|
3266
3300
|
messageSchema,
|
|
3267
3301
|
mistralAdapter,
|
|
3302
|
+
mistralStubAdapter,
|
|
3268
3303
|
multiSink,
|
|
3269
3304
|
noopSink,
|
|
3270
3305
|
openaiAdapter,
|