Home / Companies / Vantage / Blog / Post Details
Content Deep Dive

OpenAI Costs Integration: Development Diary

Blog post from Vantage

Post Details
Company
Date Published
Author
Vantage Team
Word Count
1,328
Language
English
Hacker News Points
-
Summary

In a development diary, the Vantage Team describes their experience integrating OpenAI's API to help customers understand their infrastructure bills. They discovered an undocumented API endpoint, /usage, through ChatGPT, which enabled access to usage data, despite initial uncertainty about its validity. The team used Ruby and cURL scripts to simulate OpenAI usage, learning to interpret fields like aggregation_timestamp, n_requests, and n_generated_tokens_total to calculate costs. Although OpenAI's current_usage_usd field remains non-functional, the team managed to approximate costs closely by using regex patterns and summing tokens used. The diary highlights the potential for cost savings and encourages users to explore tracking cloud costs via Vantage's platform.