Mistral
Use Mistral Large, Small, and the Codestral family through the official @mistralai/mistralai SDK.
Install
npm install supercompat openai @mistralai/mistralai
Minimal setup
import { Mistral } from '@mistralai/mistralai'
import {
supercompat,
mistralClientAdapter,
completionsRunAdapter,
memoryStorageAdapter,
} from 'supercompat/openai'
const client = supercompat({
clientAdapter: mistralClientAdapter({
mistral: new Mistral({ apiKey: process.env.MISTRAL_API_KEY }),
}),
storageAdapter: memoryStorageAdapter(),
runAdapter: completionsRunAdapter(),
})
const response = await client.responses.create({
model: 'mistral-large-latest',
input: 'Summarize Mistral AI in one sentence.',
})
Tool use
await client.responses.create({
model: 'mistral-large-latest',
input: 'What is the weather in Nice?',
tools: [
{
type: 'function',
name: 'get_weather',
parameters: {
type: 'object',
properties: { city: { type: 'string' } },
required: ['city'],
},
},
],
})
Models
Some current examples: