Usage Dashboard

Real-time spend analysis and analytics

Date Range:
Total Spend
$0.00
No data loaded
Top Spent Model
No usage recorded
Unique Models
0
Across selected time window
Remaining Balance
Set credits in settings to track

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

Your API key is stored locally in your browser's localStorage and is only sent to the Fireworks API.
Leave blank to auto-detect accounts associated with your key.
Enter your prepaid credits to automatically calculate remaining balance.

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.

  1. Commit this folder to a GitHub repository (e.g. fireworks-balance-check).
  2. Go to the Cloudflare Dashboard and navigate to Workers & Pages > Create application > Pages.
  3. Connect your GitHub account and select your repository.
  4. Leave Build settings blank. The build system will deploy the folder automatically as a static site and compile the functions/api folder.
  5. Deploy! Your app will be live on https://<your-project>.pages.dev with 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

  1. Log in to your Cloudflare Dashboard and click Workers & Pages > Create application > Create Worker.
  2. Name your worker (e.g., fireworks-cors-proxy) and click Deploy.
  3. 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

  1. Once deployed, copy your worker URL (e.g., https://fireworks-cors-proxy.yourname.workers.dev/).
  2. Open your GitHub Pages dashboard site.
  3. 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