OpenAI API

Access ChatGPT, DALL-E, Whisper, and GPT models directly from your Delphi applications with full streaming support.

OpenAI Integration

Integrate AI-powered text generation, image creation, speech-to-text, and embeddings into your Delphi applications.

AI-Powered Delphi Applications

The sgcWebSockets OpenAI component provides native Delphi access to the full OpenAI API. Use GPT models for chat completions with streaming, generate images with DALL-E, transcribe audio with Whisper, and create vector embeddings for semantic search.

  • Chat completions with GPT-4o, GPT-4, and GPT-3.5 models
  • Real-time streaming responses for chat interfaces
  • Image generation and editing with DALL-E 3
  • Audio transcription and translation with Whisper
  • Function calling and tool use support

Delphi OpenAI Example

Send a chat completion request with streaming.

uses
  sgcAI_OpenAI;

var
  OpenAI: TsgcAI_OpenAI;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OpenAI := TsgcAI_OpenAI.Create(nil);
  OpenAI.ApiKey := 'sk-your-api-key';
  OpenAI.OnChatCompletionStream := OnStream;
end;

procedure TForm1.SendChat;
begin
  OpenAI.ChatCompletions.Model := 'gpt-4o';
  OpenAI.ChatCompletions.AddMessageUser('Explain WebSockets in one paragraph.');
  OpenAI.ChatCompletions.Stream := True;
  OpenAI.CreateChatCompletions;
end;

procedure TForm1.OnStream(Sender: TObject;
  aText: string);
begin
  // Append streamed tokens to the memo
  Memo1.Text := Memo1.Text + aText;
end;

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Ready to Add AI to Your Apps?

Download the free trial and integrate OpenAI into your Delphi applications today.