Table of Contents

Cloud AI

TTMSMCPCloudAI talks to a cloud language model directly — no MCP server, no transport, no protocol handshake. You set an API key, pick a service, put your prompt in Context, and call Execute. Everything a modern chat API offers is reachable from the same component: system and assistant roles, model and generation settings per provider, function calling through a Tools collection your own code answers, file context (images, PDF, spreadsheets, Word documents, plain text, URLs), the OpenAI assistants and threads API for retrieval over uploaded documents, speech generation, and audio transcription or translation. Local model servers — Ollama and llama.cpp — and the OpenRouter aggregator use exactly the same surface as the hosted services.

Documentation

Start here Use when
Getting started You want one working prompt and answer quickly.
User guide You want task-oriented chapters grouped by feature area.
API reference You want exact class, property, method, and event contracts.
Release notes You want the version history for this component.

Key classes

Class Role
TTMSMCPCloudAI The component: keys, service selection, prompt, files, tools, execution, and every result event.
TTMSMCPCloudAIAPIKeys One API key per supported service, with encrypted save and load.
TTMSMCPCloudAISettings Per-service model names, endpoints, and generation parameters.
TTMSMCPCloudAITool One callable function the model may invoke, with its parameters and handler.
TTMSMCPCloudAIParameter A single declared argument of a tool: type, format, enum values, nested shape.
TTMSMCPCloudAIToolSet A reusable component that contributes a group of related tools to a TTMSMCPCloudAI.
TTMSMCPCloudAIFile One piece of file context — inline data, an uploaded ID, or a URL.
TTMSMCPCloudAIAssistant A stored assistant definition retrieved from or created at the service.
TTMSMCPCloudAIResponse The answer to one request, plus its token counts and the model that produced it.
TTMSMCPCloudAIUsage Token, audio-second, and character totals accumulated across requests.
TTMSMCPCloudBase The HTTP transport ancestor: requests, logging, progress, and cancellation.

Minimal example

procedure TForm1.FormCreate(Sender: TObject);
begin
  { AI is a TTMSMCPCloudAI dropped on the form. Keys were saved earlier with
    AI.APIKeys.SaveToFile, so nothing secret lives in the source. }
  AI.APIKeys.LoadFromFile('aikeys.cfg', KeyStorePassword);

  AI.Service := aiOpenAI;
  AI.Settings.OpenAIModel := 'gpt-5.2';
  AI.OnExecuted := AIExecuted;
end;

procedure TForm1.btnAskClick(Sender: TObject);
begin
  if AI.Busy then
    Exit;

  AI.SystemRole.Text := 'You are a concise Delphi assistant.';
  AI.Context.Text := memoPrompt.Lines.Text;
  AI.Execute;
end;

procedure TForm1.AIExecuted(Sender: TObject; AResponse: TTMSMCPCloudAIResponse;
  AHttpStatusCode: Integer; AHttpResult: string);
begin
  if Assigned(AResponse) then
    memoAnswer.Lines.Text := AResponse.Content.Text
  else
    memoAnswer.Lines.Text := Format('Request failed (%d): %s',
      [AHttpStatusCode, AHttpResult]);
end;

API map

Role Types
Component TTMSMCPCloudAI, TTMSMCPCloudAIService
Credentials and settings TTMSMCPCloudAIAPIKeys, TTMSMCPCloudAISettings, TTMSMCPCloudAIReasoning, TTMSMCPCloudAICacheControl, TTMSMCPCloudOpenAIServers
Parameters and tools TTMSMCPCloudAITool, TTMSMCPCloudAITools, TTMSMCPCloudAIToolSet, TTMSMCPCloudAIParameter, TTMSMCPCloudAIParameters, TTMSMCPCloudAIToolType, TTMSMCPCloudAIParameterType, TTMSMCPCloudAIFormat
Files TTMSMCPCloudAIFile, TTMSMCPCloudAIFiles, TTMSMCPCloudAIFileType, TTMSMCPCloudAIUploadProc
Assistants TTMSMCPCloudAIAssistant, TTMSMCPCloudAIAssistants, TTMSMCPCloudAIAssistantTool, TTMSMCPCloudAIAssistantTools
Responses and usage TTMSMCPCloudAIResponse, TTMSMCPCloudAIUsage, TTMSMCPCloudAILanguage
Events and callbacks TTMSMCPCloudAIResultEvent, TTMSMCPCloudAIFileEvent, TTMSMCPCloudAISpeechEvent, TTMSMCPCloudAITranscribeAudioEvent, TTMSMCPCloudAIToolExecuteEvent, TTMSMCPCloudAICreatedEvent, TTMSMCPCloudAIRunEvent
Base transport TTMSMCPCloudBase, TTMSMCPCustomCloudBase, TTMSMCPCloudBaseRequest, TTMSMCPCloudBaseRequestResult, TTMSMCPCloudBaseRequestHeader

Guides

Guide Covers
Chat and prompting Provider selection, API keys, the three prompt roles, per-service models, generation settings, Claude prompt caching, local servers, and reading the response and usage.
Function calling Declaring tools and their typed parameters, enums and formats, nested objects and arrays, reusable tool sets, and parallel tool execution.
Files, assistants, speech, and transcription Sending PDF, Office, image, text, and URL context; uploading and managing stored files; assistants and threads; text-to-speech; transcription and translation.

See Also