mistralClientAdapter

Points the OpenAI SDK at Mistral.

Signature

mistralClientAdapter({ mistral: Mistral, })

Install

npm install supercompat openai @mistralai/mistralai

Example

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: 'Why is Mistral known for efficiency?', })

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'], }, }, ], })

Compatible run adapters