Skip to content

Configuration ​

Client options ​

ts
const mistral = new MistralClient({
  apiKey: process.env.MISTRAL_API_KEY,
  serverURL: 'https://api.mistral.ai',
})
OptionPurpose
apiKeyRequired when client is not supplied.
serverURLOverrides the official SDK server URL.
clientReuses an initialized Mistral SDK client.

The option is spelled serverURL to match the official SDK, not baseUrl.

Inject the official client ​

ts
import { Mistral } from '@mistralai/mistralai'

const native = new Mistral({ apiKey })
const mistral = new MistralClient({ client: native })

Use injection when native Mistral APIs and Anvia model contracts should share credentials and transport settings.

Embeddings ​

ts
const embeddings = mistral.embeddingModel('mistral-embed', {
  dimensions: 1024,
  maxBatchSize: 16,
})

The current implementation forwards dimensions to Mistral and exposes it on the Anvia model as index metadata. Verify the returned dimension before creating a collection, and reindex when changing it.

Completion and OCR pass-through ​

Completion request additionalParams is merged without allowing it to replace the adapter’s model or messages. OCR additionalParams likewise cannot replace model or document; explicitly typed OCR options are applied afterward.

This ordering protects the selected model and normalized source while still allowing supported provider options.

Runtime ​

The package is ESM, includes declarations, uses the official Mistral SDK, and peers on @anvia/core >=0.7.1 <1.0.0. OCR byte uploads and server credentials make it a server-side integration.

Built for Anvia.