Skip to Content
Getting StartedInstallation

Installation

Complete installation guide for all supported languages and frameworks.

Prerequisites

Before you begin, make sure you have:

  1. An OpenAI or Anthropic API key
  2. A project using OpenAI or Anthropic APIs
  3. 5 minutes to complete setup

Step 1: Create Your Account

Sign Up

Go to app.aispendtrack.com  and create an account.

Sign up options:

  • Google - One-click sign up
  • Email - Traditional email/password

Get Your API Key

After signing up:

  1. Click your profile icon (top right)
  2. Navigate to Settings
  3. Copy your AiSpendTrack API Key

Your key will look like: ask_abc123def456...

Keep this key secret! Don’t commit it to version control.

Store Your Key Securely

Add to your .env file:

AISPENDTRACK_API_KEY=ask_your_key_here

Add .env to your .gitignore:

.env .env.local

Step 2: Update Your Code

Choose your language/framework:

Node.js / TypeScript

Install SDK:

npm install openai @anthropic-ai/sdk

For OpenAI:

import OpenAI from 'openai'; const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, baseURL: "https://proxy.aispendtrack.com/v1", defaultHeaders: { "x-aispendtrack-key": process.env.AISPENDTRACK_API_KEY } });

For Anthropic:

import Anthropic from '@anthropic-ai/sdk'; const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, baseURL: "https://proxy.aispendtrack.com/anthropic/v1", defaultHeaders: { "x-aispendtrack-key": process.env.AISPENDTRACK_API_KEY } });

Step 3: Test Your Setup

Make a test API call:

const completion = await openai.chat.completions.create({ model: "gpt-3.5-turbo", messages: [ { role: "user", content: "Say 'AiSpendTrack is working!'" } ] }); console.log(completion.choices[0].message.content);

Step 4: Verify in Dashboard

  1. Run your test code
  2. Go to app.aispendtrack.com 
  3. Refresh the page
  4. You should see the API call appear within 10 seconds!

Success! You’re now tracking your AI costs in real-time.

Troubleshooting

Not seeing calls in dashboard?

  1. Wait 10-15 seconds - Logging is asynchronous
  2. Check your API key - Make sure it starts with ask_
  3. Verify the baseURL - Must be exactly as shown above
  4. Check console for errors - Look for 401/429 status codes

Getting 401 Unauthorized?

Your AiSpendTrack API key is invalid or missing.

  • Check the header name: x-aispendtrack-key (all lowercase)
  • Check the value: Copy fresh from Settings page
  • Check it’s in environment variables, not hardcoded

Getting 429 Rate Limit?

You’ve hit your monthly limit (10,000 calls for free tier).

Options:

  1. Wait until next month (resets on 1st)
  2. Upgrade to Pro  for unlimited

Still stuck?

Next Steps

Last updated on