@warlock.js/ai-mistral 5.19.1 → 5.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
- # Changelog — @warlock.js/ai-mistral
1
+ # Changelog — @warlock.js/ai-mistral
2
2
 
3
3
  All notable changes to `@warlock.js/ai-mistral` 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.21.0 - 2026-09-25
8
+
9
+ ### Changed
10
+
11
+ - Lockstep release maintenance and dependency refresh.
12
+ ## 5.20.0 - 2026-09-24
13
+
14
+ ### Changed
15
+
16
+ - Added a package-level skill index and clearer discovery descriptions for grouped agent guidance.
17
+
7
18
  ## 5.19.0 - 2026-09-23
8
19
 
9
20
  ### Changed
package/llms-full.txt CHANGED
@@ -6,100 +6,100 @@
6
6
 
7
7
  ## setup-mistral `@warlock.js/ai-mistral/setup-mistral/SKILL.md`
8
8
 
9
- ---
10
- name: setup-mistral
11
- description: "@warlock.js/ai-mistral in @warlock.js/ai-mistral; use when you need to set up mistral."
12
- ---
13
-
14
- # `@warlock.js/ai-mistral`
15
-
16
- Provider adapter for Mistral AI. Mistral exposes an **OpenAI-compatible** API, so `MistralSDK` is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — it does not re-implement the wire protocol, streaming, tool calls, structured output, error wrapping, or token accounting. It builds one internal `OpenAISDK` pointed at Mistral's `baseURL` with `provider: "mistral"`, then layers on this provider's own capability inference + default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
17
-
18
- ## Construction
19
-
20
- ```ts
21
- import { MistralSDK } from "@warlock.js/ai-mistral";
22
-
23
- const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
24
- ```
25
-
26
- `baseURL` defaults to `https://api.mistral.ai/v1` (the OpenAI-compatible endpoint serving `/chat/completions` and `/embeddings`). `provider` defaults to `"mistral"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs. Override `baseURL` only to reach a Mistral-compatible gateway/proxy. Every other upstream OpenAI `ClientOptions` value (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim.
27
-
28
- ## Producing a model
29
-
30
- ```ts
31
- mistral.model({ name: "mistral-large-latest" }) // multimodal flagship
32
- mistral.model({ name: "magistral-medium-latest" }) // reasoning
33
- mistral.model({ name: "pixtral-large-latest" }) // vision
34
- mistral.model({ name: "some-fine-tune", vision: true }) // explicit capability override
35
- ```
36
-
37
- Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
38
-
39
- ## Capabilities — what's auto-set
40
-
41
- The wrapper injects **Mistral-aware** inference before delegating to the OpenAI adapter (the OpenAI prefix lists never match Mistral names):
42
-
43
- | Flag | Default |
44
- | --- | --- |
45
- | `vision` | Inferred from the model name. `true` for the `pixtral` family and the recent multimodal generations (`mistral-large`, `mistral-medium`, `ministral-3`); `false` otherwise. |
46
- | `reasoning` | Inferred from the model name. `true` for the `magistral` family and the hybrid `mistral-small` generation; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
47
- | `structuredOutput` | `true`, unless `responseFormat` is forced to `"json_object"` / `"text"` (loose modes). |
48
- | `promptCaching` | `true` (inherited from the OpenAI adapter — read-side `cachedTokens` accounting). |
49
- | `pdf` / `audio` | `false` by default (opt-in `.model({ pdf: true })` / `{ audio: true }`). |
50
-
51
- **Override any flag explicitly** via `.model({ name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio? })` — an explicit value always wins over inference. The known-family fragments live in `known-models.ts` (`inferVisionCapability`, `inferReasoningCapability`).
52
-
53
- The headline `-latest` aliases are exported as `MISTRAL_MODELS` ({ chat, vision, reasoning, embedding }) for convenience — `mistral.model()` also accepts any version-pinned id (`mistral-large-2512`, `magistral-medium-2509`).
54
-
55
- ## Uses the OpenAI-compatible endpoint
56
-
57
- Because Mistral speaks the OpenAI Chat Completions + Embeddings protocol, everything the OpenAI adapter does applies unchanged: streaming deltas + consolidated tool calls, `response_format: json_schema` structured output (override per model with `responseFormat`), `reasoning_effort` for reasoning models, multipart image input, and the neutral `Usage` breakdown (`input` / `output` / `cachedTokens` / `reasoningTokens`). See [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail — it is identical here.
58
-
59
- **No image generation.** Mistral has no OpenAI-compatible image endpoint, so `MistralSDK` intentionally does **not** expose `image()` — the structural absence is the capability guard (`ai.mistral.image(...)` is a compile-time error).
60
-
61
- ## Embeddings
62
-
63
- ```ts
64
- const embedder = mistral.embedder({ name: "mistral-embed" });
65
-
66
- const { vector, dimensions, usage } = await embedder.embed("Hello world");
67
- const { vectors } = await embedder.embedMany(["doc 1", "doc 2"]);
68
- ```
69
-
70
- `mistral-embed` is reachable through the OpenAI-compatible `/v1/embeddings`; the embedder delegates to the wrapped OpenAI embedder.
71
-
72
- ## Pricing — per-model registry
73
-
74
- The adapter ships a conservative default registry (`MISTRAL_DEFAULT_PRICING`, USD per 1,000,000 tokens) so cost truth works out of the box. Pass your own `pricing` to win per model id:
75
-
76
- ```ts
77
- const mistral = new MistralSDK({
78
- apiKey,
79
- pricing: {
80
- // USD per 1M tokens — billing-grade overrides.
81
- "mistral-large-latest": { input: 2, output: 6 },
82
- "magistral-medium-latest": { input: 2, output: 5 },
83
- },
84
- });
85
- ```
86
-
87
- Resolution at `model()` time: per-model `pricing` (`mistral.model({ name, pricing })`) > SDK-level `pricing` > `MISTRAL_DEFAULT_PRICING` > `undefined`. The defaults are list-price approximations — pass explicit rates for billing.
88
-
89
- ## Errors
90
-
91
- Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the wrapped OpenAI adapter (dispatch keys on `APIError.status + code`) — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
92
-
93
- ## When NOT to use this skill
94
-
95
- - Image generation — Mistral has no OpenAI-compatible image endpoint; `mistral.image()` does not exist.
96
- - Other providers — OpenAI `@warlock.js/ai-openai`, Gemini `@warlock.js/ai-google`, Anthropic `@warlock.js/ai-anthropic`, Bedrock `@warlock.js/ai-bedrock`, Ollama `@warlock.js/ai-ollama`.
97
- - Raw `@mistralai/mistralai` SDK or Vercel `@ai-sdk/mistral` without going through `@warlock.js/ai` agents.
98
-
99
- ## See also
100
-
101
- - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; identical wire behavior.
102
- - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
103
- - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.
9
+ ---
10
+ name: setup-mistral
11
+ description: 'Wire @warlock.js/ai-mistral — new MistralSDK({apiKey, baseURL?, provider?, pricing?}) for Mistral AI, a thin wrapper over the OpenAI adapter that uses Mistral''s OpenAI-compatible endpoint (https://api.mistral.ai/v1). .model({name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio?}) for a ModelContract with Mistral-aware capabilities (vision auto-inferred for the pixtral family, reasoning for the magistral family + hybrid mistral-small), .embedder({name, dimensions?}) for mistral-embed via /v1/embeddings. Triggers: `MistralSDK`, `mistral.model`, `mistral.embedder`, `pixtral`, `magistral`, `mistral-large`, `mistral-small`, `mistral-medium`, `ministral`, `mistral-embed`, `api.mistral.ai`, OpenAI-compatible Mistral, `reasoning_effort`, `responseFormat`, `pricing`; "use mistral", "wire mistral into a warlock agent", "configure mistral-large", "use magistral reasoning", "pixtral vision", "mistral embeddings with warlock". Skip: image generation (Mistral has no OpenAI-compatible image endpoint — `mistral.image()` does not exist); the wrapped adapter internals `@warlock.js/ai-openai`; agent wiring `@warlock.js/ai/run-ai-agent/SKILL.md`; embedder usage `@warlock.js/ai/embed-text/SKILL.md`; provider picking `@warlock.js/ai/pick-ai-provider/SKILL.md`; siblings `@warlock.js/ai-google`, `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-ollama`; raw `@mistralai/mistralai`, Vercel `@ai-sdk/mistral`.'
12
+ ---
13
+
14
+ # `@warlock.js/ai-mistral`
15
+
16
+ Provider adapter for Mistral AI. Mistral exposes an **OpenAI-compatible** API, so `MistralSDK` is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — it does not re-implement the wire protocol, streaming, tool calls, structured output, error wrapping, or token accounting. It builds one internal `OpenAISDK` pointed at Mistral's `baseURL` with `provider: "mistral"`, then layers on this provider's own capability inference + default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
17
+
18
+ ## Construction
19
+
20
+ ```ts
21
+ import { MistralSDK } from "@warlock.js/ai-mistral";
22
+
23
+ const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
24
+ ```
25
+
26
+ `baseURL` defaults to `https://api.mistral.ai/v1` (the OpenAI-compatible endpoint serving `/chat/completions` and `/embeddings`). `provider` defaults to `"mistral"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs. Override `baseURL` only to reach a Mistral-compatible gateway/proxy. Every other upstream OpenAI `ClientOptions` value (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim.
27
+
28
+ ## Producing a model
29
+
30
+ ```ts
31
+ mistral.model({ name: "mistral-large-latest" }) // multimodal flagship
32
+ mistral.model({ name: "magistral-medium-latest" }) // reasoning
33
+ mistral.model({ name: "pixtral-large-latest" }) // vision
34
+ mistral.model({ name: "some-fine-tune", vision: true }) // explicit capability override
35
+ ```
36
+
37
+ Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
38
+
39
+ ## Capabilities — what's auto-set
40
+
41
+ The wrapper injects **Mistral-aware** inference before delegating to the OpenAI adapter (the OpenAI prefix lists never match Mistral names):
42
+
43
+ | Flag | Default |
44
+ | --- | --- |
45
+ | `vision` | Inferred from the model name. `true` for the `pixtral` family and the recent multimodal generations (`mistral-large`, `mistral-medium`, `ministral-3`); `false` otherwise. |
46
+ | `reasoning` | Inferred from the model name. `true` for the `magistral` family and the hybrid `mistral-small` generation; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
47
+ | `structuredOutput` | `true`, unless `responseFormat` is forced to `"json_object"` / `"text"` (loose modes). |
48
+ | `promptCaching` | `true` (inherited from the OpenAI adapter — read-side `cachedTokens` accounting). |
49
+ | `pdf` / `audio` | `false` by default (opt-in `.model({ pdf: true })` / `{ audio: true }`). |
50
+
51
+ **Override any flag explicitly** via `.model({ name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio? })` — an explicit value always wins over inference. The known-family fragments live in `known-models.ts` (`inferVisionCapability`, `inferReasoningCapability`).
52
+
53
+ The headline `-latest` aliases are exported as `MISTRAL_MODELS` ({ chat, vision, reasoning, embedding }) for convenience — `mistral.model()` also accepts any version-pinned id (`mistral-large-2512`, `magistral-medium-2509`).
54
+
55
+ ## Uses the OpenAI-compatible endpoint
56
+
57
+ Because Mistral speaks the OpenAI Chat Completions + Embeddings protocol, everything the OpenAI adapter does applies unchanged: streaming deltas + consolidated tool calls, `response_format: json_schema` structured output (override per model with `responseFormat`), `reasoning_effort` for reasoning models, multipart image input, and the neutral `Usage` breakdown (`input` / `output` / `cachedTokens` / `reasoningTokens`). See [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail — it is identical here.
58
+
59
+ **No image generation.** Mistral has no OpenAI-compatible image endpoint, so `MistralSDK` intentionally does **not** expose `image()` — the structural absence is the capability guard (`ai.mistral.image(...)` is a compile-time error).
60
+
61
+ ## Embeddings
62
+
63
+ ```ts
64
+ const embedder = mistral.embedder({ name: "mistral-embed" });
65
+
66
+ const { vector, dimensions, usage } = await embedder.embed("Hello world");
67
+ const { vectors } = await embedder.embedMany(["doc 1", "doc 2"]);
68
+ ```
69
+
70
+ `mistral-embed` is reachable through the OpenAI-compatible `/v1/embeddings`; the embedder delegates to the wrapped OpenAI embedder.
71
+
72
+ ## Pricing — per-model registry
73
+
74
+ The adapter ships a conservative default registry (`MISTRAL_DEFAULT_PRICING`, USD per 1,000,000 tokens) so cost truth works out of the box. Pass your own `pricing` to win per model id:
75
+
76
+ ```ts
77
+ const mistral = new MistralSDK({
78
+ apiKey,
79
+ pricing: {
80
+ // USD per 1M tokens — billing-grade overrides.
81
+ "mistral-large-latest": { input: 2, output: 6 },
82
+ "magistral-medium-latest": { input: 2, output: 5 },
83
+ },
84
+ });
85
+ ```
86
+
87
+ Resolution at `model()` time: per-model `pricing` (`mistral.model({ name, pricing })`) > SDK-level `pricing` > `MISTRAL_DEFAULT_PRICING` > `undefined`. The defaults are list-price approximations — pass explicit rates for billing.
88
+
89
+ ## Errors
90
+
91
+ Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the wrapped OpenAI adapter (dispatch keys on `APIError.status + code`) — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
92
+
93
+ ## When NOT to use this skill
94
+
95
+ - Image generation — Mistral has no OpenAI-compatible image endpoint; `mistral.image()` does not exist.
96
+ - Other providers — OpenAI `@warlock.js/ai-openai`, Gemini `@warlock.js/ai-google`, Anthropic `@warlock.js/ai-anthropic`, Bedrock `@warlock.js/ai-bedrock`, Ollama `@warlock.js/ai-ollama`.
97
+ - Raw `@mistralai/mistralai` SDK or Vercel `@ai-sdk/mistral` without going through `@warlock.js/ai` agents.
98
+
99
+ ## See also
100
+
101
+ - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; identical wire behavior.
102
+ - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
103
+ - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.
104
104
 
105
105
 
package/llms.txt CHANGED
@@ -6,4 +6,4 @@
6
6
 
7
7
  ## Skills
8
8
 
9
- - [setup-mistral](@warlock.js/ai-mistral/setup-mistral/SKILL.md): @warlock.js/ai-mistral in @warlock.js/ai-mistral; use when you need to set up mistral.
9
+ - [setup-mistral](@warlock.js/ai-mistral/setup-mistral/SKILL.md): (no description)
package/package.json CHANGED
@@ -15,13 +15,13 @@
15
15
  "url": "https://github.com/warlockjs/ai-mistral"
16
16
  },
17
17
  "dependencies": {
18
- "@warlock.js/ai-openai": "5.19.1",
19
- "@warlock.js/logger": "5.19.1"
18
+ "@warlock.js/ai-openai": "5.21.0",
19
+ "@warlock.js/logger": "5.21.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@warlock.js/ai": "5.19.1"
22
+ "@warlock.js/ai": "5.21.0"
23
23
  },
24
- "version": "5.19.1",
24
+ "version": "5.21.0",
25
25
  "main": "./cjs/index.cjs",
26
26
  "module": "./esm/index.mjs",
27
27
  "types": "./esm/index.d.mts",
@@ -1,95 +1,95 @@
1
- ---
2
- name: setup-mistral
3
- description: "@warlock.js/ai-mistral in @warlock.js/ai-mistral; use when you need to set up mistral."
4
- ---
5
-
6
- # `@warlock.js/ai-mistral`
7
-
8
- Provider adapter for Mistral AI. Mistral exposes an **OpenAI-compatible** API, so `MistralSDK` is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — it does not re-implement the wire protocol, streaming, tool calls, structured output, error wrapping, or token accounting. It builds one internal `OpenAISDK` pointed at Mistral's `baseURL` with `provider: "mistral"`, then layers on this provider's own capability inference + default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
9
-
10
- ## Construction
11
-
12
- ```ts
13
- import { MistralSDK } from "@warlock.js/ai-mistral";
14
-
15
- const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
16
- ```
17
-
18
- `baseURL` defaults to `https://api.mistral.ai/v1` (the OpenAI-compatible endpoint serving `/chat/completions` and `/embeddings`). `provider` defaults to `"mistral"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs. Override `baseURL` only to reach a Mistral-compatible gateway/proxy. Every other upstream OpenAI `ClientOptions` value (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim.
19
-
20
- ## Producing a model
21
-
22
- ```ts
23
- mistral.model({ name: "mistral-large-latest" }) // multimodal flagship
24
- mistral.model({ name: "magistral-medium-latest" }) // reasoning
25
- mistral.model({ name: "pixtral-large-latest" }) // vision
26
- mistral.model({ name: "some-fine-tune", vision: true }) // explicit capability override
27
- ```
28
-
29
- Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
30
-
31
- ## Capabilities — what's auto-set
32
-
33
- The wrapper injects **Mistral-aware** inference before delegating to the OpenAI adapter (the OpenAI prefix lists never match Mistral names):
34
-
35
- | Flag | Default |
36
- | --- | --- |
37
- | `vision` | Inferred from the model name. `true` for the `pixtral` family and the recent multimodal generations (`mistral-large`, `mistral-medium`, `ministral-3`); `false` otherwise. |
38
- | `reasoning` | Inferred from the model name. `true` for the `magistral` family and the hybrid `mistral-small` generation; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
39
- | `structuredOutput` | `true`, unless `responseFormat` is forced to `"json_object"` / `"text"` (loose modes). |
40
- | `promptCaching` | `true` (inherited from the OpenAI adapter — read-side `cachedTokens` accounting). |
41
- | `pdf` / `audio` | `false` by default (opt-in `.model({ pdf: true })` / `{ audio: true }`). |
42
-
43
- **Override any flag explicitly** via `.model({ name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio? })` — an explicit value always wins over inference. The known-family fragments live in `known-models.ts` (`inferVisionCapability`, `inferReasoningCapability`).
44
-
45
- The headline `-latest` aliases are exported as `MISTRAL_MODELS` ({ chat, vision, reasoning, embedding }) for convenience — `mistral.model()` also accepts any version-pinned id (`mistral-large-2512`, `magistral-medium-2509`).
46
-
47
- ## Uses the OpenAI-compatible endpoint
48
-
49
- Because Mistral speaks the OpenAI Chat Completions + Embeddings protocol, everything the OpenAI adapter does applies unchanged: streaming deltas + consolidated tool calls, `response_format: json_schema` structured output (override per model with `responseFormat`), `reasoning_effort` for reasoning models, multipart image input, and the neutral `Usage` breakdown (`input` / `output` / `cachedTokens` / `reasoningTokens`). See [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail — it is identical here.
50
-
51
- **No image generation.** Mistral has no OpenAI-compatible image endpoint, so `MistralSDK` intentionally does **not** expose `image()` — the structural absence is the capability guard (`ai.mistral.image(...)` is a compile-time error).
52
-
53
- ## Embeddings
54
-
55
- ```ts
56
- const embedder = mistral.embedder({ name: "mistral-embed" });
57
-
58
- const { vector, dimensions, usage } = await embedder.embed("Hello world");
59
- const { vectors } = await embedder.embedMany(["doc 1", "doc 2"]);
60
- ```
61
-
62
- `mistral-embed` is reachable through the OpenAI-compatible `/v1/embeddings`; the embedder delegates to the wrapped OpenAI embedder.
63
-
64
- ## Pricing — per-model registry
65
-
66
- The adapter ships a conservative default registry (`MISTRAL_DEFAULT_PRICING`, USD per 1,000,000 tokens) so cost truth works out of the box. Pass your own `pricing` to win per model id:
67
-
68
- ```ts
69
- const mistral = new MistralSDK({
70
- apiKey,
71
- pricing: {
72
- // USD per 1M tokens — billing-grade overrides.
73
- "mistral-large-latest": { input: 2, output: 6 },
74
- "magistral-medium-latest": { input: 2, output: 5 },
75
- },
76
- });
77
- ```
78
-
79
- Resolution at `model()` time: per-model `pricing` (`mistral.model({ name, pricing })`) > SDK-level `pricing` > `MISTRAL_DEFAULT_PRICING` > `undefined`. The defaults are list-price approximations — pass explicit rates for billing.
80
-
81
- ## Errors
82
-
83
- Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the wrapped OpenAI adapter (dispatch keys on `APIError.status + code`) — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
84
-
85
- ## When NOT to use this skill
86
-
87
- - Image generation — Mistral has no OpenAI-compatible image endpoint; `mistral.image()` does not exist.
88
- - Other providers — OpenAI `@warlock.js/ai-openai`, Gemini `@warlock.js/ai-google`, Anthropic `@warlock.js/ai-anthropic`, Bedrock `@warlock.js/ai-bedrock`, Ollama `@warlock.js/ai-ollama`.
89
- - Raw `@mistralai/mistralai` SDK or Vercel `@ai-sdk/mistral` without going through `@warlock.js/ai` agents.
90
-
91
- ## See also
92
-
93
- - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; identical wire behavior.
94
- - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
95
- - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.
1
+ ---
2
+ name: setup-mistral
3
+ description: 'Wire @warlock.js/ai-mistral — new MistralSDK({apiKey, baseURL?, provider?, pricing?}) for Mistral AI, a thin wrapper over the OpenAI adapter that uses Mistral''s OpenAI-compatible endpoint (https://api.mistral.ai/v1). .model({name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio?}) for a ModelContract with Mistral-aware capabilities (vision auto-inferred for the pixtral family, reasoning for the magistral family + hybrid mistral-small), .embedder({name, dimensions?}) for mistral-embed via /v1/embeddings. Triggers: `MistralSDK`, `mistral.model`, `mistral.embedder`, `pixtral`, `magistral`, `mistral-large`, `mistral-small`, `mistral-medium`, `ministral`, `mistral-embed`, `api.mistral.ai`, OpenAI-compatible Mistral, `reasoning_effort`, `responseFormat`, `pricing`; "use mistral", "wire mistral into a warlock agent", "configure mistral-large", "use magistral reasoning", "pixtral vision", "mistral embeddings with warlock". Skip: image generation (Mistral has no OpenAI-compatible image endpoint — `mistral.image()` does not exist); the wrapped adapter internals `@warlock.js/ai-openai`; agent wiring `@warlock.js/ai/run-ai-agent/SKILL.md`; embedder usage `@warlock.js/ai/embed-text/SKILL.md`; provider picking `@warlock.js/ai/pick-ai-provider/SKILL.md`; siblings `@warlock.js/ai-google`, `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-ollama`; raw `@mistralai/mistralai`, Vercel `@ai-sdk/mistral`.'
4
+ ---
5
+
6
+ # `@warlock.js/ai-mistral`
7
+
8
+ Provider adapter for Mistral AI. Mistral exposes an **OpenAI-compatible** API, so `MistralSDK` is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — it does not re-implement the wire protocol, streaming, tool calls, structured output, error wrapping, or token accounting. It builds one internal `OpenAISDK` pointed at Mistral's `baseURL` with `provider: "mistral"`, then layers on this provider's own capability inference + default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
9
+
10
+ ## Construction
11
+
12
+ ```ts
13
+ import { MistralSDK } from "@warlock.js/ai-mistral";
14
+
15
+ const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
16
+ ```
17
+
18
+ `baseURL` defaults to `https://api.mistral.ai/v1` (the OpenAI-compatible endpoint serving `/chat/completions` and `/embeddings`). `provider` defaults to `"mistral"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs. Override `baseURL` only to reach a Mistral-compatible gateway/proxy. Every other upstream OpenAI `ClientOptions` value (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim.
19
+
20
+ ## Producing a model
21
+
22
+ ```ts
23
+ mistral.model({ name: "mistral-large-latest" }) // multimodal flagship
24
+ mistral.model({ name: "magistral-medium-latest" }) // reasoning
25
+ mistral.model({ name: "pixtral-large-latest" }) // vision
26
+ mistral.model({ name: "some-fine-tune", vision: true }) // explicit capability override
27
+ ```
28
+
29
+ Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
30
+
31
+ ## Capabilities — what's auto-set
32
+
33
+ The wrapper injects **Mistral-aware** inference before delegating to the OpenAI adapter (the OpenAI prefix lists never match Mistral names):
34
+
35
+ | Flag | Default |
36
+ | --- | --- |
37
+ | `vision` | Inferred from the model name. `true` for the `pixtral` family and the recent multimodal generations (`mistral-large`, `mistral-medium`, `ministral-3`); `false` otherwise. |
38
+ | `reasoning` | Inferred from the model name. `true` for the `magistral` family and the hybrid `mistral-small` generation; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
39
+ | `structuredOutput` | `true`, unless `responseFormat` is forced to `"json_object"` / `"text"` (loose modes). |
40
+ | `promptCaching` | `true` (inherited from the OpenAI adapter — read-side `cachedTokens` accounting). |
41
+ | `pdf` / `audio` | `false` by default (opt-in `.model({ pdf: true })` / `{ audio: true }`). |
42
+
43
+ **Override any flag explicitly** via `.model({ name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio? })` — an explicit value always wins over inference. The known-family fragments live in `known-models.ts` (`inferVisionCapability`, `inferReasoningCapability`).
44
+
45
+ The headline `-latest` aliases are exported as `MISTRAL_MODELS` ({ chat, vision, reasoning, embedding }) for convenience — `mistral.model()` also accepts any version-pinned id (`mistral-large-2512`, `magistral-medium-2509`).
46
+
47
+ ## Uses the OpenAI-compatible endpoint
48
+
49
+ Because Mistral speaks the OpenAI Chat Completions + Embeddings protocol, everything the OpenAI adapter does applies unchanged: streaming deltas + consolidated tool calls, `response_format: json_schema` structured output (override per model with `responseFormat`), `reasoning_effort` for reasoning models, multipart image input, and the neutral `Usage` breakdown (`input` / `output` / `cachedTokens` / `reasoningTokens`). See [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail — it is identical here.
50
+
51
+ **No image generation.** Mistral has no OpenAI-compatible image endpoint, so `MistralSDK` intentionally does **not** expose `image()` — the structural absence is the capability guard (`ai.mistral.image(...)` is a compile-time error).
52
+
53
+ ## Embeddings
54
+
55
+ ```ts
56
+ const embedder = mistral.embedder({ name: "mistral-embed" });
57
+
58
+ const { vector, dimensions, usage } = await embedder.embed("Hello world");
59
+ const { vectors } = await embedder.embedMany(["doc 1", "doc 2"]);
60
+ ```
61
+
62
+ `mistral-embed` is reachable through the OpenAI-compatible `/v1/embeddings`; the embedder delegates to the wrapped OpenAI embedder.
63
+
64
+ ## Pricing — per-model registry
65
+
66
+ The adapter ships a conservative default registry (`MISTRAL_DEFAULT_PRICING`, USD per 1,000,000 tokens) so cost truth works out of the box. Pass your own `pricing` to win per model id:
67
+
68
+ ```ts
69
+ const mistral = new MistralSDK({
70
+ apiKey,
71
+ pricing: {
72
+ // USD per 1M tokens — billing-grade overrides.
73
+ "mistral-large-latest": { input: 2, output: 6 },
74
+ "magistral-medium-latest": { input: 2, output: 5 },
75
+ },
76
+ });
77
+ ```
78
+
79
+ Resolution at `model()` time: per-model `pricing` (`mistral.model({ name, pricing })`) > SDK-level `pricing` > `MISTRAL_DEFAULT_PRICING` > `undefined`. The defaults are list-price approximations — pass explicit rates for billing.
80
+
81
+ ## Errors
82
+
83
+ Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the wrapped OpenAI adapter (dispatch keys on `APIError.status + code`) — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
84
+
85
+ ## When NOT to use this skill
86
+
87
+ - Image generation — Mistral has no OpenAI-compatible image endpoint; `mistral.image()` does not exist.
88
+ - Other providers — OpenAI `@warlock.js/ai-openai`, Gemini `@warlock.js/ai-google`, Anthropic `@warlock.js/ai-anthropic`, Bedrock `@warlock.js/ai-bedrock`, Ollama `@warlock.js/ai-ollama`.
89
+ - Raw `@mistralai/mistralai` SDK or Vercel `@ai-sdk/mistral` without going through `@warlock.js/ai` agents.
90
+
91
+ ## See also
92
+
93
+ - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; identical wire behavior.
94
+ - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
95
+ - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.