@warlock.js/ai-deepseek 4.6.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +125 -0
- package/cjs/index.cjs +255 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/config.type.d.mts +146 -0
- package/esm/config.type.d.mts.map +1 -0
- package/esm/index.d.mts +4 -0
- package/esm/index.mjs +4 -0
- package/esm/known-models.d.mts +62 -0
- package/esm/known-models.d.mts.map +1 -0
- package/esm/known-models.mjs +101 -0
- package/esm/known-models.mjs.map +1 -0
- package/esm/sdk.d.mts +94 -0
- package/esm/sdk.d.mts.map +1 -0
- package/esm/sdk.mjs +153 -0
- package/esm/sdk.mjs.map +1 -0
- package/llms-full.txt +116 -0
- package/llms.txt +9 -0
- package/package.json +38 -0
- package/skills/setup-deepseek/SKILL.md +106 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-deepseek
|
|
3
|
+
description: 'Wire @warlock.js/ai-deepseek — new DeepSeekSDK({apiKey, baseURL?, provider?, pricing?}) for DeepSeek''s OpenAI-compatible API, .model({name, reasoning?, vision?, structuredOutput?, responseFormat?}) for ModelContract. Thin wrapper over @warlock.js/ai-openai''s OpenAISDK pinned to https://api.deepseek.com with provider "deepseek"; injects DeepSeek-specific reasoning/vision inference + built-in pricing. Models: deepseek-chat (non-thinking), deepseek-reasoner (thinking/reasoning), deepseek-v4-flash, deepseek-v4-pro. Triggers: `DeepSeekSDK`, `deepseek-chat`, `deepseek-reasoner`, `deepseek-v4`, `api.deepseek.com`, `DEEPSEEK_API_KEY`, reasoning effort on deepseek; "wire deepseek into a warlock agent", "use deepseek-reasoner", "configure deepseek-chat", "route a warlock agent through deepseek". Skip: OpenAI/Azure/OpenRouter — `@warlock.js/ai-openai`; agent wiring — `@warlock.js/ai/run-ai-agent/SKILL.md`; adapter comparison — `@warlock.js/ai/pick-ai-provider/SKILL.md`; raw deepseek HTTP / the `openai` SDK directly. Typical import `import { DeepSeekSDK } from "@warlock.js/ai-deepseek"`.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `@warlock.js/ai-deepseek`
|
|
7
|
+
|
|
8
|
+
Provider adapter for DeepSeek. DeepSeek's API is **OpenAI-compatible**, so this package is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md)'s `OpenAISDK`: it constructs an internal `OpenAISDK` pinned to `https://api.deepseek.com` with `provider: "deepseek"` and delegates `model()` / `embedder()` / `image()` / `count()` to it — while injecting DeepSeek's own capability inference and pricing so the right flags are set even though the model names aren't OpenAI names. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
|
|
9
|
+
|
|
10
|
+
## Construction
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { DeepSeekSDK } from "@warlock.js/ai-deepseek";
|
|
14
|
+
|
|
15
|
+
const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`apiKey` is the only required field — `baseURL` defaults to `https://api.deepseek.com` (DeepSeek's OpenAI-compatible endpoint) and `provider` defaults to `"deepseek"`. Override `baseURL` only for a proxy/gateway, or `provider` to relabel the upstream:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
new DeepSeekSDK({ apiKey, baseURL: "https://my-gateway/deepseek", provider: "deepseek-proxy" });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`DeepSeekSDK` is a class (like `OpenAISDK`) holding one long-lived wrapped client — construct once per account and reuse.
|
|
25
|
+
|
|
26
|
+
## Producing a model
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
deepseek.model({ name: "deepseek-chat" }) // V3 lineage, non-thinking
|
|
30
|
+
deepseek.model({ name: "deepseek-reasoner" }) // R1 lineage, reasoning-capable
|
|
31
|
+
deepseek.model({ name: "deepseek-chat", temperature: 0.2 })
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
|
|
35
|
+
|
|
36
|
+
## Models
|
|
37
|
+
|
|
38
|
+
| Model | Notes |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `deepseek-chat` | Non-thinking surface (V3 lineage). Fast, cheap, broad coverage. Reasoning **off**. |
|
|
41
|
+
| `deepseek-reasoner` | Thinking surface (R1 lineage). Emits a reasoning channel. Reasoning **on**. |
|
|
42
|
+
| `deepseek-v4-flash` | Newer flash tier. Reasoning **off** by default. |
|
|
43
|
+
| `deepseek-v4-pro` | Newer quality tier. Reasoning **on** by default. |
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
## Capabilities — what's auto-set
|
|
48
|
+
|
|
49
|
+
| Flag | Default |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `reasoning` | Inferred from the DeepSeek model name. `true` for `deepseek-reasoner` and the `*-pro` tier; `false` for `deepseek-chat` / `*-flash`. Drives whether the reasoning-effort knob is forwarded. |
|
|
52
|
+
| `vision` | `false` for every DeepSeek model — no DeepSeek chat model documents image input (mid-2026). |
|
|
53
|
+
| `structuredOutput` | `true` (inherited from the wrapped OpenAI model), unless `responseFormat` is set to a loose mode. |
|
|
54
|
+
| `promptCaching` | `true` (inherited). DeepSeek reports cache hits via `usage.cachedTokens`, the same shape as OpenAI. |
|
|
55
|
+
|
|
56
|
+
**Override any flag explicitly** via `.model({ name, reasoning?, vision?, structuredOutput? })` — an explicit value always wins over the injected inference.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
deepseek.model({ name: "deepseek-chat", reasoning: true }) // force thinking flag
|
|
60
|
+
deepseek.model({ name: "deepseek-reasoner", reasoning: false }) // suppress it
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Uses the OpenAI-compatible endpoint
|
|
64
|
+
|
|
65
|
+
Everything on the wire — Chat Completions request/response shape, streaming loop, tool-call accumulation, structured-output `response_format`, multipart message mapping, and error wrapping — is inherited **unchanged** from `OpenAIModel`. See [`setup-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail; it all applies here against `https://api.deepseek.com`.
|
|
66
|
+
|
|
67
|
+
Structured output, reasoning effort, and streaming therefore behave exactly as documented for the OpenAI adapter:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const model = deepseek.model({ name: "deepseek-reasoner" }); // reasoning auto-true
|
|
71
|
+
await model.complete(messages, { reasoning: { effort: "high" } }); // → reasoning_effort: "high"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Embeddings & images
|
|
75
|
+
|
|
76
|
+
`deepseek.embedder({...})` and `deepseek.image({...})` delegate to the wrapped `OpenAISDK`. **DeepSeek does not officially document an OpenAI-compatible embeddings endpoint or an image-generation endpoint (mid-2026)** — these delegates exist for adapter parity and work against a compatible gateway you point `baseURL` at, but may fail against the stock DeepSeek endpoint. Use a dedicated embeddings provider (e.g. `@warlock.js/ai-openai` / `@warlock.js/ai-google`) for RAG.
|
|
77
|
+
|
|
78
|
+
## Pricing
|
|
79
|
+
|
|
80
|
+
The adapter ships **built-in DeepSeek pricing defaults** (USD per 1M tokens, from DeepSeek's published table), so `usage.cost` is computed out of the box:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const deepseek = new DeepSeekSDK({ apiKey }); // deepseek-chat → { input: 0.14, output: 0.28, cachedInput: 0.0028 }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Override per model or per SDK exactly like the OpenAI adapter. Resolution at `model()` time: per-model `pricing` > SDK `pricing` registry > built-in DeepSeek default > `undefined`.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
new DeepSeekSDK({ apiKey, pricing: { "deepseek-reasoner": { input: 0.55, output: 2.19 } } });
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Errors
|
|
93
|
+
|
|
94
|
+
Raw errors surface through the wrapped OpenAI adapter's wrapper into the typed `@warlock.js/ai` `AIError` hierarchy — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
|
|
95
|
+
|
|
96
|
+
## When NOT to use this skill
|
|
97
|
+
|
|
98
|
+
- OpenAI / Azure OpenAI / OpenRouter / local OpenAI-compatible gateways — use `@warlock.js/ai-openai`.
|
|
99
|
+
- Anthropic — `@warlock.js/ai-anthropic`. Gemini — `@warlock.js/ai-google`. Ollama — `@warlock.js/ai-ollama`.
|
|
100
|
+
- Calling the DeepSeek HTTP API or the raw `openai` SDK directly without going through `@warlock.js/ai` agents.
|
|
101
|
+
|
|
102
|
+
## See also
|
|
103
|
+
|
|
104
|
+
- [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; all wire-level behavior.
|
|
105
|
+
- [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
|
|
106
|
+
- [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.
|