Skip to content

feat: add Mistral as a first-class model provider - #618

Open
Xavier Pestel (xavierpestel-ai) wants to merge 3 commits into
langchain-ai:mainfrom
xavierpestel-ai:feat/mistral-provider
Open

feat: add Mistral as a first-class model provider#618
Xavier Pestel (xavierpestel-ai) wants to merge 3 commits into
langchain-ai:mainfrom
xavierpestel-ai:feat/mistral-provider

Conversation

@xavierpestel-ai

Copy link
Copy Markdown

What

Adds Mistral (https://api.mistral.ai/v1) as a first-class model provider in the onboarding wizard and provider registry, alongside the existing OpenAI-compatible providers (Fireworks, Baseten, Nebius, NVIDIA NIM).

Users can now pick Mistral during openwiki --init, paste a MISTRAL_API_KEY, and choose from preset models (Mistral Medium, Large, Small, Codestral, Ministral 8B/3B, Mistral Nemo) or paste any Mistral model ID.

Why

Mistral is one of the few major inference providers still reached through the generic openai-compatible path (which requires the user to know and type the base URL by hand). Promoting it to a first-class provider means:

  • One click in the wizard instead of openai-compatible + hand-typed https://api.mistral.ai/v1.
  • Preset model list (Mistral Medium/Large/Small, Codestral, Ministral 8B/3B, Mistral Nemo) with sensible default (mistral-medium-latest), following the same convention as Fireworks / Nebius / Baseten / NVIDIA NIM.
  • MISTRAL_API_KEY recognised by resolveConfiguredProvider so a bare key auto-selects the provider without needing OPENWIKI_PROVIDER=mistral.
  • MISTRAL_API_KEY added to the diagnostic redaction list so it can never leak into error output.
  • MISTRAL_BASE_URL follows the same override convention as FIREWORKS_BASE_URL / BASETEN_BASE_URL / NVIDIA_BASE_URL for self-hosted or proxied gateways.

The Mistral API is OpenAI-compatible, so this reuses the existing ChatOpenAI transport with a Mistral base URL. No new SDK dependency is introduced.

The README already invites this kind of contribution:

If there is an inference provider or model you would like to see added, please open a PR.

And CONTRIBUTING.md cites the exact analogue as the canonical example of a well-scoped PR:

✅ Good: "Add Fireworks to the model provider list" — the provider config, its model options, and the doc line for it.

How it was tested

  • pnpm run format — clean, all files unchanged.
  • pnpm run lint — clean.
  • pnpm test138 files / 2042 tests passing (baseline was 2039; +3 new tests exercise the Mistral provider).

New test coverage mirrors the patterns used for the other OpenAI-compatible providers:

  • test/config/constants.test.ts: isValidProvider("mistral"), resolveConfiguredProvider({ MISTRAL_API_KEY }), default and env-override base URLs, whitespace-only override falls back to default, getDefaultModelId("mistral").
  • test/config/env-behavior.test.ts: MISTRAL_BASE_URL surfaced verbatim in diagnostics (non-secret).
  • test/setup/credentials/steps.test.ts: mistral follows the standard provider → api-key → model → langsmith step flow.
  • test/agent/redaction.test.ts: MISTRAL_API_KEY values are redacted in diagnostic output.

Scope

One PR, one change: adds the Mistral provider. No unrelated refactors, no dependency changes, no other providers touched.

Changeset

.changeset/add-mistral-provider.mdminor bump, feat: add Mistral as a first-class model provider.

@changeset-bot

changeset-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 227dae9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openwiki Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Adds Mistral (https://api.mistral.ai/v1) as a selectable provider in the
onboarding wizard and provider registry, alongside the existing OpenAI-
compatible providers (Fireworks, Baseten, Nebius, NVIDIA NIM). Users can
now pick 'Mistral' during 'openwiki --init', paste a MISTRAL_API_KEY, and
choose from preset models (Mistral Medium, Large, Small, Codestral,
Ministral 8B/3B, Mistral Nemo) or paste any Mistral model ID.

The provider uses the shared ChatOpenAI transport with the Mistral base
URL, so no new SDK dependency is required. MISTRAL_BASE_URL follows the
same override convention as FIREWORKS_BASE_URL / BASETEN_BASE_URL /
NVIDIA_BASE_URL for self-hosted or proxied gateways, and MISTRAL_API_KEY
is added to the diagnostic redaction list so it can never leak into
error output.

- src/config/constants.ts: new env keys, provider type entry, selectable
  list entry, PROVIDER_CONFIGS entry with default model presets, and
  MISTRAL_API_KEY fallback in resolveConfiguredProvider.
- src/config/env.ts: MANAGED_ENV_KEYS + base URL diagnostic warnings.
- src/platform/diagnostics.ts: redact MISTRAL_API_KEY values.
- src/setup/credentials/steps.ts: getProviderArticle returns 'a' for
  'a Mistral ...'.
- README.md: new row in the provider table, bumped provider count, and
  MISTRAL_BASE_URL added to the alternative-base-URLs section.
- Tests: mistral cases in constants / env-behavior / steps / redaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant