Skip to content

Instantly share code, notes, and snippets.

View shivaalroy's full-sized avatar

Shivaal Roy shivaalroy

View GitHub Profile
@shivaalroy
shivaalroy / openai_usage_tool.py
Last active November 27, 2024 13:40
Get OpenAI Usage / Spend information programmatically, broken down by API key, model, input and output
import argparse
from datetime import date, timedelta
from typing import TypedDict
import requests
from tabulate import tabulate
class OpenAiUsageTool:
'''