DeepSeek AI

Integrate DeepSeek LLM models into Delphi, C++ Builder and .NET applications. OpenAI-compatible chat completions with streaming and vision, ideal for coding and reasoning tasks.

TsgcHTTP_API_DeepSeek

DeepSeek REST API client for chat messages, vision and model listing, using an OpenAI-compatible request format.

Component class

TsgcHTTP_API_DeepSeek

Protocol

DeepSeek REST API over HTTPS

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise (AI add-on)

Drop the component, set a few properties, go

Set the API key in DeepSeekOptions, then call typed helper methods such as _CreateMessage or build a TsgcDeepSeekClass_Request_ChatCompletion and call CreateMessage.

uses
  sgcHTTP_API_DeepSeek;

var
  DeepSeek: TsgcHTTP_API_DeepSeek;
begin
  DeepSeek := TsgcHTTP_API_DeepSeek.Create(nil);
  DeepSeek.DeepSeekOptions.ApiKey := 'YOUR_API_KEY';

  // Simple one-shot message
  Memo1.Lines.Text := DeepSeek._CreateMessage(
    'deepseek-chat',
    'What are the benefits of WebSockets?');

  // Streaming, handle OnHTTPAPISSE per delta
  DeepSeek.OnHTTPAPISSE := HandleSSE;
  DeepSeek._CreateMessageStream(
    'deepseek-chat',
    '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_DeepSeek
TsgcHTTP_API_DeepSeek *DeepSeek = new TsgcHTTP_API_DeepSeek(this);
DeepSeek->DeepSeekOptions->ApiKey = "YOUR_API_KEY";

// Simple one-shot message
Memo1->Lines->Text = DeepSeek->_CreateMessage(
  "deepseek-chat",
  "What are the benefits of WebSockets?");

// Streaming, OnHTTPAPISSE fires per delta
DeepSeek->OnHTTPAPISSE = HandleSSE;
DeepSeek->_CreateMessageStream(
  "deepseek-chat",
  "Summarise RFC 6455");
using esegece.sgcWebSockets;

var deepseek = new TsgcHTTPAPI_DeepSeek();
deepseek.DeepSeekOptions.ApiKey = "YOUR_API_KEY";

// Simple one-shot message
Console.WriteLine(deepseek._CreateMessage(
  "deepseek-chat",
  "What are the benefits of WebSockets?"));

// Streaming via Server-Sent Events
deepseek.OnHTTPAPISSE += (sender, ev, data, cancel) => Console.Write(data);
deepseek._CreateMessageStream(
  "deepseek-chat",
  "Summarise RFC 6455");

What's inside

Typed request / response classes for chat completions, plus string shortcuts for messages, vision and model listing.

Messages

CreateMessage sends a typed TsgcDeepSeekClass_Request_ChatCompletion and returns a parsed response. _CreateMessage, _CreateMessageWithSystem and _CreateMessageStream are JSON-string shortcuts, with streaming delivered through OnHTTPAPISSE.

Vision

_CreateVisionMessage sends a base64-encoded image alongside a text prompt, accepting image/jpeg, image/png, image/gif and image/webp media types for image understanding.

Models

_GetModels lists the available DeepSeek models, such as deepseek-chat and deepseek-reasoner, so you can target the right model for coding or reasoning tasks.

OpenAI-compatible format

Requests follow the OpenAI Chat Completions schema against https://api.deepseek.com/v1/chat/completions, so existing OpenAI client code can be reused by swapping the component and supplying a DeepSeek model name.

Reliability & diagnostics

CircuitBreaker short-circuits requests when the API is unhealthy; ReadTimeout and TLSOptions tune the HTTPS layer; OnHTTPAPIException surfaces failures; OnHTTPAPISSE streams server-sent events.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

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

Online Help — DeepSeek Full property, method and event reference for this component.
Demo Project — Demos\AI\DeepSeek Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Integrate DeepSeek?

Download the free trial and start building in minutes.