Skip to main content

Mistral AI Provider Plugin

The Mistral plugin connects Ever Works to Mistral AI's API, providing access to high-performance language models optimized for efficiency, speed, and multilingual tasks. It extends BaseAiProvider and uses the shared AiOperations layer that wraps LangChain under the hood.

Source: packages/plugins/mistral/src/mistral.plugin.ts

Overview

PropertyValue
Plugin IDmistral
Package@ever-works/mistral-plugin
Categoryai-provider
Capabilitiesai-provider
Version1.0.0
Configuration Modeuser-required
Provider Typemistral
Auto-enableNo
Built-inYes
Visibilitypublic

The plugin extends BaseAiProvider from @ever-works/plugin/abstract and creates an AiOperations instance configured with providerType: 'mistral' to handle all AI operations through the unified LangChain-based abstraction.

Architecture

Mistral's API is OpenAI-compatible, so the plugin uses the same LangChain OpenAI provider with a custom baseURL pointing to https://api.mistral.ai/v1.

Configuration

Settings Schema

SettingTypeRequiredDefaultScopeWidgetDescription
apiKeystringYes--user--Mistral API key. Secret. Env: PLUGIN_MISTRAL_API_KEY
defaultModelstringYesmistral-small-latestglobalmodel-selectDefault model for all AI tasks. Env: PLUGIN_MISTRAL_DEFAULT_MODEL
simpleModelstringNomistral-small-latestglobalmodel-selectModel for tags, descriptions, classifications.
mediumModelstringNomistral-medium-latestglobalmodel-selectModel for listings, summaries, reformatting.
complexModelstringNomistral-large-latestglobalmodel-selectModel for full page generation, multi-step analysis.
temperaturenumberNo0.7----Sampling temperature (0--2). Hidden.
maxTokensnumberNo4096----Max tokens per response. Hidden.
baseUrlstringNohttps://api.mistral.ai/v1----API endpoint. Hidden. Env: PLUGIN_MISTRAL_BASE_URL

Model Tiers

The plugin supports a tiered model system that maps task complexity to appropriate models:

TierDefault ModelUse Cases
Simplemistral-small-latestTags, short descriptions, quick classifications
Standardmistral-medium-latestListings, summaries, content reformatting
Complexmistral-large-latestFull page generation, multi-step analysis

Environment Variables

VariableDescription
PLUGIN_MISTRAL_API_KEYMistral API key (overrides UI setting)
PLUGIN_MISTRAL_DEFAULT_MODELDefault model ID
PLUGIN_MISTRAL_SIMPLE_MODELSimple tier model ID
PLUGIN_MISTRAL_MEDIUM_MODELMedium tier model ID
PLUGIN_MISTRAL_COMPLEX_MODELComplex tier model ID
PLUGIN_MISTRAL_BASE_URLCustom API endpoint

Capabilities

The getCapabilities() method reports the following:

CapabilitySupported
Structured OutputYes
StreamingYes
Tool CallingYes
VisionYes
Max Context Length128,000 tokens

Supported Operations

// Chat completion
const response = await mistralPlugin.createChatCompletion({
messages: [{ role: 'user', content: 'Describe this restaurant' }],
settings: { apiKey: 'your-key' }
});

// Streaming chat completion
for await (const chunk of mistralPlugin.createStreamingChatCompletion({
messages: [{ role: 'user', content: 'Write a description' }],
settings: { apiKey: 'your-key' }
})) {
process.stdout.write(chunk.content ?? '');
}

// Embeddings
const embedding = await mistralPlugin.createEmbedding({
input: 'semantic search text'
});

// Structured JSON output
const result = await mistralPlugin.askJson('Generate categories', {
settings: { apiKey: 'your-key' }
});

// List available models
const models = await mistralPlugin.listModels({
apiKey: 'your-key'
});

Configuration Mode

The Mistral plugin uses user-required configuration mode, meaning each user must provide their own API key. There is no admin-level shared key option.

Settings Resolution

When an AI operation is called, settings are resolved using the resolveConfig method:

protected override resolveConfig(settings?: PluginSettings): Partial<AiOperationsConfig> {
const s = settings ?? {};
const config: Partial<AiOperationsConfig> = {};

if (s.apiKey && typeof s.apiKey === 'string') {
config.apiKey = s.apiKey;
}
if (s.baseUrl && typeof s.baseUrl === 'string') {
config.baseURL = s.baseUrl;
}
if (typeof s.temperature === 'number') {
config.temperature = s.temperature;
}
if (typeof s.maxTokens === 'number') {
config.maxTokens = s.maxTokens;
}
return config;
}

The resolved config is passed to AiOperations as overrides, taking precedence over the defaults set during onLoad.

Lifecycle

Health Check

The plugin reports a simple health check that always returns healthy when the plugin class is instantiated:

async healthCheck(): Promise<PluginHealthCheck> {
return {
status: 'healthy',
message: 'Mistral plugin is ready',
checkedAt: Date.now()
};
}

To verify actual API connectivity, use isAvailable() with a valid API key, which calls testConnection() against the Mistral API.

Dependencies

PackageVersionPurpose
@ever-works/pluginworkspacePlugin contracts and base classes
@langchain/openai^0.6.17LangChain OpenAI-compatible provider
@langchain/core^0.3.80LangChain core abstractions

Getting Started

  1. Create an account at console.mistral.ai
  2. Generate an API key from the Mistral console
  3. Enable the Mistral plugin in the Ever Works plugin settings
  4. Enter the API key in the Mistral API Key field
  5. Select preferred models for each task complexity level