Table of Contents

Class ClaudeApiService

Namespace
SunamoAI
Assembly
SunamoAI.dll

Service for calling Claude API (Anthropic HTTP API) with configurable logging levels.

public class ClaudeApiService
Inheritance
ClaudeApiService
Inherited Members
Extension Methods

Constructors

ClaudeApiService(ILogger, string, bool, bool)

Initializes a new instance of the ClaudeApiService class.

public ClaudeApiService(ILogger logger, string apiKey, bool isVerboseLoggingEnabled = false, bool isDetailedLoggingEnabled = false)

Parameters

logger ILogger

Logger instance for logging operations.

apiKey string

Anthropic API key for authentication.

isVerboseLoggingEnabled bool

Whether verbose logging is enabled for debugging.

isDetailedLoggingEnabled bool

Whether detailed logging is enabled for API calls.

Methods

CallClaudeApi(string, string, int, double)

Calls Claude API with a prompt and returns the response.

public Task<string?> CallClaudeApi(string prompt, string model = "claude-sonnet-4-20250514", int maxTokens = 1024, double temperature = 0)

Parameters

prompt string

The prompt to send to Claude.

model string

Claude model to use (default: claude-sonnet-4-20250514).

maxTokens int

Maximum tokens in response (default: 1024).

temperature double

Temperature for response generation (default: 0.0).

Returns

Task<string>

Claude's response text, or null if the call failed.