Anthropic
Large Language Model service implementation using Anthropic’s Claude API
Overview
AnthropicLLMService
provides integration with Anthropic’s Claude models, supporting streaming responses, function calling, and prompt caching with specialized context handling for Anthropic’s message format.
API Reference
Complete API documentation and method details
Anthropic Docs
Official Anthropic API documentation and features
Example Code
Working example with function calling
Installation
To use Anthropic services, install the required dependency:
You’ll also need to set up your Anthropic API key as an environment variable: ANTHROPIC_API_KEY
.
Get your API key from Anthropic Console.
Frames
Input
OpenAILLMContextFrame
- Conversation context and historyLLMMessagesFrame
- Direct message listVisionImageRawFrame
- Images for vision processingLLMUpdateSettingsFrame
- Runtime parameter updatesLLMEnablePromptCachingFrame
- Toggle prompt caching
Output
LLMFullResponseStartFrame
/LLMFullResponseEndFrame
- Response boundariesLLMTextFrame
- Streamed completion chunksFunctionCallInProgressFrame
/FunctionCallResultFrame
- Function call lifecycleErrorFrame
- API or processing errors
Function Calling
Function Calling Guide
Learn how to implement function calling with standardized schemas, register handlers, manage context properly, and control execution flow in your conversational AI applications.
Context Management
Context Management Guide
Learn how to manage conversation context, handle message history, and integrate context aggregators for consistent conversational experiences.
Usage Example
Metrics
The service provides:
- Time to First Byte (TTFB) - Latency from request to first response token
- Processing Duration - Total request processing time
- Token Usage - Prompt tokens, completion tokens, and total usage
- Cache Metrics - Cache creation and read token usage
Enable with:
Additional Notes
- Streaming Responses: All responses are streamed for low latency
- Context Persistence: Use context aggregators to maintain conversation history
- Error Handling: Automatic retry logic for rate limits and transient errors
- Message Format: Automatically converts between OpenAI and Anthropic message formats
- Prompt Caching: Reduces costs and latency for repeated context patterns