Hi @ymcymc ,
Welcome to the community! Fetching project or organization cost and usage details is a common need when working with the OpenAI API. While there isn’t a direct API endpoint to retrieve this data programmatically, here are some resources and approaches that can help:
Steps and Resources:
- Check Usage Dashboard:
OpenAI provides a usage dashboard where you can manually view your cost and usage details:
Understanding the Usage Dashboard.
- Existing Discussions:
These threads from the community provide tips and ideas for tracking usage via API keys or organization-level data:
• Get Data from Usage by API Key
• How to Track API Usage and Cost by API Key
• How Can I Check OpenAI Usage with Python
- Manual Tracking:
• If you are using multiple API keys, you can track usage by logging calls from your app, associating them with respective API keys, and calculating costs based on the pricing model in OpenAI’s documentation.
- Python and Scripts:
• You can script usage tracking by integrating with the OpenAI API logs or combining custom tracking with API key usage in your application.
Recommendations:
If you’d like to see this feature added to the API, you can submit a feature request via OpenAI’s support or share the idea in the community forums.
Let me know if you need additional help or examples!