Mistral Provider
Updated 22 days ago • September 11, 2026
@kortyx/mistral is the Mistral provider package for Kortyx.
It gives you two entry points:
mistral: a batteries-included default provider selectorcreateMistral(...): an explicit factory for custom setup
1. Install the package
2. What the package exports
What each export is for:
mistral: default provider selector for the fastest startcreateMistral(...): custom provider instance with explicit settingsMODELS: built-in Mistral model ids exposed by the packagePROVIDER_ID: the provider id string, currently"mistral"
3. Basic usage in the same file
mistral is a provider selector, which means:
- it is callable:
mistral("mistral-large-latest") - it also exposes provider metadata:
mistral.id,mistral.models
Good to know: The built-in model list gives autocomplete, but arbitrary Mistral model ids are accepted as strings.
4. Shared app bootstrap usage
If you want one shared import path across your app, re-export mistral from a bootstrap file such as src/lib/providers.ts.
Then import it from that file where you actually use it:
5. Advanced usage with explicit settings
Use createMistral(...) when you want app-owned configuration instead of the default environment-based setup.
Use the factory when you need to:
- pass
apiKeyexplicitly - use a custom
baseUrl - provide a custom
fetch
6. Credentials and first-use behavior
The default mistral export resolves credentials on first use, not at import time.
Supported environment variables:
MISTRAL_API_KEYKORTYX_MISTRAL_API_KEY
If neither variable is set and you did not pass apiKey to createMistral(...), the provider throws a configuration error the first time a Mistral model is actually used.
7. Create model refs for workflow and node params
You can also attach default model options to the ref itself:
Those become default options for later useReason(...) calls unless you override them at call time.
8. Use the model with useReason(...)
Good to know: Provider setup is not done on
createAgent(...). Model selection happens where you calluseReason(...)by passing a model ref.
9. Supported normalized call options
Mistral currently maps these generic Kortyx options:
temperaturestreamingmaxOutputTokensabortSignalreasoning.effortreasoning.maxTokensreasoning.includeThoughtsresponseFormat.typeresponseFormat.schema
Current Mistral provider options:
providerOptions.mistral.safePromptproviderOptions.mistral.structuredOutputsproviderOptions.mistral.strictJsonSchemaproviderOptions.mistral.reasoningEffortproviderOptions.mistral.topPproviderOptions.mistral.randomSeed
Current mapping details:
responseFormat.type: "json"maps to Mistral JSON moderesponseFormat.schemamaps to Mistral JSON schema output unlessstructuredOutputsisfalsesafePromptmaps to Mistralsafe_promptreasoningEffortmaps for compatible Mistral Small and Medium models, includingmistral-medium-3-5
Current warning-backed gaps:
stopSequencesis currently reported as unsupported and not sent- reasoning options on unsupported models are reported in
result.warnings - unknown
providerOptionskeys are ignored and reported inresult.warnings
10. Normalized metadata you get back
Mistral returns the normalized Kortyx result fields when the API provides them:
usagefinishReasonproviderMetadatawarningsraw
Mistral-specific metadata currently includes fields such as:
providerIdmodelIdresponseIdresponseModelcreatedusage
Use providerMetadata when you need debugging or observability details without coupling your app code to the raw provider payload shape.
Supported scope
@kortyx/mistral currently supports text generation through Mistral chat completions via useReason(...), including streaming and non-streaming invocation.
It does not currently expose Mistral embeddings, OCR/document APIs, file APIs, or provider-hosted tools. Check result.warnings when you rely on advanced generic options and want to verify how Mistral handled them.
Available built-in Mistral model ids
ministral-3b-latestministral-8b-latestministral-14b-latestmistral-large-latestmistral-medium-latestmistral-large-2512mistral-medium-2508mistral-medium-2505mistral-small-2506mistral-small-latestmistral-small-2603magistral-medium-latestmagistral-small-latestmagistral-medium-2509magistral-small-2509pixtral-large-latest
Next steps
- See Hooks for
useReason(...)behavior and structured output - See Provider API for the shared normalized provider contract
Reasoning and function tools
useReason preserves native thinking chunks privately across tool rounds and approval resumes. Configurable reasoning supports current Mistral Small and Medium aliases, including mistral-medium-3-5. effort: "none" disables reasoning; positive generic efforts map to the API's high mode, with a warning when the requested level differs. Use providerOptions.mistral.reasoningEffort for the native none/high control.
Compatible output schemas continue to use native structured output. Streamed function arguments are assembled before execution, with final usage and finish reason preserved.