Usage Dashboard
Real-time spend analysis and analytics
Cost Distribution by Model
Top models by total USD spend
Enter your API key and load balance to view distribution chart.
Token Category Costs
Distribution of input (cached/uncached) vs output
Enter your API key and load balance to view category breakdown.
Daily Spend Trend
Day-by-day cost tracking over the selected range
Daily trend will load automatically when you query your usage.
| Model Name | Input (cached) | Input (uncached) | Output | Total Spend |
|---|---|---|---|---|
|
No data loaded. Enter your API Key above and click Refresh. |
||||
Credentials Configuration
Configure API credentials and storage preferences
Connection & Proxy Settings
Workaround CORS errors and secure your requests
Deployment & Hosting Guide
Learn how to run this billing dashboard locally or host it for free on Cloudflare Pages or GitHub Pages.
Option A: Hosting on Cloudflare Pages (Recommended)
Cloudflare Pages supports serverless Functions. By deploying this codebase to Cloudflare Pages, your API key calls are automatically routed through Cloudflare's server-side worker, bypassing browser CORS issues natively.
- Commit this folder to a GitHub repository (e.g.
fireworks-balance-check). - Go to the Cloudflare Dashboard and navigate to Workers & Pages > Create application > Pages.
- Connect your GitHub account and select your repository.
- Leave Build settings blank. The build system will deploy the folder automatically as a static site and compile the
functions/apifolder. - Deploy! Your app will be live on
https://<your-project>.pages.devwith zero CORS blocks.
Option B: Hosting on GitHub Pages (with CORS Proxy)
GitHub Pages hosts static files. Calling the Fireworks API directly from the browser will fail due to CORS. To make it work, you can set up a free Cloudflare Worker as a proxy.
Step 1: Set up the Cloudflare Worker
- Log in to your Cloudflare Dashboard and click Workers & Pages > Create application > Create Worker.
- Name your worker (e.g.,
fireworks-cors-proxy) and click Deploy. - Click Edit Code and paste the following CORS proxy script:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
// Extract accountId, apiKey, etc. from headers or query parameters
const targetUrl = url.searchParams.get('url')
if (!targetUrl) {
return new Response('Missing url parameter', { status: 400 })
}
// Handle preflight CORS request
if (request.method === 'OPTIONS') {
return new Response(null, {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization, x-api-key',
}
})
}
// Forward the request to Fireworks.ai
const response = await fetch(targetUrl, {
method: request.method,
headers: request.headers,
body: request.body
})
// Return response with CORS headers
const corsHeaders = new Headers(response.headers)
corsHeaders.set('Access-Control-Allow-Origin', '*')
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: corsHeaders
})
}
Step 2: Configure your Dashboard Settings
- Once deployed, copy your worker URL (e.g.,
https://fireworks-cors-proxy.yourname.workers.dev/). - Open your GitHub Pages dashboard site.
- Go to Settings tab, toggle **Custom CORS Proxy**, and paste your worker URL there.
CLI Usage (check_balance.py)
You can also use the terminal tool we built in this folder to check your balance quickly without opening a browser.
# Install dependencies
pip install requests
# Set environment variables (optional, to avoid prompt)
$env:FIREWORKS_API_KEY="your_api_key_here"
$env:FIREWORKS_ACCOUNT_ID="your_account_id"
# Run the script
python check_balance.py --days 30