SAP-samples

Btp AI Core Usage Monitor — AI skill for Claude Code

AI community

A Python background agent that runs on SAP BTP Cloud Foundry and monitors daily AI Core capacity unit consumption.

How to install Btp AI Core Usage Monitor

This entry records only its repository, not the path inside it, so there is no exact command to give. Open SAP-samples/btp-ai-core-usage-monitor and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Btp AI Core Usage Monitor does

A Python background agent that runs on SAP BTP Cloud Foundry and monitors daily AI Core capacity unit consumption. When consumption approaches a configured monthly spending limit, it sends notifications via SMTP email or SAP Alert Notification Service (ANS).

Alternatives in AI

  • Riteway — Simple, readable, helpful unit tests 1.2k ★
  • Context Dump — Dump current context for model switch or context limit recovery 508 ★
  • Graymatter — 30 sec to give your AI agents persistent memory 460 ★

README

AI Core Consumption Monitor

A Python background agent that runs on **SAP BTP Cloud Foundry** and monitors daily AI Core capacity unit consumption. When consumption approaches a configured monthly spending limit, it sends notifications via **SMTP email** or **SAP Alert Notification Service (ANS)**.

How It Works

┌─────────────────────────────────────────────────────────────┐
│  SAP BTP Cloud Foundry                                      │
│                                                             │
│  ┌──────────────────────────────────────────────────────┐   │
│  │  ai-core-monitor (Python / Flask)                    │   │
│  │                                                      │   │
│  │  APScheduler ──► run_monitoring_job() [daily 07:00]  │   │
│  │       │                                              │   │
│  │       ▼                                              │   │
│  │  UAS Reporting API ──► fetch usage (OAuth2)          │   │
│  │       │                                              │   │
│  │       ▼                                              │   │
│  │  Aggregate ai-core capacity_units                    │   │
│  │       │                                              │   │
│  │       ▼                                              │   │
│  │  Compare vs. SPENDING_LIMIT                          │   │
│  │       │                                              │   │
│  │       ├── < 60%  → INFO  (daily email if enabled)    │   │
│  │       ├── ≥ 60%  → WARNING email 🟡                  │   │
│  │       └── ≥ 80%  → ALERT email 🔴                    │   │
│  │                                                      │   │
│  │  Flask endpoints: /health  /status  /trigger         │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

**Metric tracked:** `serviceId=ai-core` + `measureId=capacity_units` — summed across all models (Claude, GPT, embedding models, etc.) f