Mistral AI

Mistral AI is a French artificial intelligence company that develops efficient and powerful language models. Their models are known for strong performance across reasoning, coding, and multilingual tasks, while maintaining competitive efficiency.

The sgcWebSockets library provides a Delphi component TsgcHTTP_API_Mistral to interact with the Mistral AI API.

Mistral API

The Mistral API provides access to Mistral models for building AI-powered applications. The API supports text generation, vision (image understanding), streaming, embeddings, JSON mode, and model listing.

Features

Configuration

The Mistral API uses API keys for authentication. Visit your API Keys page in the Mistral Console to retrieve the API key you'll use in your requests.

Remember that your API key is a secret! Do not share it with others or expose it in any client-side code.

This API Key must be configured in the MistralOptions.ApiKey property of the component.


Mistral := TsgcHTTP_API_Mistral.Create(nil);
Mistral.MistralOptions.ApiKey := 'YOUR_API_KEY';

Messages

Send a structured list of input messages with text content, and the model will generate the next message in the conversation.

Vision

Mistral can understand images passed as base64-encoded content within messages.

Models

List the available Mistral models.

Embeddings

Get a vector representation of a given input that can be used for semantic search, clustering, and other machine learning tasks.