Weekly Fireworks AI spend recap to Slack and Sheets
Every Monday at 9am, log last week's Fireworks AI usage to a Google Sheet and post a top-spend summary to Slack with a week-over-week change.
Integrations
Fireworks AI
Google Sheets
Slack
Type
Categories
- Finance
- Operations
Build me a deterministic weekly Fireworks AI spend recap as a code workflow. It should run every Monday at 9am in the workspace timezone via a cron trigger, with no manual steps.
Workflow inputs I want exposed: (1) slack_channel — the Slack channel to post the recap in, default #ai-spend; (2) spend_threshold_usd — the weekly total spend above which the message gets flagged with a 🚨 emoji; (3) sheet_id and sheet_tab — the Google Sheet and tab that stores the weekly history, default tab name "Fireworks Weekly Usage"; (4) top_n_models — how many models to highlight in the Slack message, default 3.
Step 1: Call the Fireworks AI "Get Billing Usage" operation for the last 7 days (week ending the previous Sunday in workspace timezone), grouped by model. I want rows that include model name, request count, prompt tokens, completion tokens, and rated cost in USD.
Step 2: Before writing anything new, call the Google Sheets "Get Values" operation on the history tab to read the previous week's total rated cost. Use the most recent week_ending_date row(s) already in the sheet. If the sheet is empty, treat the previous total as null so the workflow handles the very first run cleanly.
Step 3: Use the Google Sheets "Append Values" operation to append one row per model returned in step 1 to the "Fireworks Weekly Usage" tab. Column layout: week_ending_date, model, request_count, prompt_tokens, completion_tokens, rated_cost_usd. Pin this column order — the workflow author must not reshuffle it because step 2 reads it back.
Step 4: In code, compute the summary for Slack: total rated cost this week, the top N models by rated cost (default 3) with their cost and share of total, and the absolute + percent week-over-week change in total cost using the value from step 2 (omit the delta line entirely if the previous total is null). Set a flag boolean = (total cost > spend_threshold_usd).
Step 5: Format a short Slack message (mrkdwn, a few lines, no walls of text). Header line should include the week-ending date and total spend, prefixed with 🚨 if the flag is true. Then a "Top models" section listing the top N as `model — $cost (share%)`. Then a "vs last week" line with the signed dollar and percent change, or omit it on the first run. Send via the Slack "Send a Message" operation to {{slack_channel}}.
Constraints: every step is a known node with structured inputs (fireworks-ai Get Billing Usage, google-sheets Get Values + Append Values, slack Send a Message). No LLM nodes, no agent steps — this is a deterministic code workflow. Fail loudly if Fireworks returns no usage rows for the week so we notice silent breakage instead of posting an empty recap.
What it does
- Pulls the last 7 days of Fireworks AI usage and rated cost, broken down by model.
- Appends one row per model to a Google Sheet so you build a clean weekly history.
- Posts a short Slack digest with the top 3 models by spend and the change versus last week.
- Adds a flag emoji to the message when total weekly spend exceeds a threshold you set.
What you’ll need
- A Fireworks AI account with billing turned on.
- A Google Sheet you can append rows to (one tab for the weekly history).
- A Slack workspace and the channel you want the recap posted in.
- A weekly spend threshold you want to be alerted above.
How to customize it
- Change the day and time the recap runs (default is Monday at 9am).
- Pick which Slack channel receives the message and update the spend threshold.
- Point at a different sheet or tab, or rename the columns to match an existing tracker.
- Adjust how many models are highlighted in the Slack summary (default is top 3).
Use cases
- AI Reports
- Daily Digests
- Notifications & Alerts