AnthropicAiBackend
IAiBackend implementation talking to Anthropic's Messages API directly over HTTPS. Supports tool use and prompt caching of the system block, which gives a ~10x cost reduction on cached input tokens once the cache is warm.
Constructors
Properties
TranscriptCallback
#Optional hook invoked with (requestJson, responseBody) after every HTTP exchange, including non-2xx responses and retries. The host uses this to maintain a complete transcript of what was sent and received. Backends must invoke this before throwing on non-success status codes.
Implements: TranscriptCallback
Methods
Generate
#public Task<AiBackendResponse> Generate(AiMessage[] history, AiTool[] tools, CancellationToken cancellation)
Parameters:
| history (AiMessage[]) | |
| tools (AiTool[]) | |
| cancellation (CancellationToken) |
Implements: Generate