@mayurajs/provider-mistral
v1.2.0
Published
Mistral models for Mayura, through the official Mistral SDK.
Readme
@mayurajs/provider-mistral
Mistral models for Mayura, through the official @mistralai/mistralai SDK and the Chat Completions API.
npm install mayura @mayurajs/provider-mistralimport { createModels, defineAgent, z } from 'mayura';
import { mistral } from '@mayurajs/provider-mistral';
const models = createModels({
providers: [mistral({ apiKey: process.env.MISTRAL_API_KEY! })],
prices: { 'mistral/mistral-medium-3-5': { inputMicrosPerMillionTokens: 1_500_000, outputMicrosPerMillionTokens: 7_500_000 } },
maxCallCostMicros: 50_000,
});
const agent = defineAgent({
id: 'helper', version: '1', instructions: 'Answer in one sentence.', model: models.model('mistral/mistral-medium-3-5'), tools: [],
input: z.object({ question: z.string() }), output: z.object({ answer: z.string() }),
});
// Grant it as model:mistral/mistral-medium-3-5.- Credentials are options: nothing is read from the environment. Set
baseURL: 'https://api.eu.mistral.ai'to keep requests in the EU. - The SDK's own retries, debug logging and telemetry are off; the registry's
retryoption retries and charges every attempt. - Tool inputs and structured output use strict JSON Schema; streaming reports output text as it arrives; the model's thinking is kept for the next call and never released.
- A run's conversation history (
capabilities.history) goes first, as Mistral messages; a call id Mistral would refuse is renamed, never to one the conversation already has. - Models see PNG, JPEG, WebP and GIF images, as bytes or URLs.
catalogholds Mistral's list prices on its date for dated model versions, used only withprices: 'catalog'. A-latestalias moves to newer models, so give its price yourself.
See the model registry guide. Apache-2.0.
RAG embeddings
This provider exports mistralEmbeddings for scoped RAG ingestion and retrieval. See the RAG guide for explicit permissions, cost ceilings and sensitivity profiles. Development cases are authored; validation is deferred.
