A powerful Scriptable widget for iOS that displays your API usage statistics in real-time. Monitor your balance, spending, and model usage directly from your home screen.
Author: Fantasy Date: 2025-11-19
- Display your current account balance and remaining quota
- Track daily, weekly, and monthly API usage
- Monitor request counts and token consumption
- View spending statistics for each period
The widget supports multiple sizes to fit your home screen layout:
Compact view showing balance, usage progress, and key metrics
Balanced layout with usage bars and model distribution chart
Full-featured view with detailed statistics and 30-day chart
Automatically adapts to your system appearance settings
- Progress Bars: Visual representation of remaining balance and daily usage
- Usage Indicators: AVG and MAX labels showing average and maximum usage
- Model Distribution: Bar charts showing which AI models are being used most
- Range Indicators: Visual range display of model usage patterns
Track usage across multiple AI models including:
- OpenAI (GPT-5, GPT-5.1)
- Anthropic (Claude Haiku, Sonnet, Opus)
- Google (Gemini Flash, Pro)
- And more...
- Open Scriptable App on your iOS device
- Create a New Script and copy the entire content of
Packy Usage.js - Configure Your Credentials:
- Obtain your
USER_IDandSESSIONfrom the Packy API - Update the
CONFIGobject:const CONFIG = { API_BASE_URL: "https://www.packyapi.com", USER_ID: "your_user_id", SESSION: "your_session_token", UNIT: 500000, DAYS_TO_FETCH: 30, };
- Obtain your
- Add to Home Screen:
- Long press on your home screen
- Tap "+" to add a widget
- Search for "Scriptable"
- Choose your desired size (Small, Medium, or Large)
- Select the script you created
- Tap "Add Widget"
Best for: Quick glance at your balance Shows:
- Current balance
- Remaining quota vs used quota
- Today's spending
- This week's tokens used
- Current request count
Best for: Balanced information display Shows:
- Left side: Balance, usage metrics, and info
- Right side: User name, model legend, weekly chart
- Compact but comprehensive view
Best for: In-depth analytics Shows:
- Top section: Balance and user info
- Middle: Total spending, tokens, and requests
- Most used model with range indicator
- Bottom: Model breakdown and 30-day chart
The widget displays two progress bars:
-
Remaining Bar (Top)
- Shows your available balance vs used amount
- Color indicates health status:
- 🟢 Green: Healthy (>20% remaining)
- 🟡 Yellow: Warning (10-20% remaining)
- 🔴 Red: Critical (<10% remaining)
-
Usage Bar (Bottom)
- Shows today's usage compared to maximum
- • AVG: Average daily usage marker
- MAX •: Maximum usage reached marker
- Labels hide if there's insufficient space
The widget fetches fresh data each time you interact with it. Data includes:
- Last 30 days of API usage
- Daily breakdown by model
- Total usage statistics
- Current balance information
- ColorManager: Handles all color theming and model-specific colors
- DataFetcher: Retrieves API data from Packy servers
- DataProcessor: Processes raw data into usable statistics
- ChartRenderer: Creates charts and visualizations
- UIComponents: Builds widget UI elements
- BaseWidget: Foundation for all widget sizes
- WidgetFactory: Creates appropriate widget based on size
- DrawContext: For precise pixel-level graphics rendering
- ListWidget: Scriptable's layout system
- Dynamic Colors: Automatic dark/light mode support
You can customize various aspects of the widget:
const UI_CONSTANTS = {
WIDGET_CORNER_RADIUS: 12, // Border radius
GAUGE_SPACING: 12, // Space between elements
THRESHOLDS: { GOOD: 20, WARNING: 10 }, // Alert thresholds
};- Verify your
USER_IDandSESSIONare correct - Check your internet connection
- Ensure you're using the latest version of Scriptable
- Refresh the widget by tapping it
- Check that the API is responding
- Review your credentials in CONFIG
- This is intentional - labels hide when space is insufficient
- Ensure your widget size is appropriate for your screen
| Element | Light Mode | Dark Mode |
|---|---|---|
| Text | #000000 | #FFFFFF |
| Secondary | #8E8E93 | #636366 |
| Background | #F2F2F7 | #1C1C1E |
| Progress Bar | #5E5CE6 | #5E5CE6 |
This widget is created for personal use. Feel free to modify and adapt it to your needs.
For issues or questions:
- Check the Packy API documentation
- Verify your credentials are correct
- Ensure Scriptable has necessary permissions
- Review the console logs in Scriptable for errors
Happy tracking! 📊