Example
AI spend this month
What Claude and OpenAI have cost so far, against a monthly budget.
{
"v": 1,
"preferredFamily": "systemSmall",
"refresh": 1800,
"accessibility": "AI spend this month: $18.70 of a $60.00 budget. Claude $12.51, OpenAI $6.19. On pace for $55.94.",
"url": "https://webhookwidget.com/examples/ai-spend/",
"view": {
"type": "hstack",
"align": "top",
"spacing": 0,
"padding": 14,
"bg": "#16131E",
"overflow": "drop",
"children": [
{
"type": "vstack",
"align": "leading",
"spacing": 0,
"h": "fill",
"maxW": 130,
"priority": 1,
"children": [
{
"type": "hstack",
"spacing": 5,
"children": [
{
"type": "symbol",
"name": "sparkles",
"style": "caption2",
"weight": "bold",
"color": "#F2765B"
},
{
"type": "text",
"text": "AI SPEND · AUG",
"style": "caption2",
"weight": "bold",
"color": "#F2765B",
"lines": 1
}
]
},
{"type": "spacer"},
{
"type": "text",
"text": "$18.70",
"style": "title",
"weight": "bold",
"design": "rounded",
"color": "white",
"monoDigits": true,
"lines": 1,
"priority": 1
},
{
"type": "text",
"text": "of $60.00 budget",
"style": "caption",
"color": "#A59FB4",
"lines": 1
},
{"type": "spacer", "minLength": 8},
{
"type": "gauge",
"value": 18.696078919221403,
"max": 60,
"tint": "green",
"track": "green/20"
},
{"type": "spacer", "minLength": 6},
{
"type": "vstack",
"align": "leading",
"spacing": 0,
"children": [
{
"type": "text",
"text": "Resets in",
"style": "caption2",
"color": "#7F7891",
"lines": 1
},
{
"type": "timer",
"until": "2026-09-01T00:00:00Z",
"style": "relative",
"size": 11,
"color": "#7F7891"
}
]
}
]
},
{
"type": "vstack",
"align": "leading",
"spacing": 8,
"padding": {"leading": 16},
"children": [
{
"type": "grid",
"spacing": 8,
"rowSpacing": 7,
"columns": [{}, {"w": "fill"}, {"align": "trailing"}],
"text": {"style": "subheadline", "color": "#D9D5E3"},
"rows": [
[
{"type": "circle", "fill": "#E8875F", "w": 8, "h": 8},
"Claude",
{
"type": "text",
"text": "$12.51",
"weight": "semibold",
"color": "white",
"monoDigits": true
}
],
[
{"type": "circle", "fill": "#6FC2A4", "w": 8, "h": 8},
"OpenAI",
{
"type": "text",
"text": "$6.19",
"weight": "semibold",
"color": "white",
"monoDigits": true
}
]
]
},
{"type": "divider"},
{
"type": "grid",
"spacing": 8,
"rowSpacing": 4,
"columns": [{"w": "fill"}, {"align": "trailing"}],
"text": {"style": "caption", "color": "#A59FB4"},
"rows": [
["Today", {"type": "text", "text": "$0.58", "monoDigits": true}],
[
"On pace for",
{
"type": "text",
"text": "$55.94",
"weight": "semibold",
"color": "green",
"monoDigits": true
}
]
]
}
]
}
]
}
} How it works
This widget shows the month's spend from two AI providers against a budget. A real endpoint requests each provider's cost report for the month to date and adds the totals. The request needs an admin key, so the key stays on the server. The widget receives only the totals.
One payload serves the small and the medium size. The root is an hstack with "overflow": "drop", and the breakdown is its second child. A small widget has no room for the breakdown, so the phone leaves it out. A medium widget has room, so the phone shows it. The summary has priority: 1, so the breakdown is the child that is dropped. Use the size control above. You can also branch on family. Use overflow when the smaller layout is the larger layout with less content.
The bar is a gauge with a value and a max. The server sends dollars and the phone calculates the fraction. The server changes the tint and the "on pace" line from green to orange when the spend is on course to exceed the budget.
The reset is a timer that counts to the first day of next month, so it stays correct between fetches. This endpoint asks for a refresh every 30 minutes. iOS decides when each fetch happens.
Put it on your Home Screen
We serve this example at the URL below. The server generates the timestamps at the time of each request. Add the URL as a hook in the app, and the widget works on your phone.
https://webhookwidget.com/demo/ai-spend Next
Hello, World!: Checks that the app can reach an endpoint.
All examples