Integrate Anthropic Claude API in Your Delphi Applications
sgcWebSockets delivers a production-ready Delphi component for the full Anthropic Claude API — from text generation and vision to tool use, extended thinking, and beyond.
Anthropic Claude is one of the most advanced AI model families available today, renowned for its exceptional reasoning, safety-first design, and versatile capabilities across text, code, vision, and structured data. For Delphi developers looking to harness these capabilities, sgcWebSockets provides TsgcHTTP_API_Anthropic — a comprehensive, native component that wraps the entire Anthropic API surface.
Whether you are building intelligent chatbots, automating document analysis, orchestrating complex tool pipelines, or processing thousands of requests in batch, this component gives you direct access to every Claude feature through clean, type-safe Delphi code. No REST boilerplate. No JSON wrangling. Just drop the component, set your API key, and start building.
Complete API Coverage
Every major feature of the Anthropic Claude API is supported out of the box.
| Messages & Streaming Send messages with system prompts, receive responses synchronously or streamed in real-time via Server-Sent Events. |
Vision Analyze images in JPEG, PNG, GIF, and WebP formats. Claude describes, interprets, and reasons about visual content. |
Tool Use Define custom tools with JSON Schema and let Claude call them. Build agentic workflows with function calling. |
| Extended Thinking Enable step-by-step reasoning for complex tasks. Ideal for math, analysis, and multi-step problem solving. |
Document Processing Send PDF documents and text files for analysis, summarization, and question answering with citation support. |
Structured Outputs Force Claude to return valid JSON conforming to your schema. Guaranteed parseable, type-safe responses. |
| Web Search Let Claude search the web for real-time information during conversations using built-in server-side tools. | Prompt Caching Cache system prompts, content blocks, and tool definitions. Reduce costs by up to 90% on repeated context. | Message Batches Process thousands of requests asynchronously. Perfect for bulk content generation and data processing pipelines. |
| Files API Upload, list, download, and manage files on Anthropic's servers. Reference them across multiple conversations. | MCP Connector Connect Claude to external Model Context Protocol servers. Extend capabilities with third-party tools and services. | Token Counting Count tokens before sending requests. Accurately estimate costs and manage context window budgets. |
Getting Started
Integrate Claude into your Delphi project in under a minute. Drop the component, configure your API key, and send your first message.
Messages & Streaming
The Messages API is the foundation of every Claude interaction. Send text with optional system prompts, and receive responses synchronously or streamed in real-time.
System PromptsControl Claude's behavior by providing a system prompt that sets the context, personality, or constraints for the conversation.
Real-Time Streaming
For responsive user interfaces, stream Claude's response token-by-token using Server-Sent Events. Assign the OnHTTPAPISSE event handler and call _CreateMessageStream.
Advanced Typed API
For full control over request parameters — temperature, top-p, stop sequences, metadata — use the typed request and response classes.
Vision — Image Understanding
Claude can analyze and reason about images. Send photographs, screenshots, diagrams, or charts and receive detailed descriptions, data extraction, or visual Q&A.
Supported formats include JPEG, PNG, GIF, and WebP. Images are sent as base64-encoded content blocks.
Tool Use — Function Calling
Define custom tools with JSON Schema, and Claude will decide when and how to invoke them. This is the foundation for building agentic, multi-step workflows.
The tool use flow follows a clear pattern: define tools, send a request, detect tool_use in the response, execute the function locally, and return the result to Claude for the final answer.
Document Processing & Citations
Send PDF documents and text files to Claude for analysis, summarization, and question answering. Enable citations to receive verifiable references back to the source material.
Citations
Enable citations on document content blocks to receive source references — including page numbers, character ranges, and cited text — in Claude's response.
MCP Connector
Connect Claude to external Model Context Protocol (MCP) servers to extend its capabilities with third-party tools and services — databases, CRMs, internal APIs, and more.
Authenticated MCP Servers
For servers that require authentication, the typed API supports OAuth Bearer tokens.