TsgcHTTP_API_AnthropicProperties › AnthropicOptions

AnthropicOptions Property

Holds connection settings for the Anthropic API, including API key, HTTP options, logging, retries and the anthropic-version header

Syntax

property AnthropicOptions: TsgcHTTPAnthropic_Options read FAnthropicOptions
      write SetAnthropicOptions;

Default Value

Remarks

AnthropicOptions exposes sub-properties used by every request sent to https://api.anthropic.com/v1: ApiKey is sent in the x-api-key header, HttpOptions controls proxy/user-agent/connection settings, LogOptions enables request/response tracing and RetryOptions configures automatic retries on transient failures. The mandatory anthropic-version header (for example 2023-06-01) is also managed here. Configure this property once at design-time or startup and all subsequent API calls will reuse the same credentials and policies.

Example

oAPI := TsgcHTTP_API_Anthropic.Create(nil);
oAPI.AnthropicOptions.ApiKey := 'sk-ant-...';
oAPI.AnthropicOptions.AnthropicVersion := '2023-06-01';
oAPI.AnthropicOptions.HttpOptions.UserAgent := 'MyApp/1.0';
oAPI.AnthropicOptions.RetryOptions.Enabled := True;

Back to Properties