Quick answer: sgcWebSockets ships a native component for every major LLM provider — TsgcHTTP_API_OpenAI, TsgcHTTP_API_Anthropic, TsgcHTTP_API_Gemini, plus Grok, Mistral, DeepSeek and the local-only TsgcHTTP_API_Ollama. They share the same drop-the-component, set-the-key, call-one-method pattern, so the decision below is low-stakes: pick the model that fits your use case today and switch providers later with a few lines of code.
If you are adding AI to a Delphi or C++ Builder application, the first question is usually "which provider?" OpenAI, Anthropic and Google all offer capable chat models behind an HTTP API. From Delphi the integration work is nearly identical regardless of which one you choose, because sgcWebSockets wraps each provider in a component with the same shape. That means the real choice is about the model's strengths, not about how much code you will have to write or rewrite.
The short answer, by use case
Use this as a starting point, then validate against your own prompts.
| If you want… | Start with | Component |
|---|---|---|
| The broadest ecosystem and built-in image generation, transcription and embeddings | OpenAI | TsgcHTTP_API_OpenAI |
| Careful long-form reasoning, large documents and tool use | Anthropic Claude | TsgcHTTP_API_Anthropic |
| Tight Google Cloud integration and multimodal input | Google Gemini | TsgcHTTP_API_Gemini |
| Fully local, offline, no API key, data never leaves the machine | Ollama (Llama, Mistral, …) | TsgcHTTP_API_Ollama |
| A low-cost alternative or a specific open model | DeepSeek, Mistral, Grok | TsgcHTTP_API_DeepSeek · _Mistral · _Grok |
How each one looks in Delphi
The pattern is the same every time: create the component, set the API key, call a one-line helper for a quick result, or assign OnHTTPAPISSE to stream the response token by token.
OpenAI
uses
sgcHTTP_API_OpenAI;
var
OpenAI: TsgcHTTP_API_OpenAI;
begin
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'sk-...';
Memo1.Lines.Text := OpenAI._CreateChatCompletion(
'gpt-4o-mini', 'Hello, world.');
end;
Anthropic Claude
uses
sgcHTTP_API_Anthropic;
var
Anthropic: TsgcHTTP_API_Anthropic;
begin
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'sk-ant-...';
Memo1.Lines.Text := Anthropic._CreateMessage(
'claude-3-5-sonnet-latest',
'What are the benefits of WebSockets?',
4096);
end;
Google Gemini
uses
sgcHTTP_API_Gemini;
var
Gemini: TsgcHTTP_API_Gemini;
begin
Gemini := TsgcHTTP_API_Gemini.Create(nil);
Gemini.GeminiOptions.ApiKey := 'YOUR_API_KEY';
Memo1.Lines.Text := Gemini._CreateContent(
'gemini-2.0-flash',
'Summarise RFC 6455',
4096);
end;
Three providers, three keys, one mental model. Streaming is just as uniform — assign the SSE handler and call the streaming variant (_CreateChatCompletion with Stream := True for OpenAI, _CreateMessageStream for Anthropic, _CreateContentStream for Gemini):
procedure TForm1.HandleSSE(Sender: TObject;
const aEvent, aData: string; var Cancel: Boolean);
begin
Memo1.Lines.Add(aData);
end;
OpenAI: the broadest toolbox
OpenAI is the safe default when you want more than chat. The same TsgcHTTP_API_OpenAI component covers chat completions, embeddings (_CreateEmbeddings), image generation (_CreateImage), moderation, and Whisper transcription, so a single dependency can power a chatbot, a semantic-search feature and a "describe this image" tool. If your roadmap touches several AI capabilities, starting here means fewer moving parts. See the OpenAI component page and the OpenAI in Delphi tutorial.
Anthropic Claude: reasoning and long context
Claude is a strong choice when the work is reading-heavy: summarising long documents, following multi-step instructions, or using tools reliably. The TsgcHTTP_API_Anthropic component exposes messages, streaming, vision and document inputs, and tool use, with model names like claude-3-5-sonnet-latest. Full walkthrough in the Anthropic Claude Delphi tutorial and on the Anthropic component page.
Google Gemini: multimodal and Google-native
Gemini fits well if you are already in the Google Cloud world or need multimodal input. TsgcHTTP_API_Gemini offers both a typed request API (CreateContent with TsgcGeminiClass_Request_GenerateContent) and string one-liners (_CreateContent), plus streaming. Details on the Gemini component page and in the Gemini Delphi client post.
Running locally: Ollama and the open models
When data cannot leave the machine, or you simply do not want a per-token bill, TsgcHTTP_API_Ollama talks to a local Ollama server with no API key — just point OllamaOptions.BaseUrl at http://localhost:11434/api and run Llama, Mistral or another open model on your own hardware. It keeps the same _CreateMessage / _CreateMessageStream shape as the cloud components. There are also dedicated components for DeepSeek, Mistral and Grok when you want a specific hosted model.
Feature comparison
| Provider | Component | One-line call | Streaming (OnHTTPAPISSE) | Runs locally |
|---|---|---|---|---|
| OpenAI | TsgcHTTP_API_OpenAI | _CreateChatCompletion | Yes | No |
| Anthropic | TsgcHTTP_API_Anthropic | _CreateMessage | Yes | No |
| Gemini | TsgcHTTP_API_Gemini | _CreateContent | Yes | No |
| Ollama | TsgcHTTP_API_Ollama | _CreateMessage | Yes | Yes |
| DeepSeek | TsgcHTTP_API_DeepSeek | _CreateMessage | Yes | No |
One pattern, many providers
Because every component follows the same component-plus-key-plus-method design, the cost of changing your mind is small. Prototype against whichever provider you have a key for, wrap the call behind your own function, and swapping TsgcHTTP_API_OpenAI for TsgcHTTP_API_Anthropic later is a localized edit rather than a rewrite. Many teams even keep two providers wired up and fail over between them. Browse all of them on the AI & LLM components hub.
Getting started
All of these ship in sgcWebSockets. Grab the free trial, drop in the component for the provider you want to try first, and you will have a working call in a few lines.
Questions, feedback or help choosing? Get in touch — you will get a reply from the people who wrote the code.
