Track LLM API Costs with genai-prices
Tip: Use the genai-prices Python library to calculate the estimated cost of calling LLM inference APIs. This avoids maintaining your own pricing table and lets you report token counts and cost for each request.
Below is an example:
# Install: uv add openai genai-prices
from openai import OpenAI
from