Monitor your Anthropic API usage and costs in real-time by collecting detailed metrics and logs with a custom OpenTelemetry collector. This integration provides comprehensive visibility into token consumption, feature usage, and cost attribution across models, workspaces, and API keys.Documentation Index
Fetch the complete documentation index at: https://docs.honeycomb.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Anthropic Usage & Cost Monitoring integration uses an OpenTelemetry receiver to collect detailed usage metrics and cost data from the Anthropic Admin API, transforming them into structured telemetry for monitoring and cost tracking in Honeycomb. What’s Collected:- Usage Metrics (minute-level granularity): Token consumption (input, output, cache), feature usage (web searches), grouped by model, tier, workspace, and API key
- Cost Data (daily logs): Detailed cost breakdowns with workspace attribution and human-readable descriptions
Prerequisites
- Anthropic Admin API key with organization admin access
- OpenTelemetry Collector Builder v0.130.0+
- Go 1.23+ (for building custom collector)
Custom Collector Setup
The Anthropic Usage Receiver is designed to be integrated into a custom OpenTelemetry Collector using the OpenTelemetry Collector Builder (OCB).Create Builder Configuration
Create a
builder-config.yaml file that includes the Anthropic Usage Receiver:Deployment Options
Stateless Deployment
For environments where persistence isn’t required (e.g., short-lived containers, testing):Stateful Deployment
For production environments where checkpoint persistence is important to prevent data loss during restarts:Run the Collector
Using the Anthropic Usage Board Template
Once your data is flowing into Honeycomb, use the pre-built Anthropic Usage & Cost Monitoring Board Template to instantly visualize your usage and costs:- Navigate to Boards in the Honeycomb UI
- Select Templates or Create Boards → From Template
- Choose Anthropic Usage & Cost Monitoring template
- Review the template preview with your data
- If needed, map any fields in the Setup view to match your data structure
- Select Use Template to create your board
- Token usage trends and patterns
- Cost monitoring and attribution
- Cache utilization analysis
- Usage distribution across models and workspaces
Configuration Reference
Usage Metrics
| Metric | Description |
|---|---|
anthropic.usage.input_tokens | Number of uncached input tokens consumed |
anthropic.usage.output_tokens | Number of output tokens generated |
anthropic.usage.cache_creation.ephemeral_1h | Tokens used for 1-hour ephemeral cache creation |
anthropic.usage.cache_creation.ephemeral_5m | Tokens used for 5-minute ephemeral cache creation |
anthropic.usage.cache_read_input_tokens | Input tokens read from cache |
anthropic.usage.web_search_requests | Number of web search requests |
Cost Metrics
| Metric | Description |
|---|---|
anthropic.cost.amount | Cost amount in minor currency units (e.g., fractional cents for USD) |
Key Attributes
| Attribute | Description | Example |
|---|---|---|
model | Claude model used | claude-3-7-sonnet-20250219, claude-opus-4-20250514 |
service_tier | API service tier | standard, batch, priority |
context_window | Context window size | 0-200k, 200k-1M |
workspace_id | Anthropic workspace identifier (null for default workspace) | wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ |
api_key_id | API key identifier (null for workbench usage) | apikey_01Rj2N8SVvo6BePZj99NhmiT |
description | Human-readable cost description | Claude Sonnet 4 Usage - Input Tokens, Cache Write 1 Hour - Batch |
currency | ISO 4217 currency code | USD |
Advanced Configuration
Filtering Data Collection
Limit data collection to specific models, tiers, or workspaces:Multiple Exporters
Send data to multiple destinations:Troubleshooting
Common Issues
No data appearing in Honeycomb:- Verify your Anthropic Admin API key has proper permissions
- Check collector logs for authentication errors
- Ensure your Honeycomb API key is configured correctly
- Cost data is only available at daily granularity
- Ensure
cost.enabled: truein your configuration - Check that your Admin API key has cost visibility permissions
- Verify the storage directory is writable
- Check that the file_storage extension is properly configured
- Ensure the storage extension is referenced in the service section
- Increase
collection_intervalto reduce API call frequency (minimum recommended: 1 minute) - Use filtering to collect only necessary data
- Monitor the
anthropic.scraper.upmetric for health status - Note: Usage and cost data appears within 5 minutes of API request completion
- The API is designed for polling once per minute maximum
- Reduce polling frequency if you encounter rate limit errors
- Consider caching results for frequently updated dashboards
Getting Help
- View detailed configuration options in the Anthropic Usage Receiver repository
- Check the OpenTelemetry Collector documentation for general collector issues
- For Honeycomb-specific questions, consult the Honeycomb documentation or contact support