{"ref":"artifact:sap-samples-btp-ai-core-usage-monitor","page":"/artifacts/sap-samples-btp-ai-core-usage-monitor","json":"/artifacts/sap-samples-btp-ai-core-usage-monitor.json","generated":"2026-10-26","drafted_with_ai":true,"entity":{"id":"sap-samples-btp-ai-core-usage-monitor","name":"SAP-samples/btp-ai-core-usage-monitor","artifact_type":"app","ecosystem":"btp","use_as":"dependency","domain":"operations-and-runtime","origin_ring":"sap-official","description":{"one_line":"A Python background agent on the [SAP BTP, Cloud Foundry Runtime](artifact:btp-cloud-foundry-runtime) that checks [SAP AI Core](artifact:btp-ai-core) capacity unit consumption daily and emails or alerts as it approaches a monthly spending limit.","short":"Python agent alerting on SAP AI Core capacity unit consumption","what_it_solves":"A team consuming [SAP AI Core](artifact:btp-ai-core) capacity units wants to know before a monthly budget is spent rather than after. A scheduled check, at 07:00 UTC unless configured otherwise, sums the capacity units recorded for the current calendar month for one subaccount, or for a single AI Core resource group within it, from the Usage Data Management reporting API, and compares that month-to-date total with a configured spending limit. Crossing the warning threshold sends a warning email and crossing the alert threshold sends an alert, by SMTP or through [SAP Alert Notification service](artifact:btp-alert-notification); both thresholds are environment variables and default to 60 and 80 per cent of the limit. Four Flask endpoints expose a liveness probe, the last result, the active configuration and a manual trigger, the last three behind a JSON Web Token from [SAP Authorization and Trust Management service](artifact:btp-authorization-and-trust-management). It stops at reading and notifying: nothing in the agent throttles or blocks further AI Core usage."},"links":{"repo":"https://github.com/SAP-samples/btp-ai-core-usage-monitor"},"identity":{"license":"Apache-2.0"},"source_available":true,"provides":[{"capability":"capability:consumption-monitoring","what_it_does":"Sums the AI Core capacity units a subaccount, or one resource group within it, has recorded for the current calendar month and notifies by email or through SAP Alert Notification service when the month-to-date total approaches a configured monthly spending limit.","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README","checked":"2026-10-19","quote":"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)**."},{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, How It Works","checked":"2026-10-19","quote":"**Metric tracked:** `serviceId=ai-core` + `measureId=capacity_units` — summed across all models (Claude, GPT, embedding models, etc.) for the current calendar month."}]}],"type_properties":{"placement":{"value":"on-btp","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README","checked":"2026-10-19","quote":"A Python background agent that runs on **SAP BTP Cloud Foundry** and monitors daily AI Core capacity unit consumption."}]}},"requires":[{"ref":"artifact:btp-cloud-foundry-runtime","for":"the space the agent is pushed to, with at least 256 MB of memory quota","requirement":"required","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"1. **SAP BTP subaccount** with a **Cloud Foundry environment** enabled"}]},{"ref":"artifact:btp-ai-core","for":"the service whose capacity unit consumption is what the agent counts","requirement":"required","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"3. **SAP AI Core** (Extended plan) active in the **subaccount whose usage you want to monitor** — this is the `SUBACCOUNT_ID` you configure"}]},{"ref":"artifact:btp-usage-data-management","for":"the reporting API the consumption figures are fetched from, bound so the credentials come from VCAP_SERVICES","requirement":"required","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"4. **Usage Data Management** (`uas`) service instance (`reporting-ga-admin` plan) — for fetching consumption data via the UAS Reporting API"}]},{"ref":"artifact:btp-authorization-and-trust-management","for":"the token that protects the status, config and trigger endpoints on BTP","requirement":"required","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"5. **XSUAA** service instance — for JWT-based endpoint protection"}]},{"ref":"artifact:btp-alert-notification","for":"the notification channel, where the deployment chooses it over an SMTP server","requirement":"conditional","condition":"ENABLE_ANS is set to true; the prerequisite asks for one notification channel, an SMTP server or this service","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"- **SAP Alert Notification Service** instance — set `ENABLE_ANS=true`"}]}],"connects":[{"ref":"artifact:btp-usage-data-management","kind":"data","direction":"outbound","for":"fetches the month's capacity unit records for the configured subaccount, and for one resource group where that is set","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Prerequisites","checked":"2026-10-19","quote":"4. **Usage Data Management** (`uas`) service instance (`reporting-ga-admin` plan) — for fetching consumption data via the UAS Reporting API"},{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, How It Works","checked":"2026-10-19","quote":"When `RESOURCE_GROUP` is set, only records matching that AI Core resource group (`instanceId`) are included."}]},{"ref":"artifact:btp-alert-notification","kind":"data","direction":"outbound","condition":"ENABLE_ANS is set to true","for":"posts the threshold event so the service routes it to whichever action is subscribed","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, Configure notifications","checked":"2026-10-19","quote":"When `ENABLE_ANS=true`, the agent posts a structured event to the ANS Producer API (`/cf/producer/v1/resource-events`)."}]}],"interfaces":[{"key":"health","name":"GET /health","kind":"api","direction":"in","for":"a liveness probe, the one endpoint that takes no token","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, API Endpoints","checked":"2026-10-19","quote":"| `GET` | `/health` | ❌ | Liveness probe — returns `{\"status\": \"ok\"}` |"}]},{"key":"status","name":"GET /status","kind":"api","direction":"in","for":"read the last monitoring result as JSON","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, API Endpoints","checked":"2026-10-19","quote":"| `GET` | `/status` | ✅ | Last monitoring result as JSON |"}]},{"key":"config","name":"GET /config","kind":"api","direction":"in","for":"read the active configuration, with the credentials masked","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, API Endpoints","checked":"2026-10-19","quote":"| `GET` | `/config` | ✅ | Active configuration (credentials masked) |"}]},{"key":"trigger","name":"POST /trigger","kind":"api","direction":"in","for":"run a monitoring check immediately, as a dry run when the body asks for one","sources":[{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, API Endpoints","checked":"2026-10-19","quote":"| `POST` | `/trigger` | ✅ | Run a monitoring check immediately |"},{"url":"https://github.com/SAP-samples/btp-ai-core-usage-monitor","title":"SAP-samples/btp-ai-core-usage-monitor — README, /trigger request body","checked":"2026-10-19","quote":"When `dry_run=true`, usage is fetched and the alert level is computed, but **no notifications are sent**."}]}],"maintainers":["actor:sap-samples"],"provenance":{"discovered_via":[{"source":"source:curator"}],"first_seen":"2026-09-14"},"drafted_with_ai":true,"contributors":["actor:daniil-bolobonov"]},"effective_normative_relations":[],"readings":{"liveness":[{"label":"Maintenance","tier":"unknown","evidence":"no release data"},{"label":"Continuity","tier":"fair","evidence":"1 contributor, org-owned"},{"label":"Repository","tier":"good","evidence":"pushed 2026-08, not archived"}],"compatibility":[{"label":"Declared for","tier":"unknown","evidence":"no BTP release lines in the atlas"},{"label":"Survived majors","tier":"unknown","evidence":"no BTP release lines in the atlas"},{"label":"Maintainer's CI","tier":"fair","evidence":"no CI configured"}],"practice":[{"label":"Tests","tier":"poor","evidence":"none found in the tree"},{"label":"Docs","tier":"good","evidence":"README 24 KB"},{"label":"Changelog","tier":"fair","evidence":"none in the repo"}],"reach":[{"value":null,"unit":"installs/week"},{"value":5,"unit":"watching"}]},"signals":{"crawled_at":"2026-10-26","npm":"not published under this name","stars":5,"forks":2,"open_issues":2,"archived":false,"pushed_at":"2026-08-05","license_spdx":"Apache-2.0","org_owned":true,"default_branch":"main","created_at":"2026-04-24T12:05:33Z","open_prs":0,"tree_truncated":false,"test_files":0,"workflows":0,"other_ci":false,"readme_bytes":24506,"docs_files":0,"changelog":false,"license_file":true,"dts_files":0,"first_commit":"2026-04-22","last_commit":"2026-08-05","commits":24,"contributors":1,"readme_path":"README.md","readme_sha":"721bd611d6eb8b90900fe0d7616bcc262f3b1d02","repo_read":"2026-10-26"},"edges":{"maintainers":[{"ref":"actor:sap-samples","name":"SAP Samples","json":"/actors/sap-samples.json"}],"contributors":[{"ref":"actor:daniil-bolobonov","name":"daniil-bolobonov","json":"/actors/daniil-bolobonov.json"}],"explained_by":[],"alternative_to_this":[],"needed_by":[],"available_via":[],"parts":[],"add_ons":[],"answered_through_parts":[]}}