TsgcHTTP_API_Anthropic › Properties › AnthropicOptions
API キー、HTTP オプション、ログ、リトライ、anthropic-version ヘッダーを含む Anthropic API の接続設定。
property AnthropicOptions: TsgcHTTPAnthropic_Options read FAnthropicOptions
write SetAnthropicOptions;
—
AnthropicOptions は、https://api.anthropic.com/v1 へのすべてのリクエストで使用されるサブプロパティを公開します。ApiKey は x-api-key ヘッダーで送信され、HttpOptions はプロキシ/ユーザーエージェント/接続の設定を制御し、LogOptions はリクエスト/レスポンスのトレースを有効にし、RetryOptions は一時的な障害に対する自動再試行を設定します。必須の anthropic-version ヘッダー(例: 2023-06-01)もここで管理されます。このプロパティはデザイン時または起動時に一度設定すれば、以降のすべての API 呼び出しで同じ資格情報とポリシーが使用されます。
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;