Skip to content

feat: add dedicated Mistral AI provider with model generator#332

Open
Djiit wants to merge 1 commit into
charmbracelet:mainfrom
Djiit:feat/mistral-provider
Open

feat: add dedicated Mistral AI provider with model generator#332
Djiit wants to merge 1 commit into
charmbracelet:mainfrom
Djiit:feat/mistral-provider

Conversation

@Djiit

@Djiit Djiit commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Fixes #14

  • Added Mistral AI provider with a generator script (cmd/mistral/main.go) that fetches models from the /v1/models API endpoint
  • Uses openai-compat type (Mistral's API is OpenAI-compatible)
  • Generates config with 11 curated models: Codestral, Devstral 2, Magistral Medium/Small (reasoning), Ministral 3B/8B/14B, Mistral Large 3, Medium 3.5, Small 4, and NeMo
  • Added InferenceProviderMistral constant, provider registration, and gen:mistral Taskfile entry

Context

Supersedes #118. Addresses the reviewer feedback from #118 (comment) — uses a generator that fetches from Mistral's /v1/models API rather than a hand-crafted JSON.

Key design decisions:

  • Allowlist approach: The Mistral API returns many aliases for the same model (e.g. mistral-small-2603, mistral-small-latest, magistral-small-latest are all the same model). The generator uses a curated wantedModels set of canonical -latest IDs to avoid duplicates.
  • Hardcoded pricing: The /v1/models endpoint doesn't expose pricing, so costs are maintained in a map (sourced from https://mistral.ai/pricing).
  • Reasoning support: Magistral models are marked with can_reason: true and reasoning levels.

Test plan

  • go build ./... passes
  • go vet ./... passes
  • go test ./... passes (37 tests across 22 packages)
  • go run cmd/mistral/main.go generates valid config with 11 models
  • Test with crush: go run . then CATWALK_URL=http://localhost:8080/ crush
image image

Template

  • I have read CONTRIBUTING.md.
  • I have created a discussion that was approved by a maintainer (for new features):

@Djiit Djiit force-pushed the feat/mistral-provider branch from e138a54 to 5bda43f Compare June 8, 2026 18:45
@Djiit Djiit marked this pull request as ready for review June 8, 2026 18:45
@Djiit Djiit requested a review from andreynering as a code owner June 8, 2026 18:46
@EwenQuim EwenQuim mentioned this pull request Jun 11, 2026
3 tasks
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.

Provider Request: Mistral and Codestral

1 participant