feat: add Mistral as first-class provider - #42357
Conversation
213704c to
5ae7116
Compare
|
I would also like to see this feature added. Thanks @DevAgarwal2! @teknium1 @OutThisLife @kshitijk4poor. |
|
This is great! |
|
When can we expect the merge? |
|
Update: another PR, #50289, has been opened for the same goal: adding Mistral as a first-class provider. After comparing both approaches, I think #50289 is probably the better base now because it follows the current I’ve left a comment on #50289 with a few non-blocking points from this PR that may still be worth considering before merge. Unless maintainers prefer this implementation, I’m happy to treat this PR as superseded by #50289. |
|
Thanks for the Mistral-provider work. The first-class provider feature is still absent on current main, but this branch needs a targeted salvage rather than a direct cherry-pick. Problems
Suggested changes
Automated hermes-sweeper review. |
5ae7116 to
3babc7d
Compare
|
@teknium1 Thanks for the guidance. I’ve refreshed this PR to address the review feedback and align it with the current provider-plugin architecture. The updated version now:
I also re-ran the targeted test suites and additional live config-driven smoke tests against the Mistral API. At this point I’m mainly waiting for the GitHub checks to run, but I’m happy to make any further adjustments if needed. |
|
I'm waiting for this 👀 I've been struggling configuring Mistral Small... |
3babc7d to
1f6737c
Compare
|
Updated this PR against the latest The patch still applies cleanly. I also fixed one new merge-result issue from the latest Validated locally: Alias checks: |
|
Just a heads-up for anyone following this: I attempted an in-tree PR (#76391), but per the maintainers' in-tree-provider-integration policy (AGENTS.md), third-party LLM provider integrations ship as standalone plugin repositories, not bundled plugins. So the only supported route is a standalone plugin. It is now published and installable in one command: hermes plugins install merouaneagar/hermes-mistral-provider Production-grade profile for api.mistral.ai: reasoning gating per model family (handles the medium->high rejection and the stream-crash on high), vision support, live model catalog, never emits extra_body.think. 12 unit tests, validated E2E on 34 chat models. Docs, quirks and license in the README. |
1f6737c to
9c436b8
Compare
|
Rebased again on current The conflict came from the recent config/env-var refactor, so I kept the new Validated locally: I understand the standalone-provider policy, but I still think Mistral is a reasonable first-class exception: broad general-purpose LLM provider, strong user demand in #20859, existing Mistral surface in Hermes, and low maintenance footprint through ProviderProfile-only wiring. If maintainers confirm standalone-only is final for Mistral too, I’ll stop refreshing this PR; until then I’m keeping this implementation mergeable as the current consolidated in-tree path. |
9c436b8 to
9cf311f
Compare
|
Rebased again on current The patch still applies cleanly on the latest provider/config routing, and I kept this as a single ProviderProfile-style wiring commit. Validated locally: The PR is mergeable again ( |
9cf311f to
dcf63be
Compare
|
Rebased again on current The patch still applies cleanly. Validated locally: PR is mergeable again ( |
|
Wired Hermes to Mistral locally and independently landed on the same profile shape as this PR, it works well. One addition worth considering: Mistral bills cached input at 10% of the standard input rate, but unlike DeepSeek and OpenAI it does not cache implicitly, the top-level End-to-end through Hermes, one 4-turn session with the flag enabled on the profile: That is 50% of the session's prompt tokens served from cache, with one call showing 31,072/31,096 (99.9%). Hermes re-sends a ~21k-token system+tools prefix every turn, so on a long session this is roughly a 2x difference on the bill. The flag is opt-in upstream because many OpenAI-compatible endpoints reject unknown top-level fields rather than ignoring them. Mistral accepts it (HTTP 200, no 400), so opting in looks safe here. The existing Caveat from the same measurements: hits are not guaranteed even on an identical prefix (2 of 3 in the direct test, roughly 2 of 3 eligible turns live), which matches Mistral's documentation. A solid win, not a free lunch. Happy to open a follow-up PR with the one-liner plus a test if that is easier than folding it in here. |
dcf63be to
06b0131
Compare
|
Thanks @LeBaronDeCharlus, folded this in. The Mistral profile now sets I also rebased the PR on the latest Validated locally: Transport check: |
Fixes #20859
Summary
This PR adds Mistral AI as a first-class LLM provider using the current Hermes
ProviderProfile/plugins/model-providersarchitecture.It keeps the integration small and aligned with the existing API-key provider path: no provider-specific transport, no
mistralaiSDK dependency, and no custom reasoning replay logic.The bundled provider exposes:
mistralmistral-ai,mistralaihttps://api.mistral.ai/v1MISTRAL_API_KEYMISTRAL_BASE_URLmistral-small-latestsupports_prompt_cache_key=True, so Hermes can use its existing prompt-cache-key gate for Mistral long-session cachingNotes
This version incorporates feedback received during review and discussion:
plugins/model-providersarchitecture;hermes_cli/auth.pyorhermes_cli/main.py;reasoning_contenthandling becausemainnow performs this cleanup generically for strict OpenAI-compatible providers;prompt_cache_keytransport gate viasupports_prompt_cache_key=True.The prompt-cache-key flag is provider-scoped and opt-in. It does not change behavior for other OpenAI-compatible providers.
Validation
Current branch is rebased on
mainat7cd91114.Targeted provider and transport tests:
Provider validation, fallback, and runtime tests:
Additional checks:
Live smoke tests with
MISTRAL_API_KEYfrom the local environment and the default endpoint:Prompt-cache-key transport check: