@warlock.js/ai-deepseek 5.45.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 +11 -0
- package/README.md +6 -8
- package/cjs/index.cjs +69 -26
- package/cjs/index.cjs.map +1 -1
- package/esm/index.d.mts +3 -2
- package/esm/index.mjs +3 -2
- package/esm/known-context-windows.mjs +2 -1
- package/esm/known-context-windows.mjs.map +1 -1
- package/esm/known-lifecycle.d.mts +26 -0
- package/esm/known-lifecycle.d.mts.map +1 -0
- package/esm/known-lifecycle.mjs +46 -0
- package/esm/known-lifecycle.mjs.map +1 -0
- package/esm/known-models.d.mts +15 -18
- package/esm/known-models.d.mts.map +1 -1
- package/esm/known-models.mjs +15 -23
- package/esm/known-models.mjs.map +1 -1
- package/esm/sdk.d.mts +4 -2
- package/esm/sdk.d.mts.map +1 -1
- package/esm/sdk.mjs +5 -3
- package/esm/sdk.mjs.map +1 -1
- package/llms-full.txt +7 -9
- package/package.json +4 -4
- package/skills/SKILL.md +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `@warlock.js/ai-deepseek` 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
|
+
- `deepseek-flash` is in `DEEPSEEK_CHAT_MODELS` and reports a 1,000,000-token `capabilities.contextWindow`, as do the `deepseek-v4-*` ids (previously 128,000).
|
|
12
|
+
- `DEEPSEEK_MODEL_LIFECYCLE` and `deepseekLifecycleFor(name)` give each model a status; `DEEPSEEK_DEFAULT_PRICING_AS_OF` dates the price table.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- `DEEPSEEK_CHAT_MODELS` no longer lists `deepseek-chat` and `deepseek-reasoner` (retired 2026-07-24) or `deepseek-v4-flash`; they are `retired` in `DEEPSEEK_MODEL_LIFECYCLE`, and `deepseek.model({ name })` still accepts them.
|
|
17
|
+
|
|
7
18
|
## 5.45.0 - 2026-11-05
|
|
8
19
|
|
|
9
20
|
### Added
|
package/README.md
CHANGED
|
@@ -51,14 +51,12 @@ DeepSeekModelConfig {
|
|
|
51
51
|
|
|
52
52
|
## Models
|
|
53
53
|
|
|
54
|
-
| Model
|
|
55
|
-
|
|
|
56
|
-
| `deepseek-
|
|
57
|
-
| `deepseek-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
DeepSeek announced the legacy `deepseek-chat` / `deepseek-reasoner` names retire 2026/07/24 in favor of the `deepseek-v4-*` family; both name sets are understood by the capability inference. `deepseek.model({ name })` accepts any id the upstream serves. `DEEPSEEK_CHAT_MODELS` exports the informational list.
|
|
54
|
+
| Model | Notes |
|
|
55
|
+
| ----------------- | ------------------------------------------------------------------------------------ |
|
|
56
|
+
| `deepseek-flash` | Fast tier (served by DeepSeek-V4.1-Flash), 1M context. Reasoning **off** by default. |
|
|
57
|
+
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
58
|
+
|
|
59
|
+
`deepseek-chat` and `deepseek-reasoner` were retired on 2026-07-24, and `deepseek-v4-flash` is a retired name that DeepSeek still accepts and serves with `deepseek-flash`, billed at the Flash price. Their status, dates and replacements are in `DEEPSEEK_MODEL_LIFECYCLE` (lookup: `deepseekLifecycleFor(name)`, checked `DEEPSEEK_MODEL_LIFECYCLE_AS_OF`); the capability inference still understands every name. `deepseek.model({ name })` accepts any id the upstream serves. `DEEPSEEK_CHAT_MODELS` exports the informational list.
|
|
62
60
|
|
|
63
61
|
## Capabilities
|
|
64
62
|
|
package/cjs/index.cjs
CHANGED
|
@@ -5,7 +5,8 @@ let _warlock_js_ai_openai = require("@warlock.js/ai-openai");
|
|
|
5
5
|
const KNOWN_WINDOWS = [
|
|
6
6
|
["deepseek-chat", 128e3],
|
|
7
7
|
["deepseek-reasoner", 128e3],
|
|
8
|
-
["deepseek-v4",
|
|
8
|
+
["deepseek-v4", 1e6],
|
|
9
|
+
["deepseek-flash", 1e6]
|
|
9
10
|
];
|
|
10
11
|
/**
|
|
11
12
|
* The known context window (tokens, input plus output) of a DeepSeek chat
|
|
@@ -37,34 +38,26 @@ function inferContextWindow(modelId) {
|
|
|
37
38
|
* wrapped `openai.model(...)` call (explicit config wins over OpenAI's
|
|
38
39
|
* inference inside `OpenAIModel`).
|
|
39
40
|
*
|
|
40
|
-
* Verified against the official DeepSeek API docs (api-docs.deepseek.com
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* `deepseek-reasoner`
|
|
44
|
-
*
|
|
45
|
-
* documents image (vision) input, so vision inference is conservatively
|
|
46
|
-
* `false` for every id.
|
|
41
|
+
* Verified against the official DeepSeek API docs (api-docs.deepseek.com):
|
|
42
|
+
* base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.
|
|
43
|
+
* The reasoning-capable surfaces are the `*-pro` tier and the retired
|
|
44
|
+
* `deepseek-reasoner` name. Vision inference is conservatively `false` for
|
|
45
|
+
* every id; opt in per model with `vision: true`.
|
|
47
46
|
*/
|
|
48
47
|
/**
|
|
49
|
-
*
|
|
48
|
+
* Current DeepSeek chat model ids, surfaced for discovery and docs.
|
|
50
49
|
*
|
|
51
|
-
* - `deepseek-
|
|
52
|
-
*
|
|
53
|
-
* - `deepseek-
|
|
54
|
-
* reasoning channel and accepts the reasoning-effort knob.
|
|
50
|
+
* - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M
|
|
51
|
+
* context, thinking on by default, accepts image input per DeepSeek).
|
|
52
|
+
* - `deepseek-v4-pro` — the quality tier; thinks by default.
|
|
55
53
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* accepts any id the upstream serves.
|
|
54
|
+
* The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:
|
|
55
|
+
* `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and
|
|
56
|
+
* `deepseek-v4-flash`, which DeepSeek still accepts and bills at the
|
|
57
|
+
* `deepseek-flash` price. The list is informational only —
|
|
58
|
+
* `deepseek.model({ name })` accepts any id the upstream serves.
|
|
61
59
|
*/
|
|
62
|
-
const DEEPSEEK_CHAT_MODELS = [
|
|
63
|
-
"deepseek-chat",
|
|
64
|
-
"deepseek-reasoner",
|
|
65
|
-
"deepseek-v4-flash",
|
|
66
|
-
"deepseek-v4-pro"
|
|
67
|
-
];
|
|
60
|
+
const DEEPSEEK_CHAT_MODELS = ["deepseek-flash", "deepseek-v4-pro"];
|
|
68
61
|
/**
|
|
69
62
|
* Substrings identifying DeepSeek model ids that expose a reasoning /
|
|
70
63
|
* thinking channel and accept the reasoning-effort knob.
|
|
@@ -132,12 +125,14 @@ function inferVisionCapability(modelId) {
|
|
|
132
125
|
const DEEPSEEK_BASE_URL = "https://api.deepseek.com";
|
|
133
126
|
/** Default upstream label for models produced by this SDK. */
|
|
134
127
|
const DEEPSEEK_PROVIDER = "deepseek";
|
|
128
|
+
/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */
|
|
129
|
+
const DEEPSEEK_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
135
130
|
/**
|
|
136
131
|
* Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed
|
|
137
132
|
* by model name; `cachedInput` is the cache-hit input rate.
|
|
138
133
|
*
|
|
139
|
-
* Source: https://api-docs.deepseek.com/quick_start/pricing,
|
|
140
|
-
*
|
|
134
|
+
* Source: https://api-docs.deepseek.com/quick_start/pricing, as of
|
|
135
|
+
* {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and
|
|
141
136
|
* 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat
|
|
142
137
|
* `ModelPricing` cannot follow the clock, so these are the **peak** rates —
|
|
143
138
|
* an upper bound that keeps USD budgets safe; off-peak calls really cost
|
|
@@ -317,11 +312,59 @@ var DeepSeekSDK = class {
|
|
|
317
312
|
}
|
|
318
313
|
};
|
|
319
314
|
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region ../../packages/ai-deepseek/src/known-lifecycle.ts
|
|
317
|
+
/**
|
|
318
|
+
* Where DeepSeek's docs put its chat model names, as of
|
|
319
|
+
* {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and
|
|
320
|
+
* `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is
|
|
321
|
+
* retired as a model, but DeepSeek still accepts the name and serves it
|
|
322
|
+
* with `deepseek-flash`, billed at the Flash price; it published no
|
|
323
|
+
* shutdown date for the name.
|
|
324
|
+
*
|
|
325
|
+
* Sources: https://api-docs.deepseek.com/news/news260424 and
|
|
326
|
+
* https://api-docs.deepseek.com/quick_start/pricing
|
|
327
|
+
*/
|
|
328
|
+
const DEEPSEEK_MODEL_LIFECYCLE = {
|
|
329
|
+
"deepseek-flash": { status: "current" },
|
|
330
|
+
"deepseek-v4-pro": { status: "current" },
|
|
331
|
+
"deepseek-v4-flash": {
|
|
332
|
+
status: "retired",
|
|
333
|
+
replacement: "deepseek-flash"
|
|
334
|
+
},
|
|
335
|
+
"deepseek-chat": {
|
|
336
|
+
status: "retired",
|
|
337
|
+
retiresOn: "2026-07-24",
|
|
338
|
+
replacement: "deepseek-v4-flash"
|
|
339
|
+
},
|
|
340
|
+
"deepseek-reasoner": {
|
|
341
|
+
status: "retired",
|
|
342
|
+
retiresOn: "2026-07-24",
|
|
343
|
+
replacement: "deepseek-v4-flash"
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */
|
|
347
|
+
const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
348
|
+
/**
|
|
349
|
+
* Look up the lifecycle of a DeepSeek model id (exact match), or
|
|
350
|
+
* `undefined` when the table does not cover it.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* deepseekLifecycleFor("deepseek-chat"); // { status: "retired", retiresOn: "2026-07-24", … }
|
|
354
|
+
*/
|
|
355
|
+
function deepseekLifecycleFor(modelName) {
|
|
356
|
+
return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName) ? DEEPSEEK_MODEL_LIFECYCLE[modelName] : void 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
320
359
|
//#endregion
|
|
321
360
|
exports.DEEPSEEK_CHAT_MODELS = DEEPSEEK_CHAT_MODELS;
|
|
322
361
|
exports.DEEPSEEK_DEFAULT_PRICING = DEEPSEEK_DEFAULT_PRICING;
|
|
362
|
+
exports.DEEPSEEK_DEFAULT_PRICING_AS_OF = DEEPSEEK_DEFAULT_PRICING_AS_OF;
|
|
363
|
+
exports.DEEPSEEK_MODEL_LIFECYCLE = DEEPSEEK_MODEL_LIFECYCLE;
|
|
364
|
+
exports.DEEPSEEK_MODEL_LIFECYCLE_AS_OF = DEEPSEEK_MODEL_LIFECYCLE_AS_OF;
|
|
323
365
|
exports.DEEPSEEK_OFF_PEAK_PRICING = DEEPSEEK_OFF_PEAK_PRICING;
|
|
324
366
|
exports.DeepSeekSDK = DeepSeekSDK;
|
|
367
|
+
exports.deepseekLifecycleFor = deepseekLifecycleFor;
|
|
325
368
|
exports.inferReasoningCapability = inferReasoningCapability;
|
|
326
369
|
exports.inferVisionCapability = inferVisionCapability;
|
|
327
370
|
//# sourceMappingURL=index.cjs.map
|
package/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts","../../../../../../../packages/ai-deepseek/src/known-models.ts","../../../../../../../packages/ai-deepseek/src/sdk.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-chat` and\n * `deepseek-reasoner` document 128K tokens. The `deepseek-v4-*` ids use the\n * same conservative 128K figure; a larger window is set per model.\n * The longest matching prefix wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `deepseek.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [prefix: string, window: number]> = [\n [\"deepseek-chat\", 128_000],\n [\"deepseek-reasoner\", 128_000],\n [\"deepseek-v4\", 128_000],\n];\n\n/**\n * The known context window (tokens, input plus output) of a DeepSeek chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"deepseek-chat\"); // → 128000\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const prefix = entry[0];\n\n if (id.startsWith(prefix) && (!best || prefix.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n","/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com,\n * mid-2026): base URL `https://api.deepseek.com`, OpenAI-compatible Chat\n * Completions. Two reasoning-capable surfaces exist — the legacy\n * `deepseek-reasoner` (thinking mode) and the `*-pro` tier — while\n * `deepseek-chat` is the non-thinking surface. No DeepSeek chat model\n * documents image (vision) input, so vision inference is conservatively\n * `false` for every id.\n */\n\n/**\n * Default DeepSeek chat model ids, surfaced for discovery and docs.\n *\n * - `deepseek-chat` — the non-thinking surface (V3 lineage). Fast, cheap,\n * broad production coverage. Not reasoning-capable.\n * - `deepseek-reasoner` — the thinking surface (R1 lineage). Emits a\n * reasoning channel and accepts the reasoning-effort knob.\n *\n * Both legacy names are scheduled for retirement (2026/07/24 per DeepSeek's\n * deprecation notice) in favor of the `deepseek-v4-*` family\n * (`deepseek-v4-flash`, `deepseek-v4-pro`), which this inference also\n * understands. The list is informational only — `deepseek.model({ name })`\n * accepts any id the upstream serves.\n */\nexport const DEEPSEEK_CHAT_MODELS = [\n \"deepseek-chat\",\n \"deepseek-reasoner\",\n \"deepseek-v4-flash\",\n \"deepseek-v4-pro\",\n] as const;\n\n/**\n * Substrings identifying DeepSeek model ids that expose a reasoning /\n * thinking channel and accept the reasoning-effort knob.\n *\n * - `deepseek-reasoner` — the dedicated thinking surface (R1 lineage).\n * - `-pro` — the V4 quality tier (`deepseek-v4-pro`), which thinks by\n * default per DeepSeek's docs.\n *\n * `deepseek-chat` (the V3 non-thinking surface) and `deepseek-v4-flash`\n * stay `false`. A substring match tolerates date/preview suffixes the\n * provider may append. Override per-model via\n * `deepseek.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"deepseek-reasoner\", \"-pro\"];\n\n/**\n * Infer whether a DeepSeek model id is reasoning-capable based on the\n * known substrings. Unknown ids default to `false` so the adapter never\n * forwards an unsupported reasoning param to a non-thinking model.\n *\n * @example\n * inferReasoningCapability(\"deepseek-reasoner\"); // → true\n * inferReasoningCapability(\"deepseek-v4-pro\"); // → true\n * inferReasoningCapability(\"deepseek-chat\"); // → false\n * inferReasoningCapability(\"deepseek-v4-flash\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Substrings identifying DeepSeek model ids that accept image (vision)\n * input.\n *\n * Currently **empty**: as of mid-2026, no DeepSeek chat model documents\n * vision input on the OpenAI-compatible Chat Completions endpoint, so\n * inference returns `false` for every id and passing an image attachment\n * surfaces a clear, agent-side capability error instead of an opaque 400.\n * Append a fragment here (and a paired spec case) the day DeepSeek ships a\n * multimodal chat model. Devs can always opt in per-model via\n * `deepseek.model({ name, vision: true })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS: readonly string[] = [];\n\n/**\n * Infer whether a DeepSeek model id supports vision based on the known\n * substrings. Today this is always `false` (see\n * {@link VISION_CAPABLE_SUBSTRINGS}); kept as a function so the\n * {@link DeepSeekSDK} call site and the override semantics stay identical\n * to the other adapters, ready for a future multimodal id.\n *\n * @example\n * inferVisionCapability(\"deepseek-chat\"); // → false\n * inferVisionCapability(\"deepseek-reasoner\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n","import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, fetched\n * 2026-10-17. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n"],"mappings":";;;;AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,KAAO;AACzB;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;AAeA,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAM,4BAA+C,CAAC;;;;;;;;;;;;AAatD,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;AC/EA,MAAM,oBAAoB;;AAG1B,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;AAqB1B,MAAa,2BAAmE;CAC9E,kBAAkB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CAChE,qBAAqB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CACnE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;AASA,MAAa,4BAAoE;CAC/E,kBAAkB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACjE,qBAAqB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACpE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAuD;CAMrD,AAAO,YAAY,QAA2B;EAC5C,MAAM,EAAE,UAAU,SAAS,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW,YAAY;EAE5B,KAAK,UAAU;GAAE,GAAG;GAA0B,GAAG;EAAQ;EAKzD,KAAK,SAAS,IAAIA,gCAAU;GAC1B,GAAG;GACH,SAAS,WAAW;GACpB,UAAU,KAAK;EACjB,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,AAAO,MAAM,QAA4C;EACvD,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EACrE,MAAM,WAAgC;GACpC,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GACxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts","../../../../../../../packages/ai-deepseek/src/known-models.ts","../../../../../../../packages/ai-deepseek/src/sdk.ts","../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-flash` and the\n * `deepseek-v4-*` ids document 1M tokens (DeepSeek's model table);\n * the retired `deepseek-chat` and `deepseek-reasoner` documented 128K.\n * The longest matching prefix wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `deepseek.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [prefix: string, window: number]> = [\n [\"deepseek-chat\", 128_000],\n [\"deepseek-reasoner\", 128_000],\n [\"deepseek-v4\", 1_000_000],\n [\"deepseek-flash\", 1_000_000],\n];\n\n/**\n * The known context window (tokens, input plus output) of a DeepSeek chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"deepseek-chat\"); // → 128000\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const prefix = entry[0];\n\n if (id.startsWith(prefix) && (!best || prefix.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n","/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com):\n * base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.\n * The reasoning-capable surfaces are the `*-pro` tier and the retired\n * `deepseek-reasoner` name. Vision inference is conservatively `false` for\n * every id; opt in per model with `vision: true`.\n */\n\n/**\n * Current DeepSeek chat model ids, surfaced for discovery and docs.\n *\n * - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M\n * context, thinking on by default, accepts image input per DeepSeek).\n * - `deepseek-v4-pro` — the quality tier; thinks by default.\n *\n * The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:\n * `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and\n * `deepseek-v4-flash`, which DeepSeek still accepts and bills at the\n * `deepseek-flash` price. The list is informational only —\n * `deepseek.model({ name })` accepts any id the upstream serves.\n */\nexport const DEEPSEEK_CHAT_MODELS = [\"deepseek-flash\", \"deepseek-v4-pro\"] as const;\n\n/**\n * Substrings identifying DeepSeek model ids that expose a reasoning /\n * thinking channel and accept the reasoning-effort knob.\n *\n * - `deepseek-reasoner` — the dedicated thinking surface (R1 lineage).\n * - `-pro` — the V4 quality tier (`deepseek-v4-pro`), which thinks by\n * default per DeepSeek's docs.\n *\n * `deepseek-chat` (the V3 non-thinking surface) and `deepseek-v4-flash`\n * stay `false`. A substring match tolerates date/preview suffixes the\n * provider may append. Override per-model via\n * `deepseek.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"deepseek-reasoner\", \"-pro\"];\n\n/**\n * Infer whether a DeepSeek model id is reasoning-capable based on the\n * known substrings. Unknown ids default to `false` so the adapter never\n * forwards an unsupported reasoning param to a non-thinking model.\n *\n * @example\n * inferReasoningCapability(\"deepseek-reasoner\"); // → true\n * inferReasoningCapability(\"deepseek-v4-pro\"); // → true\n * inferReasoningCapability(\"deepseek-chat\"); // → false\n * inferReasoningCapability(\"deepseek-v4-flash\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Substrings identifying DeepSeek model ids that accept image (vision)\n * input.\n *\n * Currently **empty**: as of mid-2026, no DeepSeek chat model documents\n * vision input on the OpenAI-compatible Chat Completions endpoint, so\n * inference returns `false` for every id and passing an image attachment\n * surfaces a clear, agent-side capability error instead of an opaque 400.\n * Append a fragment here (and a paired spec case) the day DeepSeek ships a\n * multimodal chat model. Devs can always opt in per-model via\n * `deepseek.model({ name, vision: true })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS: readonly string[] = [];\n\n/**\n * Infer whether a DeepSeek model id supports vision based on the known\n * substrings. Today this is always `false` (see\n * {@link VISION_CAPABLE_SUBSTRINGS}); kept as a function so the\n * {@link DeepSeekSDK} call site and the override semantics stay identical\n * to the other adapters, ready for a future multimodal id.\n *\n * @example\n * inferVisionCapability(\"deepseek-chat\"); // → false\n * inferVisionCapability(\"deepseek-reasoner\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n","import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */\nexport const DEEPSEEK_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, as of\n * {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n","import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where DeepSeek's docs put its chat model names, as of\n * {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and\n * `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is\n * retired as a model, but DeepSeek still accepts the name and serves it\n * with `deepseek-flash`, billed at the Flash price; it published no\n * shutdown date for the name.\n *\n * Sources: https://api-docs.deepseek.com/news/news260424 and\n * https://api-docs.deepseek.com/quick_start/pricing\n */\nexport const DEEPSEEK_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"deepseek-flash\": { status: \"current\" },\n \"deepseek-v4-pro\": { status: \"current\" },\n \"deepseek-v4-flash\": { status: \"retired\", replacement: \"deepseek-flash\" },\n \"deepseek-chat\": { status: \"retired\", retiresOn: \"2026-07-24\", replacement: \"deepseek-v4-flash\" },\n \"deepseek-reasoner\": {\n status: \"retired\",\n retiresOn: \"2026-07-24\",\n replacement: \"deepseek-v4-flash\",\n },\n};\n\n/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */\nexport const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a DeepSeek model id (exact match), or\n * `undefined` when the table does not cover it.\n *\n * @example\n * deepseekLifecycleFor(\"deepseek-chat\"); // { status: \"retired\", retiresOn: \"2026-07-24\", … }\n */\nexport function deepseekLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName)\n ? DEEPSEEK_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA,MAAa,uBAAuB,CAAC,kBAAkB,iBAAiB;;;;;;;;;;;;;;AAexE,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAM,4BAA+C,CAAC;;;;;;;;;;;;AAatD,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;ACvEA,MAAM,oBAAoB;;AAG1B,MAAM,oBAAoB;;AAG1B,MAAa,iCAAiC;;;;;;;;;;;;;;;;;;;;AAqB9C,MAAa,2BAAmE;CAC9E,kBAAkB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CAChE,qBAAqB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CACnE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;AASA,MAAa,4BAAoE;CAC/E,kBAAkB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACjE,qBAAqB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACpE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAuD;CAMrD,AAAO,YAAY,QAA2B;EAC5C,MAAM,EAAE,UAAU,SAAS,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW,YAAY;EAE5B,KAAK,UAAU;GAAE,GAAG;GAA0B,GAAG;EAAQ;EAKzD,KAAK,SAAS,IAAIA,gCAAU;GAC1B,GAAG;GACH,SAAS,WAAW;GACpB,UAAU,KAAK;EACjB,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,AAAO,MAAM,QAA4C;EACvD,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EACrE,MAAM,WAAgC;GACpC,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GACxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;;;;;;;;AChMA,MAAa,2BAAqE;CAChF,kBAAkB,EAAE,QAAQ,UAAU;CACtC,mBAAmB,EAAE,QAAQ,UAAU;CACvC,qBAAqB;EAAE,QAAQ;EAAW,aAAa;CAAiB;CACxE,iBAAiB;EAAE,QAAQ;EAAW,WAAW;EAAc,aAAa;CAAoB;CAChG,qBAAqB;EACnB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;AACF;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
|
package/esm/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DeepSeekEmbedderConfig, DeepSeekImageConfig, DeepSeekModelConfig, DeepSeekSDKConfig } from "./config.type.mjs";
|
|
2
|
-
import { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK } from "./sdk.mjs";
|
|
2
|
+
import { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_DEFAULT_PRICING_AS_OF, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK } from "./sdk.mjs";
|
|
3
|
+
import { DEEPSEEK_MODEL_LIFECYCLE, DEEPSEEK_MODEL_LIFECYCLE_AS_OF, deepseekLifecycleFor } from "./known-lifecycle.mjs";
|
|
3
4
|
import { DEEPSEEK_CHAT_MODELS, inferReasoningCapability, inferVisionCapability } from "./known-models.mjs";
|
|
4
|
-
export { DEEPSEEK_CHAT_MODELS, DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_OFF_PEAK_PRICING, type DeepSeekEmbedderConfig, type DeepSeekImageConfig, type DeepSeekModelConfig, DeepSeekSDK, type DeepSeekSDKConfig, inferReasoningCapability, inferVisionCapability };
|
|
5
|
+
export { DEEPSEEK_CHAT_MODELS, DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_DEFAULT_PRICING_AS_OF, DEEPSEEK_MODEL_LIFECYCLE, DEEPSEEK_MODEL_LIFECYCLE_AS_OF, DEEPSEEK_OFF_PEAK_PRICING, type DeepSeekEmbedderConfig, type DeepSeekImageConfig, type DeepSeekModelConfig, DeepSeekSDK, type DeepSeekSDKConfig, deepseekLifecycleFor, inferReasoningCapability, inferVisionCapability };
|
package/esm/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEEPSEEK_CHAT_MODELS, inferReasoningCapability, inferVisionCapability } from "./known-models.mjs";
|
|
2
|
-
import { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK } from "./sdk.mjs";
|
|
2
|
+
import { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_DEFAULT_PRICING_AS_OF, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK } from "./sdk.mjs";
|
|
3
|
+
import { DEEPSEEK_MODEL_LIFECYCLE, DEEPSEEK_MODEL_LIFECYCLE_AS_OF, deepseekLifecycleFor } from "./known-lifecycle.mjs";
|
|
3
4
|
|
|
4
|
-
export { DEEPSEEK_CHAT_MODELS, DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK, inferReasoningCapability, inferVisionCapability };
|
|
5
|
+
export { DEEPSEEK_CHAT_MODELS, DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_DEFAULT_PRICING_AS_OF, DEEPSEEK_MODEL_LIFECYCLE, DEEPSEEK_MODEL_LIFECYCLE_AS_OF, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK, deepseekLifecycleFor, inferReasoningCapability, inferVisionCapability };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-context-windows.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-
|
|
1
|
+
{"version":3,"file":"known-context-windows.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-flash` and the\n * `deepseek-v4-*` ids document 1M tokens (DeepSeek's model table);\n * the retired `deepseek-chat` and `deepseek-reasoner` documented 128K.\n * The longest matching prefix wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `deepseek.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [prefix: string, window: number]> = [\n [\"deepseek-chat\", 128_000],\n [\"deepseek-reasoner\", 128_000],\n [\"deepseek-v4\", 1_000_000],\n [\"deepseek-flash\", 1_000_000],\n];\n\n/**\n * The known context window (tokens, input plus output) of a DeepSeek chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"deepseek-chat\"); // → 128000\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const prefix = entry[0];\n\n if (id.startsWith(prefix) && (!best || prefix.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n"],"mappings":";AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ModelLifecycle } from "@warlock.js/ai";
|
|
2
|
+
//#region ../../packages/ai-deepseek/src/known-lifecycle.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Where DeepSeek's docs put its chat model names, as of
|
|
5
|
+
* {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and
|
|
6
|
+
* `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is
|
|
7
|
+
* retired as a model, but DeepSeek still accepts the name and serves it
|
|
8
|
+
* with `deepseek-flash`, billed at the Flash price; it published no
|
|
9
|
+
* shutdown date for the name.
|
|
10
|
+
*
|
|
11
|
+
* Sources: https://api-docs.deepseek.com/news/news260424 and
|
|
12
|
+
* https://api-docs.deepseek.com/quick_start/pricing
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEEPSEEK_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>>;
|
|
15
|
+
/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */
|
|
16
|
+
export declare const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
17
|
+
/**
|
|
18
|
+
* Look up the lifecycle of a DeepSeek model id (exact match), or
|
|
19
|
+
* `undefined` when the table does not cover it.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* deepseekLifecycleFor("deepseek-chat"); // { status: "retired", retiresOn: "2026-07-24", … }
|
|
23
|
+
*/
|
|
24
|
+
export declare function deepseekLifecycleFor(modelName: string): ModelLifecycle | undefined;
|
|
25
|
+
//#endregion
|
|
26
|
+
//# sourceMappingURL=known-lifecycle.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-lifecycle.d.mts","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"mappings":";;;;;;;;;;;;;qBAaa,0BAA0B,SAAS,eAAe;;qBAalD;;;;;;;;wBASG,qBAAqB,oBAAoB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region ../../packages/ai-deepseek/src/known-lifecycle.ts
|
|
2
|
+
/**
|
|
3
|
+
* Where DeepSeek's docs put its chat model names, as of
|
|
4
|
+
* {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and
|
|
5
|
+
* `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is
|
|
6
|
+
* retired as a model, but DeepSeek still accepts the name and serves it
|
|
7
|
+
* with `deepseek-flash`, billed at the Flash price; it published no
|
|
8
|
+
* shutdown date for the name.
|
|
9
|
+
*
|
|
10
|
+
* Sources: https://api-docs.deepseek.com/news/news260424 and
|
|
11
|
+
* https://api-docs.deepseek.com/quick_start/pricing
|
|
12
|
+
*/
|
|
13
|
+
const DEEPSEEK_MODEL_LIFECYCLE = {
|
|
14
|
+
"deepseek-flash": { status: "current" },
|
|
15
|
+
"deepseek-v4-pro": { status: "current" },
|
|
16
|
+
"deepseek-v4-flash": {
|
|
17
|
+
status: "retired",
|
|
18
|
+
replacement: "deepseek-flash"
|
|
19
|
+
},
|
|
20
|
+
"deepseek-chat": {
|
|
21
|
+
status: "retired",
|
|
22
|
+
retiresOn: "2026-07-24",
|
|
23
|
+
replacement: "deepseek-v4-flash"
|
|
24
|
+
},
|
|
25
|
+
"deepseek-reasoner": {
|
|
26
|
+
status: "retired",
|
|
27
|
+
retiresOn: "2026-07-24",
|
|
28
|
+
replacement: "deepseek-v4-flash"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */
|
|
32
|
+
const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
33
|
+
/**
|
|
34
|
+
* Look up the lifecycle of a DeepSeek model id (exact match), or
|
|
35
|
+
* `undefined` when the table does not cover it.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* deepseekLifecycleFor("deepseek-chat"); // { status: "retired", retiresOn: "2026-07-24", … }
|
|
39
|
+
*/
|
|
40
|
+
function deepseekLifecycleFor(modelName) {
|
|
41
|
+
return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName) ? DEEPSEEK_MODEL_LIFECYCLE[modelName] : void 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { DEEPSEEK_MODEL_LIFECYCLE, DEEPSEEK_MODEL_LIFECYCLE_AS_OF, deepseekLifecycleFor };
|
|
46
|
+
//# sourceMappingURL=known-lifecycle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-lifecycle.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"sourcesContent":["import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where DeepSeek's docs put its chat model names, as of\n * {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and\n * `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is\n * retired as a model, but DeepSeek still accepts the name and serves it\n * with `deepseek-flash`, billed at the Flash price; it published no\n * shutdown date for the name.\n *\n * Sources: https://api-docs.deepseek.com/news/news260424 and\n * https://api-docs.deepseek.com/quick_start/pricing\n */\nexport const DEEPSEEK_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"deepseek-flash\": { status: \"current\" },\n \"deepseek-v4-pro\": { status: \"current\" },\n \"deepseek-v4-flash\": { status: \"retired\", replacement: \"deepseek-flash\" },\n \"deepseek-chat\": { status: \"retired\", retiresOn: \"2026-07-24\", replacement: \"deepseek-v4-flash\" },\n \"deepseek-reasoner\": {\n status: \"retired\",\n retiresOn: \"2026-07-24\",\n replacement: \"deepseek-v4-flash\",\n },\n};\n\n/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */\nexport const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a DeepSeek model id (exact match), or\n * `undefined` when the table does not cover it.\n *\n * @example\n * deepseekLifecycleFor(\"deepseek-chat\"); // { status: \"retired\", retiresOn: \"2026-07-24\", … }\n */\nexport function deepseekLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName)\n ? DEEPSEEK_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,2BAAqE;CAChF,kBAAkB,EAAE,QAAQ,UAAU;CACtC,mBAAmB,EAAE,QAAQ,UAAU;CACvC,qBAAqB;EAAE,QAAQ;EAAW,aAAa;CAAiB;CACxE,iBAAiB;EAAE,QAAQ;EAAW,WAAW;EAAc,aAAa;CAAoB;CAChG,qBAAqB;EACnB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;AACF;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
|
package/esm/known-models.d.mts
CHANGED
|
@@ -10,29 +10,26 @@
|
|
|
10
10
|
* wrapped `openai.model(...)` call (explicit config wins over OpenAI's
|
|
11
11
|
* inference inside `OpenAIModel`).
|
|
12
12
|
*
|
|
13
|
-
* Verified against the official DeepSeek API docs (api-docs.deepseek.com
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `deepseek-reasoner`
|
|
17
|
-
*
|
|
18
|
-
* documents image (vision) input, so vision inference is conservatively
|
|
19
|
-
* `false` for every id.
|
|
13
|
+
* Verified against the official DeepSeek API docs (api-docs.deepseek.com):
|
|
14
|
+
* base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.
|
|
15
|
+
* The reasoning-capable surfaces are the `*-pro` tier and the retired
|
|
16
|
+
* `deepseek-reasoner` name. Vision inference is conservatively `false` for
|
|
17
|
+
* every id; opt in per model with `vision: true`.
|
|
20
18
|
*/
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
20
|
+
* Current DeepSeek chat model ids, surfaced for discovery and docs.
|
|
23
21
|
*
|
|
24
|
-
* - `deepseek-
|
|
25
|
-
*
|
|
26
|
-
* - `deepseek-
|
|
27
|
-
* reasoning channel and accepts the reasoning-effort knob.
|
|
22
|
+
* - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M
|
|
23
|
+
* context, thinking on by default, accepts image input per DeepSeek).
|
|
24
|
+
* - `deepseek-v4-pro` — the quality tier; thinks by default.
|
|
28
25
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* accepts any id the upstream serves.
|
|
26
|
+
* The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:
|
|
27
|
+
* `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and
|
|
28
|
+
* `deepseek-v4-flash`, which DeepSeek still accepts and bills at the
|
|
29
|
+
* `deepseek-flash` price. The list is informational only —
|
|
30
|
+
* `deepseek.model({ name })` accepts any id the upstream serves.
|
|
34
31
|
*/
|
|
35
|
-
export declare const DEEPSEEK_CHAT_MODELS: readonly ["deepseek-
|
|
32
|
+
export declare const DEEPSEEK_CHAT_MODELS: readonly ["deepseek-flash", "deepseek-v4-pro"];
|
|
36
33
|
/**
|
|
37
34
|
* Infer whether a DeepSeek model id is reasoning-capable based on the
|
|
38
35
|
* known substrings. Unknown ids default to `false` so the adapter never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-models.d.mts","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"known-models.d.mts","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+Ba;;;;;;;;;;;;wBA4BG,yBAAyB;;;;;;;;;;;;wBA+BzB,sBAAsB"}
|
package/esm/known-models.mjs
CHANGED
|
@@ -10,34 +10,26 @@
|
|
|
10
10
|
* wrapped `openai.model(...)` call (explicit config wins over OpenAI's
|
|
11
11
|
* inference inside `OpenAIModel`).
|
|
12
12
|
*
|
|
13
|
-
* Verified against the official DeepSeek API docs (api-docs.deepseek.com
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `deepseek-reasoner`
|
|
17
|
-
*
|
|
18
|
-
* documents image (vision) input, so vision inference is conservatively
|
|
19
|
-
* `false` for every id.
|
|
13
|
+
* Verified against the official DeepSeek API docs (api-docs.deepseek.com):
|
|
14
|
+
* base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.
|
|
15
|
+
* The reasoning-capable surfaces are the `*-pro` tier and the retired
|
|
16
|
+
* `deepseek-reasoner` name. Vision inference is conservatively `false` for
|
|
17
|
+
* every id; opt in per model with `vision: true`.
|
|
20
18
|
*/
|
|
21
19
|
/**
|
|
22
|
-
*
|
|
20
|
+
* Current DeepSeek chat model ids, surfaced for discovery and docs.
|
|
23
21
|
*
|
|
24
|
-
* - `deepseek-
|
|
25
|
-
*
|
|
26
|
-
* - `deepseek-
|
|
27
|
-
* reasoning channel and accepts the reasoning-effort knob.
|
|
22
|
+
* - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M
|
|
23
|
+
* context, thinking on by default, accepts image input per DeepSeek).
|
|
24
|
+
* - `deepseek-v4-pro` — the quality tier; thinks by default.
|
|
28
25
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* accepts any id the upstream serves.
|
|
26
|
+
* The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:
|
|
27
|
+
* `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and
|
|
28
|
+
* `deepseek-v4-flash`, which DeepSeek still accepts and bills at the
|
|
29
|
+
* `deepseek-flash` price. The list is informational only —
|
|
30
|
+
* `deepseek.model({ name })` accepts any id the upstream serves.
|
|
34
31
|
*/
|
|
35
|
-
const DEEPSEEK_CHAT_MODELS = [
|
|
36
|
-
"deepseek-chat",
|
|
37
|
-
"deepseek-reasoner",
|
|
38
|
-
"deepseek-v4-flash",
|
|
39
|
-
"deepseek-v4-pro"
|
|
40
|
-
];
|
|
32
|
+
const DEEPSEEK_CHAT_MODELS = ["deepseek-flash", "deepseek-v4-pro"];
|
|
41
33
|
/**
|
|
42
34
|
* Substrings identifying DeepSeek model ids that expose a reasoning /
|
|
43
35
|
* thinking channel and accept the reasoning-effort knob.
|
package/esm/known-models.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"sourcesContent":["/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com
|
|
1
|
+
{"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"sourcesContent":["/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com):\n * base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.\n * The reasoning-capable surfaces are the `*-pro` tier and the retired\n * `deepseek-reasoner` name. Vision inference is conservatively `false` for\n * every id; opt in per model with `vision: true`.\n */\n\n/**\n * Current DeepSeek chat model ids, surfaced for discovery and docs.\n *\n * - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M\n * context, thinking on by default, accepts image input per DeepSeek).\n * - `deepseek-v4-pro` — the quality tier; thinks by default.\n *\n * The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:\n * `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and\n * `deepseek-v4-flash`, which DeepSeek still accepts and bills at the\n * `deepseek-flash` price. The list is informational only —\n * `deepseek.model({ name })` accepts any id the upstream serves.\n */\nexport const DEEPSEEK_CHAT_MODELS = [\"deepseek-flash\", \"deepseek-v4-pro\"] as const;\n\n/**\n * Substrings identifying DeepSeek model ids that expose a reasoning /\n * thinking channel and accept the reasoning-effort knob.\n *\n * - `deepseek-reasoner` — the dedicated thinking surface (R1 lineage).\n * - `-pro` — the V4 quality tier (`deepseek-v4-pro`), which thinks by\n * default per DeepSeek's docs.\n *\n * `deepseek-chat` (the V3 non-thinking surface) and `deepseek-v4-flash`\n * stay `false`. A substring match tolerates date/preview suffixes the\n * provider may append. Override per-model via\n * `deepseek.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"deepseek-reasoner\", \"-pro\"];\n\n/**\n * Infer whether a DeepSeek model id is reasoning-capable based on the\n * known substrings. Unknown ids default to `false` so the adapter never\n * forwards an unsupported reasoning param to a non-thinking model.\n *\n * @example\n * inferReasoningCapability(\"deepseek-reasoner\"); // → true\n * inferReasoningCapability(\"deepseek-v4-pro\"); // → true\n * inferReasoningCapability(\"deepseek-chat\"); // → false\n * inferReasoningCapability(\"deepseek-v4-flash\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Substrings identifying DeepSeek model ids that accept image (vision)\n * input.\n *\n * Currently **empty**: as of mid-2026, no DeepSeek chat model documents\n * vision input on the OpenAI-compatible Chat Completions endpoint, so\n * inference returns `false` for every id and passing an image attachment\n * surfaces a clear, agent-side capability error instead of an opaque 400.\n * Append a fragment here (and a paired spec case) the day DeepSeek ships a\n * multimodal chat model. Devs can always opt in per-model via\n * `deepseek.model({ name, vision: true })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS: readonly string[] = [];\n\n/**\n * Infer whether a DeepSeek model id supports vision based on the known\n * substrings. Today this is always `false` (see\n * {@link VISION_CAPABLE_SUBSTRINGS}); kept as a function so the\n * {@link DeepSeekSDK} call site and the override semantics stay identical\n * to the other adapters, ready for a future multimodal id.\n *\n * @example\n * inferVisionCapability(\"deepseek-chat\"); // → false\n * inferVisionCapability(\"deepseek-reasoner\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,uBAAuB,CAAC,kBAAkB,iBAAiB;;;;;;;;;;;;;;AAexE,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAM,4BAA+C,CAAC;;;;;;;;;;;;AAatD,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF"}
|
package/esm/sdk.d.mts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { DeepSeekEmbedderConfig, DeepSeekImageConfig, DeepSeekModelConfig, DeepSeekSDKConfig } from "./config.type.mjs";
|
|
2
2
|
import { EmbedderContract, ImageModelContract, ListModelsOptions, ModelContract, ModelInfo, ModelPricing, SDKAdapterContract } from "@warlock.js/ai";
|
|
3
3
|
//#region ../../packages/ai-deepseek/src/sdk.d.ts
|
|
4
|
+
/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */
|
|
5
|
+
export declare const DEEPSEEK_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
4
6
|
/**
|
|
5
7
|
* Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed
|
|
6
8
|
* by model name; `cachedInput` is the cache-hit input rate.
|
|
7
9
|
*
|
|
8
|
-
* Source: https://api-docs.deepseek.com/quick_start/pricing,
|
|
9
|
-
*
|
|
10
|
+
* Source: https://api-docs.deepseek.com/quick_start/pricing, as of
|
|
11
|
+
* {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and
|
|
10
12
|
* 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat
|
|
11
13
|
* `ModelPricing` cannot follow the clock, so these are the **peak** rates —
|
|
12
14
|
* an upper bound that keeps USD budgets safe; off-peak calls really cost
|
package/esm/sdk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.mts","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/sdk.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.mts","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/sdk.ts"],"mappings":";;;;qBA6Ba;;;;;;;;;;;;;;;;;;;;qBAqBA,0BAA0B,SAAS,eAAe;;;;;;;;qBAalD,2BAA2B,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6CnD,uBAAuB;;mBAEjB;mBACA;mBACA;EAEjB,YAAmB,QAAQ;;;;;;;;;;;;;;;EA+BpB,MAAM,QAAQ,sBAAsB;;;;;;EAkB9B,MAAM,cAAc,iBAAiB;;;;;;;;;;;EAc3C,SAAS,QAAQ,yBAAyB;;;;;;;;;EAY1C,MAAM,QAAQ,sBAAsB;;;;;;;;;;;EAa9B,OAAO,UAAU,oBAAoB,QAAQ"}
|
package/esm/sdk.mjs
CHANGED
|
@@ -10,12 +10,14 @@ import { OpenAISDK } from "@warlock.js/ai-openai";
|
|
|
10
10
|
const DEEPSEEK_BASE_URL = "https://api.deepseek.com";
|
|
11
11
|
/** Default upstream label for models produced by this SDK. */
|
|
12
12
|
const DEEPSEEK_PROVIDER = "deepseek";
|
|
13
|
+
/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */
|
|
14
|
+
const DEEPSEEK_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
13
15
|
/**
|
|
14
16
|
* Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed
|
|
15
17
|
* by model name; `cachedInput` is the cache-hit input rate.
|
|
16
18
|
*
|
|
17
|
-
* Source: https://api-docs.deepseek.com/quick_start/pricing,
|
|
18
|
-
*
|
|
19
|
+
* Source: https://api-docs.deepseek.com/quick_start/pricing, as of
|
|
20
|
+
* {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and
|
|
19
21
|
* 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat
|
|
20
22
|
* `ModelPricing` cannot follow the clock, so these are the **peak** rates —
|
|
21
23
|
* an upper bound that keeps USD budgets safe; off-peak calls really cost
|
|
@@ -196,5 +198,5 @@ var DeepSeekSDK = class {
|
|
|
196
198
|
};
|
|
197
199
|
|
|
198
200
|
//#endregion
|
|
199
|
-
export { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK };
|
|
201
|
+
export { DEEPSEEK_DEFAULT_PRICING, DEEPSEEK_DEFAULT_PRICING_AS_OF, DEEPSEEK_OFF_PEAK_PRICING, DeepSeekSDK };
|
|
200
202
|
//# sourceMappingURL=sdk.mjs.map
|
package/esm/sdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/sdk.ts"],"sourcesContent":["import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, fetched\n * 2026-10-17. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,oBAAoB;;AAG1B,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;AAqB1B,MAAa,2BAAmE;CAC9E,kBAAkB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CAChE,qBAAqB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CACnE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;AASA,MAAa,4BAAoE;CAC/E,kBAAkB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACjE,qBAAqB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACpE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAuD;CAMrD,AAAO,YAAY,QAA2B;EAC5C,MAAM,EAAE,UAAU,SAAS,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW,YAAY;EAE5B,KAAK,UAAU;GAAE,GAAG;GAA0B,GAAG;EAAQ;EAKzD,KAAK,SAAS,IAAI,UAAU;GAC1B,GAAG;GACH,SAAS,WAAW;GACpB,UAAU,KAAK;EACjB,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,AAAO,MAAM,QAA4C;EACvD,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EACrE,MAAM,WAAgC;GACpC,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GACxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF"}
|
|
1
|
+
{"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/sdk.ts"],"sourcesContent":["import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */\nexport const DEEPSEEK_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, as of\n * {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,oBAAoB;;AAG1B,MAAM,oBAAoB;;AAG1B,MAAa,iCAAiC;;;;;;;;;;;;;;;;;;;;AAqB9C,MAAa,2BAAmE;CAC9E,kBAAkB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CAChE,qBAAqB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CACnE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;AASA,MAAa,4BAAoE;CAC/E,kBAAkB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACjE,qBAAqB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACpE,mBAAmB;EAAE,OAAO;EAAM,QAAQ;EAAM,aAAa;CAAM;AACrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,cAAb,MAAuD;CAMrD,AAAO,YAAY,QAA2B;EAC5C,MAAM,EAAE,UAAU,SAAS,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW,YAAY;EAE5B,KAAK,UAAU;GAAE,GAAG;GAA0B,GAAG;EAAQ;EAKzD,KAAK,SAAS,IAAI,UAAU;GAC1B,GAAG;GACH,SAAS,WAAW;GACpB,UAAU,KAAK;EACjB,CAAC;CACH;;;;;;;;;;;;;;;CAgBA,AAAO,MAAM,QAA4C;EACvD,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EACrE,MAAM,WAAgC;GACpC,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GACxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF"}
|
package/llms-full.txt
CHANGED
|
@@ -43,14 +43,12 @@ Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
|
|
|
43
43
|
|
|
44
44
|
## Models
|
|
45
45
|
|
|
46
|
-
| Model
|
|
47
|
-
|
|
|
48
|
-
| `deepseek-
|
|
49
|
-
| `deepseek-
|
|
50
|
-
| `deepseek-v4-flash` | Newer flash tier. Reasoning **off** by default. |
|
|
51
|
-
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
46
|
+
| Model | Notes |
|
|
47
|
+
| ----------------- | ------------------------------------------------------------------------------------ |
|
|
48
|
+
| `deepseek-flash` | Fast tier (served by DeepSeek-V4.1-Flash), 1M context. Reasoning **off** by default. |
|
|
49
|
+
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
`deepseek-chat` and `deepseek-reasoner` were retired on 2026-07-24, and `deepseek-v4-flash` is a retired name that DeepSeek still accepts and serves with `deepseek-flash`, billed at the Flash price. Their status, dates and replacements are in `DEEPSEEK_MODEL_LIFECYCLE` (lookup: `deepseekLifecycleFor(name)`, checked `DEEPSEEK_MODEL_LIFECYCLE_AS_OF`; the price table's check date is `DEEPSEEK_DEFAULT_PRICING_AS_OF`); the capability inference still understands every name. `deepseek.model({ name })` accepts any id the upstream serves.
|
|
54
52
|
|
|
55
53
|
## Capabilities — what's auto-set
|
|
56
54
|
|
|
@@ -114,7 +112,7 @@ console.log(usage.cachedTokens, totalCost(usage.cost));
|
|
|
114
112
|
Resolution at `model()` time: per-model `pricing` > SDK `pricing` registry > built-in DeepSeek default > `undefined`.
|
|
115
113
|
|
|
116
114
|
- **Source.** https://api-docs.deepseek.com/quick_start/pricing, fetched 2026-10-17. Covered: `deepseek-flash`, `deepseek-v4-flash` (its legacy name, same rate) and `deepseek-v4-pro`.
|
|
117
|
-
- **Unpriced:** `deepseek-chat` / `deepseek-reasoner` are gone from the price list (
|
|
115
|
+
- **Unpriced:** `deepseek-chat` / `deepseek-reasoner` are gone from the price list (retired 2026-07-24) — pass `pricing` if a gateway still serves them.
|
|
118
116
|
- **Usage semantics.** DeepSeek's `prompt_tokens` equals cache hits + misses and `prompt_tokens_details.cached_tokens` mirrors `prompt_cache_hit_tokens`, so the usage is `inputIncludesCache: true` and hits bill at `cachedInput`. DeepSeek caches automatically on disk and takes no request hint, so `promptCacheKey` is never sent.
|
|
119
117
|
|
|
120
118
|
## Errors
|
|
@@ -153,6 +151,6 @@ Models from this adapter have no native `countTokens` method. Check
|
|
|
153
151
|
|
|
154
152
|
## Context window
|
|
155
153
|
|
|
156
|
-
`deepseek-
|
|
154
|
+
`deepseek-flash` and `deepseek-v4-*` report a 1,000,000 `capabilities.contextWindow` (the retired `deepseek-chat` / `deepseek-reasoner` 128,000); `deepseek.model({ name, contextWindow })` wins.
|
|
157
155
|
|
|
158
156
|
|
package/package.json
CHANGED
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"directory": "packages/ai-deepseek"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@warlock.js/ai-openai": "5.
|
|
18
|
-
"@warlock.js/logger": "5.
|
|
17
|
+
"@warlock.js/ai-openai": "5.47.0",
|
|
18
|
+
"@warlock.js/logger": "5.47.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@warlock.js/ai": "5.
|
|
21
|
+
"@warlock.js/ai": "5.47.0"
|
|
22
22
|
},
|
|
23
|
-
"version": "5.
|
|
23
|
+
"version": "5.47.0",
|
|
24
24
|
"main": "./cjs/index.cjs",
|
|
25
25
|
"module": "./esm/index.mjs",
|
|
26
26
|
"types": "./esm/index.d.mts",
|
package/skills/SKILL.md
CHANGED
|
@@ -35,14 +35,12 @@ Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
|
|
|
35
35
|
|
|
36
36
|
## Models
|
|
37
37
|
|
|
38
|
-
| Model
|
|
39
|
-
|
|
|
40
|
-
| `deepseek-
|
|
41
|
-
| `deepseek-
|
|
42
|
-
| `deepseek-v4-flash` | Newer flash tier. Reasoning **off** by default. |
|
|
43
|
-
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
38
|
+
| Model | Notes |
|
|
39
|
+
| ----------------- | ------------------------------------------------------------------------------------ |
|
|
40
|
+
| `deepseek-flash` | Fast tier (served by DeepSeek-V4.1-Flash), 1M context. Reasoning **off** by default. |
|
|
41
|
+
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
`deepseek-chat` and `deepseek-reasoner` were retired on 2026-07-24, and `deepseek-v4-flash` is a retired name that DeepSeek still accepts and serves with `deepseek-flash`, billed at the Flash price. Their status, dates and replacements are in `DEEPSEEK_MODEL_LIFECYCLE` (lookup: `deepseekLifecycleFor(name)`, checked `DEEPSEEK_MODEL_LIFECYCLE_AS_OF`; the price table's check date is `DEEPSEEK_DEFAULT_PRICING_AS_OF`); the capability inference still understands every name. `deepseek.model({ name })` accepts any id the upstream serves.
|
|
46
44
|
|
|
47
45
|
## Capabilities — what's auto-set
|
|
48
46
|
|
|
@@ -106,7 +104,7 @@ console.log(usage.cachedTokens, totalCost(usage.cost));
|
|
|
106
104
|
Resolution at `model()` time: per-model `pricing` > SDK `pricing` registry > built-in DeepSeek default > `undefined`.
|
|
107
105
|
|
|
108
106
|
- **Source.** https://api-docs.deepseek.com/quick_start/pricing, fetched 2026-10-17. Covered: `deepseek-flash`, `deepseek-v4-flash` (its legacy name, same rate) and `deepseek-v4-pro`.
|
|
109
|
-
- **Unpriced:** `deepseek-chat` / `deepseek-reasoner` are gone from the price list (
|
|
107
|
+
- **Unpriced:** `deepseek-chat` / `deepseek-reasoner` are gone from the price list (retired 2026-07-24) — pass `pricing` if a gateway still serves them.
|
|
110
108
|
- **Usage semantics.** DeepSeek's `prompt_tokens` equals cache hits + misses and `prompt_tokens_details.cached_tokens` mirrors `prompt_cache_hit_tokens`, so the usage is `inputIncludesCache: true` and hits bill at `cachedInput`. DeepSeek caches automatically on disk and takes no request hint, so `promptCacheKey` is never sent.
|
|
111
109
|
|
|
112
110
|
## Errors
|
|
@@ -145,4 +143,4 @@ Models from this adapter have no native `countTokens` method. Check
|
|
|
145
143
|
|
|
146
144
|
## Context window
|
|
147
145
|
|
|
148
|
-
`deepseek-
|
|
146
|
+
`deepseek-flash` and `deepseek-v4-*` report a 1,000,000 `capabilities.contextWindow` (the retired `deepseek-chat` / `deepseek-reasoner` 128,000); `deepseek.model({ name, contextWindow })` wins.
|