Mistral AI
Integrate Mistral AI models into Delphi, C++ Builder and .NET applications. Chat completions, vision, streaming and embeddings over the Mistral REST API.
Integrate Mistral AI models into Delphi, C++ Builder and .NET applications. Chat completions, vision, streaming and embeddings over the Mistral REST API.
Mistral REST API client for chat completions, vision, streaming, embeddings and model listing.
TsgcHTTP_API_Mistral
Mistral REST API over HTTPS
Windows, macOS, Linux, iOS, Android
Enterprise (AI add-on)
Set the API key in MistralOptions, then call typed helper methods such as _CreateMessage, or build a TsgcMistralClass_Request_ChatCompletion and call CreateMessage.
uses
sgcHTTP_API_Mistral;
var
Mistral: TsgcHTTP_API_Mistral;
begin
Mistral := TsgcHTTP_API_Mistral.Create(nil);
Mistral.MistralOptions.ApiKey := 'YOUR_API_KEY';
// Simple one-shot message
Memo1.Lines.Text := Mistral._CreateMessage(
'mistral-large-latest',
'What are the benefits of WebSockets?',
4096);
// Streaming — handle OnHTTPAPISSE per delta
Mistral.OnHTTPAPISSE := HandleSSE;
Mistral._CreateMessageStream(
'mistral-large-latest',
'Summarise RFC 6455');
end;
procedure TForm1.HandleSSE(Sender: TObject;
const aEvent, aData: string;
var Cancel: Boolean);
begin
Memo1.Lines.Add(aEvent + ': ' + aData);
end;
// uses: sgcHTTP_API_Mistral
TsgcHTTP_API_Mistral *Mistral = new TsgcHTTP_API_Mistral(this);
Mistral->MistralOptions->ApiKey = "YOUR_API_KEY";
// Simple one-shot message
Memo1->Lines->Text = Mistral->_CreateMessage(
"mistral-large-latest",
"What are the benefits of WebSockets?",
4096);
// Streaming — OnHTTPAPISSE fires per delta
Mistral->OnHTTPAPISSE = HandleSSE;
Mistral->_CreateMessageStream(
"mistral-large-latest",
"Summarise RFC 6455");
using esegece.sgcWebSockets;
var mistral = new TsgcHTTPAPI_Mistral();
mistral.MistralOptions.ApiKey = "YOUR_API_KEY";
// Simple one-shot message
Console.WriteLine(mistral._CreateMessage(
"mistral-large-latest",
"What are the benefits of WebSockets?",
4096));
// Streaming via Server-Sent Events
mistral.OnHTTPAPISSE += (sender, ev, data, cancel) => Console.Write(data);
mistral._CreateMessageStream(
"mistral-large-latest",
"Summarise RFC 6455");
Typed request / response classes for chat completions and embeddings, plus JSON-string shortcuts, vision, streaming and reliability controls.
CreateMessage sends a typed TsgcMistralClass_Request_ChatCompletion and returns a parsed response. _CreateMessage, _CreateMessageWithSystem and _CreateMessageStream are JSON-string shortcuts, and _CreateMessageJSON enables JSON mode for valid JSON output.
_CreateVisionMessage sends a base64-encoded image with a text prompt. The media type accepts image/jpeg, image/png, image/gif and image/webp so the model can understand the picture.
_GetModels lists all available Mistral models, so you can discover and select the right model at runtime instead of hard-coding identifiers.
_CreateEmbeddings returns a vector representation of the input text using a model such as mistral-embed, ready for semantic search, clustering and other machine learning tasks.
CircuitBreaker short-circuits requests when the API is unhealthy; ReadTimeout and TLSOptions tune the HTTPS layer; OnHTTPAPIException surfaces failures; OnHTTPAPISSE streams server-sent events.
Authoritative sources for the protocols this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Online Help — Mistral Full property, method and event reference for this component. | Open | |
| Demo Project — Demos\AI\Mistral Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |