Ai Monitoring Setup
Set up comprehensive LLM monitoring, cost tracking, and observability
- Type
- Slash Command
- Repository
- jeremylongshore/tons-of-skills-marketplace
- GitHub stars
- 2.8k
- License
- MIT
- Repo last updated
- Sep 27, 2026
- Source file
- plugins/packages/ai-ml-engineering-pack/plugins/04-ai-safety/commands/ai-monitoring-setup.md
- Version
- 1.0.0
- Author
- Jeremy Longshore
What Ai Monitoring Setup is
Ai Monitoring Setup is a slash command published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”
A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.
Ai Monitoring Setup gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.
How to install Ai Monitoring Setup
Claude Code
- Download ai-monitoring-setup.md from the repository.
- Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
- Run it by typing / followed by its name.
Claude Cowork
- Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
- In Customize → Skills, click +, then upload the ZIP.
- Run it from any task with / and the skill name.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from plugins/packages/ai-ml-engineering-pack/plugins/04-ai-safety/commands/ai-monitoring-setup.md, shared under the repository's MIT license. Read the full file on GitHub.
Generate complete LLM monitoring infrastructure with cost tracking, performance metrics, error logging, and alerting for production AI applications.
What You'll Get
When you run this command, you'll receive:
- Cost tracking with real-time budget monitoring
- Performance metrics (latency, throughput, success rate)
- Token usage analytics per model, user, endpoint
- Error logging and alerting (Sentry, Slack, PagerDuty)
- Prometheus metrics for Grafana dashboards
- Custom dashboards with pre-built visualizations
- Alerting rules for cost spikes, errors, latency
- OpenTelemetry integration for distributed tracing
Usage
/ai-monitoring-setup <monitoring_stack>Monitoring Stacks: prometheus, datadog, newrelic, comprehensive
Examples:
- /ams prometheus - Prometheus + Grafana stack
- /ams datadog - DataDog integration
- /ams comprehensive - Full observability stack (Prometheus + Sentry + Logging)
Generated Output
Example: Comprehensive Monitoring Stack
Input:
/ams comprehensiveOutput:
1. Project Structure
llm-monitoring/
├── monitoring/
│ ├── __init__.py
│ ├── metrics.py # Prometheus metrics
│ ├── cost_tracker.py # Cost tracking and budgets
│ ├── logger.py # Structured logging
│ ├── tracer.py # OpenTelemetry tracing
│ └── alerting.py # Alert management
├── dashboards/
│ ├── grafana/
│ │ ├── llm_overview.json
│ │ ├── cost_analysis.json
│ │ └── performance.json
│ └── prometheus/
│ └── alerts.yml
├── docker/
│ ├── prometheus.yml
│ ├── grafana-datasources.yml
…2. Cost Tracker (monitoring/cost_tracker.py)
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from typing import Dict, List, Optional
import json
@dataclass
class CostTracker:
"""Track LLM costs with budget alerts."""
monthly_budget: float = 1000.0 # USD
alert_thresholds: List[float] = field(default_factory=lambda: [0.5, 0.75, 0.9])
# Pricing per 1M tokens (as of 2024)
PRICING = {
"gpt-4-turbo": {"input": 10.00, "output": 30.00},
"gpt-3.5-turbo": {"input": 0.50, "output": 1.50},
"claude-3-opus": {"input": 15.00, "output": 75.00},
"claude-3-sonnet": {"input": 3.00, "output": 15.00},
…3. Prometheus Metrics (monitoring/metrics.py)
from prometheus_client import Counter, Histogram, Gauge, Info
import time
from functools import wraps
# Metrics
llm_requests_total = Counter(
'llm_requests_total',
'Total LLM API requests',
['model', 'endpoint', 'status']
)
llm_request_duration = Histogram(
'llm_request_duration_seconds',
'LLM request duration in seconds',
['model', 'endpoint'],
buckets=[0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 30.0, 60.0]
)
…4. Structured Logging (monitoring/logger.py)
import logging
import json
from datetime import datetime
from typing import Any, Dict
class StructuredLogger:
"""JSON structured logging for LLM operations."""
def __init__(self, name: str = "llm-app"):
self.logger = logging.getLogger(name)
self.logger.setLevel(logging.INFO)
# JSON formatter
handler = logging.StreamHandler()
handler.setFormatter(self.JSONFormatter())
self.logger.addHandler(handler)
class JSONFormatter(logging.Formatter):
…5. Alerting (monitoring/alerting.py)
import requests
from typing import Dict, Optional
from enum import Enum
class AlertLevel(Enum):
INFO = "info"
WARNING = "warning"
CRITICAL = "critical"
class AlertManager:
"""Send alerts to various channels."""
def __init__(
self,
slack_webhook: Optional[str] = None,
pagerduty_key: Optional[str] = None,
email_config: Optional[Dict] = None
):
…6. Grafana Dashboards (dashboards/grafana/llm_overview.json)
{
"dashboard": {
"title": "LLM Overview",
"panels": [
{
"title": "Total Requests",
"targets": [{
"expr": "sum(rate(llm_requests_total[5m]))"
}],
"type": "graph"
},
{
"title": "Cost (Last 24h)",
"targets": [{
"expr": "sum(increase(llm_cost_total_usd[24h]))"
}],
"type": "singlestat"
},
…7. Docker Compose (docker/docker-compose.yml)
version: '3.8'
services:
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./alerts.yml:/etc/prometheus/alerts.yml
- prometheus-data:/prometheus
ports:
- "9090:9090"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
grafana:
image: grafana/grafana:latest
volumes:
…Features Included
Cost Management:
- Real-time cost tracking per request
- Budget alerts (50%, 75%, 90% thresholds)
- Cost breakdown by model, user, endpoint
- Monthly cost reset automation
Performance Monitoring:
- Request latency (P50, P95, P99)
- Throughput (requests per second)
- Success rate tracking
- Active request count
Resource Tracking:
- Token usage (input/output)
- Model usage distribution
- Per-user analytics
Alerting:
- Slack notifications
- PagerDuty integration (critical)
- Custom alert rules
Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Ai Monitoring Setup?
Ai Monitoring Setup is a slash command for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Set up comprehensive LLM monitoring, cost tracking, and observability
How do I install Ai Monitoring Setup in Claude Code?
Download ai-monitoring-setup.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.
Can I use Ai Monitoring Setup in Claude Cowork?
Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.
Is Ai Monitoring Setup safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Audit Report Generate comprehensive security audit report Slash Command · jeremylongshore/tons-of-skills-marketplace
- Auth Setup Generate authentication boilerplate with JWT, OAuth, and session support Slash Command · jeremylongshore/tons-of-skills-marketplace
- Audit Codebase PM-focused codebase exploration and capability mapping Slash Command · jeremylongshore/tons-of-skills-marketplace
- Assemblyai Pack Claude Code skill pack for AssemblyAI (18 skills) Plugin · jeremylongshore/tons-of-skills-marketplace
- Analytics Track content performance across platforms, identify winning patterns, and Slash Command · jeremylongshore/tons-of-skills-marketplace
- Ai Agents Test Test your multi-agent system with a sample task, showing agent handoffs, Slash Command · jeremylongshore/tons-of-skills-marketplace
- Analyze Chain Comprehensive blockchain metrics monitoring and on-chain analytics system Slash Command · jeremylongshore/tons-of-skills-marketplace
- Ai Agents Setup Initialize a multi-agent orchestration project with AI SDK v5 agents, Slash Command · jeremylongshore/tons-of-skills-marketplace