spending-analysis

0
0
Source

Analyze Pollinations revenue, pack purchases, and tier spending patterns. Query Polar for payment history and Tinybird for usage data.

Install

mkdir -p .claude/skills/spending-analysis && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5257" && unzip -o skill.zip -d .claude/skills/spending-analysis && rm skill.zip

Installs to .claude/skills/spending-analysis

About this skill

Requirements

Before using this skill, ensure you have:

  • curl: For API requests
  • jq: brew install jq (for parsing JSON)
  • sops: brew install sops (for decrypting secrets)

Must run from the pollinations repo root with access to enter.pollinations.ai/.


Data Sources

Polar API

  • Orders: Payment history for pack purchases
  • Products: Tier subscriptions and pollen packs
  • Customers: User payment info linked by external_id

Tinybird

  • generation_event: Usage data with user_tier, total_price, user_id
  • Tracks all API requests with pricing and tier info

Quick Commands

Get Polar Access Token

# From sops-encrypted secrets
export POLAR_ACCESS_TOKEN=$(sops -d enter.pollinations.ai/secrets/prod.vars.json | jq -r '.POLAR_ACCESS_TOKEN')

# Or from .testingtokens (if available)
export POLAR_ACCESS_TOKEN=$(grep POLAR_ACCESS_TOKEN enter.pollinations.ai/.testingtokens | cut -d= -f2)

Get Tinybird Token

export TINYBIRD_TOKEN=$(sops -d apps/operation/kpi/secrets/env.json | jq -r '.TINYBIRD_TOKEN')

Polar API Queries

List Products (Tiers & Packs)

curl -sL "https://api.polar.sh/v1/products" \
  -H "Authorization: Bearer $POLAR_ACCESS_TOKEN" | jq '[.items[] | {name, id, recurring: .is_recurring}]'

Get Pack Purchases (Last 100)

# 5 pollen pack product ID
PRODUCT_ID="bcdde7f7-129e-4ec1-abc3-d4e0c852fa68"

curl -sL "https://api.polar.sh/v1/orders?limit=100&product_id=$PRODUCT_ID" \
  -H "Authorization: Bearer $POLAR_ACCESS_TOKEN" | \
  jq '[.items[] | {date: .created_at[0:10], amount: (.total_amount / 100), customer: .customer.email}]'

All Pack Product IDs

PackProduct ID
5 pollen + 5 FREEbcdde7f7-129e-4ec1-abc3-d4e0c852fa68
10 pollen + 10 FREEcebeb680-4ac3-4f73-9ce7-6bc06a5f21e1
20 pollen + 20 FREE8164c20f-8429-437e-b1a2-616ae89f114e
50 pollen + 50 FREE2cb5ca34-d505-450d-a1d4-94e3bb0c1f68
10 pollen (pack)ca4cc8bc-694d-4710-8451-1dcb4979fbc7
20 pollen (pack)679a9fd3-be30-4552-8b2e-f825103c42b7
50 pollen (pack)bf48ded2-19ca-4d28-bca9-a91fff2dd0a0

Weekly Revenue from All Packs

.claude/skills/spending-analysis/scripts/weekly-pack-revenue.sh

Tinybird Queries

User Count by Tier

curl -sL "https://api.europe-west2.gcp.tinybird.co/v0/sql" \
  -H "Authorization: Bearer $TINYBIRD_TOKEN" \
  --data-urlencode "q=SELECT argMax(user_tier, start_time) as tier, count() as users FROM generation_event WHERE start_time >= now() - INTERVAL 60 DAY AND environment = 'production' AND user_id != 'undefined' GROUP BY user_id FORMAT JSON" | \
  jq '.data | group_by(.tier) | map({tier: .[0].tier, users: length})'

Weekly Spending by Tier

curl -sL "https://api.europe-west2.gcp.tinybird.co/v0/sql" \
  -H "Authorization: Bearer $TINYBIRD_TOKEN" \
  --data-urlencode "q=SELECT toStartOfWeek(start_time) as week, user_tier, sum(total_price) as total_spend, count() as requests FROM generation_event WHERE start_time >= now() - INTERVAL 60 DAY AND environment = 'production' GROUP BY week, user_tier ORDER BY week DESC FORMAT JSON" | jq '.data'

Analysis Scripts

Weekly Pack Revenue

.claude/skills/spending-analysis/scripts/weekly-pack-revenue.sh

Shows weekly breakdown of actual pack purchases (real revenue, not free tier usage).

Pack Purchases by Tier

.claude/skills/spending-analysis/scripts/pack-purchases-by-tier.sh

Cross-references Polar pack purchasers with Tinybird tier data to show which tiers buy most pollen proportionally.


Key Findings (Jan 2026 Analysis)

Pack Purchases by Tier (Weighted by User Count)

TierRevenuePurchasersTotal Users% Who Buy$/User
nectar$146102343.5%$6.37
flower$564182188.3%$2.59
seed$1,173385756.6%$2.04
spore$1,6571066,7571.6%$0.25

Key Insight: Higher tiers buy MORE pollen proportionally, not less.

Revenue Trend (9 Weeks)

WeekOrdersRevenue
Jan 13-1951$573
Jan 6-1283$928
Dec 30-Jan 559$928
Dec 23-2921$432
Dec 16-2222$276
Dec 9-1516$141
Dec 2-817$293
Nov 25-Dec 110$293
Nov 18-241$10

Notes

  • Free tier spending in Tinybird includes tier pollen allocation - not real revenue
  • Pack purchases in Polar are actual paid revenue
  • Cross-reference by external_id (Polar) = user_id (Tinybird)
  • Polar API returns 307 redirects - use curl -sL to follow

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.