{"id":23934011,"url":"https://github.com/tipani86/OpenAI-Tools","last_synced_at":"2025-09-11T16:33:31.077Z","repository":{"id":182185574,"uuid":"668082637","full_name":"tipani86/OpenAI-Tools","owner":"tipani86","description":"Toolkit to get the most out of your OpenAI Account","archived":false,"fork":false,"pushed_at":"2025-06-20T06:51:51.000Z","size":273,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-01T07:56:53.639Z","etag":null,"topics":["admin","admin-dashboard","api","chatgpt","llm","openai","streamlit","tokens","usage"],"latest_commit_sha":null,"homepage":"https://openai-tools.streamlit.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tipani86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-19T01:50:29.000Z","updated_at":"2025-07-03T21:24:45.000Z","dependencies_parsed_at":"2025-08-02T18:02:17.677Z","dependency_job_id":null,"html_url":"https://github.com/tipani86/OpenAI-Tools","commit_stats":null,"previous_names":["tipani86/openai-tools"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tipani86/OpenAI-Tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tipani86%2FOpenAI-Tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tipani86%2FOpenAI-Tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tipani86%2FOpenAI-Tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tipani86%2FOpenAI-Tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tipani86","download_url":"https://codeload.github.com/tipani86/OpenAI-Tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tipani86%2FOpenAI-Tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274670561,"owners_count":25328263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin","admin-dashboard","api","chatgpt","llm","openai","streamlit","tokens","usage"],"created_at":"2025-01-06T00:30:02.731Z","updated_at":"2025-09-11T16:33:31.067Z","avatar_url":"https://github.com/tipani86.png","language":"Python","readme":"# OpenAI Usage API Dashboard\n\nA powerful Streamlit application for fetching, analyzing, and exporting usage data from OpenAI's comprehensive Usage API across all available endpoints.\n\n## 🚀 What This App Does\n\nThis dashboard provides a unified interface to query OpenAI's Usage API endpoints and generate comprehensive usage reports. It fetches data from multiple usage endpoints simultaneously, enriches the data with human-readable names, and exports everything to CSV for further analysis.\n\n### Supported Usage Endpoints\n\n- **Completions** - Text generation usage (input/output tokens, cached tokens, audio tokens)\n- **Embeddings** - Text embedding usage \n- **Moderations** - Content moderation usage\n- **Images** - Image generation/editing usage\n- **Audio Speeches** - Text-to-speech usage\n- **Audio Transcriptions** - Speech-to-text usage  \n- **Vector Stores** - Vector storage usage\n- **Code Interpreter Sessions** - Code execution session usage\n\n## ✨ Key Features\n\n- **Async Processing**: Fetches data from multiple endpoints simultaneously with real-time progress tracking\n- **Smart Caching**: Uses LRU cache to avoid redundant API calls and improve performance\n- **Data Enrichment**: Automatically looks up and adds human-readable names for users, projects, and API keys\n- **Flexible Date Ranges**: Select any date range for usage analysis\n- **Endpoint Selection**: Choose which usage endpoints to query\n- **Column Reordering**: Presents data in a logical, analysis-friendly column order\n- **CSV Export**: Download complete usage data for further analysis\n- **Session Persistence**: Maintains API client and cache across app refreshes\n\n## 🛠️ Installation \u0026 Setup\n\n### Prerequisites\n\n- Python 3.8+\n- OpenAI Admin API Key\n\n### Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### Environment Setup (Optional)\n\nSet your OpenAI Admin API key as an environment variable:\n\n```bash\nexport OPENAI_ADMIN_KEY=\"sk-admin-your-key-here\"\n```\n\nOr create a `devenv.sh` file:\n```bash\nOPENAI_ADMIN_KEY=\"sk-admin-your-key-here\"\nsource devenv.sh\n```\n\n## 🎯 How to Use\n\n### 1. Start the Application\n\n```bash\nstreamlit run app.py\n```\n\n### 2. Configure Your API Key\n\n- If you set the `OPENAI_ADMIN_KEY` environment variable, it will be pre-populated\n- Otherwise, enter your OpenAI Admin API key in the sidebar\n\n### 3. Select Your Query Parameters\n\n- **Date Range**: Choose start and end dates (treated as UTC)\n- **Usage Endpoints**: Select which usage types to fetch (all selected by default)\n\n### 4. Fetch Data\n\nClick \"Fetch Usage Data\" to:\n- Query selected endpoints asynchronously\n- Fetch lookup data for users, projects, and API keys\n- Process and enrich the data\n- Display results with progress tracking\n\n### 5. Analyze and Export\n\n- Review the data in the interactive table\n- Download as CSV for further analysis in Excel, Google Sheets, or other tools\n\n## 📊 Data Output\n\nThe final dataset includes:\n\n### Core Usage Data\n- Date, endpoint type, token counts, model requests\n- Input/output tokens, cached tokens, audio tokens\n- Model names, batch status\n\n### Enriched Information  \n- **User Details**: User ID → Email address\n- **Project Details**: Project ID → Project name\n- **API Key Details**: API Key ID → API key name\n\n### Column Order\nData is presented with the most important columns first: date, endpoint_type, input_tokens, output_tokens, api_key_id, api_key_name, project_id, project_name, and other relevant metrics.\n\n## 🔧 Advanced Features\n\n### Cache Management\n- Use the \"Clear All Cache\" button in the sidebar to reset cached data\n- Cache persists across app refreshes for improved performance\n- View cache statistics when `LOGURU_LEVEL=DEBUG` is set\n\n### Special Endpoint Handling\n- Vector stores and code interpreter sessions are automatically configured with appropriate grouping parameters\n- All other endpoints group by user_id, project_id, api_key_id, and model for maximum granularity\n\n## 🚨 Requirements\n\n- Valid OpenAI Admin API key with usage access\n- Network access to OpenAI's API endpoints\n- Python packages listed in `requirements.txt`\n\n## 📝 Notes\n\n- Dates are treated as UTC when converting to timestamps\n- The app handles pagination automatically across all endpoints\n- Empty results are handled gracefully with appropriate user feedback\n- All errors are captured and displayed with detailed tracebacks\n\n## 🤝 Usage Tips\n\n- Run similar queries multiple times to benefit from caching\n- Use the debug mode to monitor cache performance\n- Select specific endpoints if you only need certain usage types\n- Export data regularly for historical analysis and reporting\n\n---\n\nBuilt with ❤️ using Streamlit, httpx, and async processing for optimal performance.","funding_links":[],"categories":["Building"],"sub_categories":["Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftipani86%2FOpenAI-Tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftipani86%2FOpenAI-Tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftipani86%2FOpenAI-Tools/lists"}