{"id":13793485,"url":"https://github.com/VolkanSah/OpenAI-Cost-Calculator","last_synced_at":"2025-05-12T20:31:03.996Z","repository":{"id":178344306,"uuid":"660964894","full_name":"VolkanSah/OpenAI-Cost-Calculator","owner":"VolkanSah","description":"OpenAI Cost Calculator is a simple tool, implemented in Python and JavaScript, for estimating the cost of using OpenAI's GPT-3 or GPT4 API.","archived":false,"fork":false,"pushed_at":"2024-06-05T17:24:13.000Z","size":667,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T08:45:24.131Z","etag":null,"topics":["calculator","calculator-javascript","calculator-python","chat-gpt","gpt","gpt-3","gpt-4","javascript","openai","python3"],"latest_commit_sha":null,"homepage":"https://github.com/VolkanSah/OpenAI-Cost-Calculator/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VolkanSah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["volkansah"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-07-01T11:08:10.000Z","updated_at":"2024-06-05T17:24:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"b106a71a-5315-4f66-a38d-400194f9afac","html_url":"https://github.com/VolkanSah/OpenAI-Cost-Calculator","commit_stats":null,"previous_names":["volkansah/openai-cost-calculator"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FOpenAI-Cost-Calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FOpenAI-Cost-Calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FOpenAI-Cost-Calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VolkanSah%2FOpenAI-Cost-Calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VolkanSah","download_url":"https://codeload.github.com/VolkanSah/OpenAI-Cost-Calculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253816692,"owners_count":21968867,"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","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":["calculator","calculator-javascript","calculator-python","chat-gpt","gpt","gpt-3","gpt-4","javascript","openai","python3"],"created_at":"2024-08-03T23:00:22.228Z","updated_at":"2025-05-12T20:31:03.347Z","avatar_url":"https://github.com/VolkanSah.png","language":"Python","funding_links":["https://github.com/sponsors/volkansah"],"categories":["❤️ Thank you for your support!"],"sub_categories":["👣 other GPT stuff"],"readme":"# OpenAI Cost Calculator\n![Ai cost calculator](ai-calculator.png)\n###### (update prices/modules 06/2024)\n\nOpenAI Cost Calculator is a simple tool for your projects that allows you to estimate the cost of using OpenAI's GPT-3 API. It includes implementations in both JavaScript and Python. \n\nThe main scripts are `ccp.py` (Python version) and `ccj.js` (JavaScript version), which you can use to calculate the cost of your API usage.\n\n## Requirements\n\n- Node.js and npm (for the JavaScript version)\n- Python 3.x (for the Python version)\n\n## Usage\n### JavaScript\n\n1. Navigate to the `in-javascript` directory.\n2. Install the dependencies with `npm install`.\n3. Run the script with the desired model name and the number of calls. For example:\n\n```shell\nnode ccj.js chatgpt-4k 1000\n```\n### Python\n1. Navigate to the `in-python` directory.\n2. No extra dependencies are needed. Just ensure you're running Python 3.x.\n3. Run the script with the desired model name and the number of calls. For example:\n```shell\npython3 ccp.py chatgpt-4k 1000\n```\n## Price Configuration and Tokens\nThe pricing information for each model is stored in a prices.json file in each directory. It's essential to note that prices can vary, and you should make sure to keep the prices updated according to OpenAI's official pricing.\n\nOne crucial part of understanding the pricing is knowing how OpenAI counts tokens. A \"token\" in OpenAI terms can be as short as one character or as long as one word. For instance, \"ChatGPT is great!\" is encoded into six tokens: [\"Chat\", \"G\", \"PT\", \" is\", \" great\", \"!\"]. In most languages, a single character like \"a\" or a punctuation mark like \".\" is considered one token.\n\n## Please Note\nThis tool is meant to give a rough estimate of how much your usage of the GPT-3 API might cost. However, it's always a good idea to monitor your actual usage through the OpenAI API dashboard to prevent unexpected costs. This tool does not guarantee the exact pricing, as prices may vary, and the token count may differ based on the specifics of your API calls.\n\n## Contributing\nContributions are welcome! Please feel free to submit a pull request.\n\n## Thank you for your support!\nIf you appreciate my work, please consider supporting me:\n\n- Become a Sponsor: [Link to my sponsorship page](https://github.com/sponsors/volkansah)\n- :star: my projects: Starring projects on GitHub helps increase their visibility and can help others find my work.\n- Follow me: Stay updated with my latest projects and releases.\n- \n## License\nThis project is licensed under the \"Help the World Grow [💔](https://jugendamt-deutschland.de) \" License . See the [LICENSE](LICENSE) for more infos!\n\n## Copyright\n[Volkan 'sah' Kücükbudak](https://github.com/volkansah)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVolkanSah%2FOpenAI-Cost-Calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVolkanSah%2FOpenAI-Cost-Calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVolkanSah%2FOpenAI-Cost-Calculator/lists"}