Workflow

Claude Code Daily Token Budget Alert

A daily workflow that audits Claude Code usage, projects end-of-month cost, and alerts when projects exceed budget.

Overview

Reads Claude Code usage logs, calculates daily token burn per project, projects end-of-month cost, and fires a Slack alert when any project is on pace to exceed its budget. Pulls fresh pricing from Anthropic docs via Scavio extract so the math stays accurate if pricing changes.

Trigger

Cron schedule (daily at 8 AM local time)

Schedule

Runs daily at 8 AM local time

Workflow Steps

1

Read usage logs

Parse Claude Code logs in ~/.claude/logs or a team billing export.

2

Tag by project

Group token counts by working directory or user-tagged project name.

3

Fetch latest pricing

Extract Anthropic docs to confirm current per-million-token pricing.

4

Project monthly cost

Extrapolate the last 7-day average to end of month.

5

Alert on over-budget

Slack alert when any project projects over its configured budget.

Python Implementation

Python
import requests, os, json
from pathlib import Path
API_KEY = os.environ["SCAVIO_API_KEY"]

def current_pricing():
    r = requests.post("https://api.scavio.dev/api/v1/extract",
        headers={"x-api-key": API_KEY},
        json={"url": "https://docs.anthropic.com/en/docs/about-claude/pricing"})
    return r.json().get("text", "")

print(current_pricing()[:500])

JavaScript Implementation

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
async function pricing() {
  const r = await fetch("https://api.scavio.dev/api/v1/extract", {
    method: "POST",
    headers: { "x-api-key": API_KEY, "content-type": "application/json" },
    body: JSON.stringify({ url: "https://docs.anthropic.com/en/docs/about-claude/pricing" }),
  });
  return (await r.json()).text ?? "";
}
console.log((await pricing()).slice(0, 500));

Platforms Used

Google

Web search with knowledge graph, PAA, and AI overviews

Frequently Asked Questions

Reads Claude Code usage logs, calculates daily token burn per project, projects end-of-month cost, and fires a Slack alert when any project is on pace to exceed its budget. Pulls fresh pricing from Anthropic docs via Scavio extract so the math stays accurate if pricing changes.

This workflow uses a cron schedule (daily at 8 am local time). Runs daily at 8 AM local time.

This workflow uses the following Scavio platforms: google. Each platform is called via the same unified API endpoint.

Yes. Scavio's free tier includes 500 credits per month with no credit card required. That is enough to test and validate this workflow before scaling it.

Claude Code Daily Token Budget Alert

A daily workflow that audits Claude Code usage, projects end-of-month cost, and alerts when projects exceed budget.