Monitor Claude Code usage with Cloudflare Workers and Workers Analytics Engine. Track API costs and usage patterns via OpenTelemetry or API proxy with SQL-powered analytics.
git clone https://github.com/cometkim/cc-monitor-worker.gitcc-monitor-worker provides real-time monitoring of Claude Code usage through Cloudflare Workers and Workers Analytics Engine. It supports two monitoring modes: OpenTelemetry for official, trend-based tracking of activities and costs, or API proxy mode for intercepting requests and calculating exact API costs. The serverless solution includes SQL-powered analytics, Bearer token authentication, and one-click deployment. Data is retained for three months on Cloudflare's platform, with archival options for historical analysis. This skill is ideal for teams and developers who need visibility into Claude Code consumption, cost tracking, and usage pattern analysis.
Deploy with one click using the Cloudflare Workers button. Choose between OpenTelemetry mode (official, trend-based) or API Proxy mode (exact cost calculation). Set up Bearer token authentication with AUTH_SECRET in development (.dev.vars) or production (wrangler secret put). Query usage data using SQL against the Workers Analytics Engine.
Track Claude Code API costs and usage trends in real-time
Monitor productivity metrics and coding patterns across teams
Calculate exact API expenses via LLM Gateway proxy mode
Archive and analyze historical usage data beyond three months
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/cometkim/cc-monitor-workerCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
I want to monitor my [COMPANY] website's performance using Cloudflare Workers and Workers Analytics Engine. Here's the code I'm using: [CODE]. Please help me set up monitoring to track [METRICS] and alert me when [THRESHOLDS] are exceeded. Provide a step-by-step guide and any necessary configuration details.
## Cloudflare Workers Monitoring Setup Guide
To monitor your website's performance using Cloudflare Workers and Workers Analytics Engine, follow these steps:
### 1. Set Up Workers Analytics Engine
1. Log in to your Cloudflare dashboard.
2. Navigate to the Workers & Pages section.
3. Select Analytics Engine from the left-hand menu.
4. Click on 'Create Dataset' and follow the prompts to configure your data collection.
### 2. Integrate Monitoring Code
Add the following code to your Worker script to track the specified metrics:
```javascript
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
const response = await fetch(request)
const analytics = {
status: response.status,
latency: Date.now() - request.timeStart,
size: response.headers.get('content-length')
}
// Send analytics data to Workers Analytics Engine
// Add your specific monitoring logic here
return response
}
```
### 3. Configure Alerts
1. In the Cloudflare dashboard, go to Workers Analytics Engine.
2. Select your dataset and click on 'Alerts'.
3. Create a new alert for each metric you want to monitor.
4. Set the threshold values for each alert.
5. Configure the notification preferences to receive alerts via email or other channels.
### 4. Test and Deploy
1. Test your Worker script in the Cloudflare Workers playground.
2. Deploy your Worker to the Cloudflare network.
3. Monitor the analytics data and alerts to ensure everything is working as expected.
Deploy serverless code instantly across the globe
AI assistant built for thoughtful, nuanced conversation
Get more done every day with Microsoft Teams – powered by AI
Automate your spreadsheet tasks with AI power
Agentic AI Workflow platform
Connected workspace for docs, wikis, and projects
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan