Anthropic Claude API Client for Delphi & C++ Builder | eSeGeCe

Anthropic Claude API

Integrate Anthropic Claude AI models into your Delphi applications for advanced chat, analysis, content generation, vision and tool use.

TsgcHTTP_API_Anthropic

Typed Delphi/C++Builder client for the Anthropic Messages API — streaming, tool use, vision, extended thinking, prompt caching, files and MCP-on-Claude.

Component class

TsgcHTTP_API_Anthropic

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Set the API key, build a request, stream the answer

Set ApiKey on AnthropicOptions, then call CreateMessage for typed requests or use _CreateMessage / _CreateMessageStream JSON-string shortcuts.

uses
  sgcHTTP_API_Anthropic;

var
  Anthropic: TsgcHTTP_API_Anthropic;
begin
  Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
  Anthropic.AnthropicOptions.ApiKey := 'sk-ant-...';

  // One-shot synchronous call
  Memo1.Text := Anthropic._CreateMessage(
    'claude-sonnet-4-5-20250929',
    'Explain WebSockets in two sentences.',
    1024);

  // Streaming - OnHTTPAPISSE fires per delta
  Anthropic.OnHTTPAPISSE := HandleSSE;
  Anthropic._CreateMessageStream(
    'claude-sonnet-4-5-20250929',
    'Summarise RFC 6455',
    1024);
end;

procedure TForm1.HandleSSE(Sender: TObject;
  const aEvent, aData: string;
  var Cancel: Boolean);
begin
  Memo1.Lines.Add(aEvent + ': ' + aData);
end;
// uses: sgcHTTP_API_Anthropic
TsgcHTTP_API_Anthropic *Anthropic = new TsgcHTTP_API_Anthropic(this);
Anthropic->AnthropicOptions->ApiKey = "sk-ant-...";

UnicodeString reply = Anthropic->_CreateMessage(
  "claude-sonnet-4-5-20250929",
  "Explain WebSockets in two sentences.",
  1024);

Memo1->Lines->Add(reply);

What's inside

A typed mirror of the Anthropic Messages API surface covering every endpoint published by the vendor.

Messages

CreateMessage accepts a typed TsgcAnthropicClass_Request_Messages and returns a parsed response. _CreateMessage, _CreateMessageWithSystem, _CreateMessageStream and _CreateMessageWithThinking are JSON-string shortcuts.

Tool use & structured output

Build TsgcAnthropicClass_Request_Tool entries to expose function-calling tools to Claude. _CreateMessageJSON applies an inline JSON schema for structured outputs.

Vision & documents

Attach images and PDFs as content blocks — _CreateVisionMessage and _CreateDocumentMessage handle the base64 framing and the document content type.

Extended thinking

Toggle thinking on the request to enable Claude's extended reasoning mode. _CreateMessageWithThinking and _CreateMessageWithAdaptiveThinking set the budget and surface thinking blocks.

Prompt caching

Add cache_control: {type: ephemeral} to system or user blocks to cut repeat-prompt latency and cost. Hit/miss counters are returned in the response usage block.

Files, batches, web search, MCP

Endpoints for the Files API, asynchronous Message Batches, server-side WebSearch tool and Claude-as-MCP-host are all exposed under the same component.

Specifications & references

Authoritative sources for the APIs this component implements.

Documentation & Demos

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

Online Help — TsgcHTTP_API_Anthropic Full property, method and event reference for this component.
Demo Project — Demos\15.AI\Anthropic Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Integrate Claude AI?

Download the free trial and add Anthropic Claude to your Delphi applications.