{"id":19771983,"url":"https://github.com/danieldacosta/gpt-pricing-calculator","last_synced_at":"2025-02-28T04:44:13.278Z","repository":{"id":245942183,"uuid":"819616038","full_name":"DanielDaCosta/gpt-pricing-calculator","owner":"DanielDaCosta","description":"Pricing calculator for OpenAI GPT API","archived":false,"fork":false,"pushed_at":"2024-07-18T04:46:48.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T01:10:36.847Z","etag":null,"topics":["gpt","nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielDaCosta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-06-24T21:48:44.000Z","updated_at":"2024-07-18T04:46:51.000Z","dependencies_parsed_at":"2024-07-18T06:56:48.997Z","dependency_job_id":null,"html_url":"https://github.com/DanielDaCosta/gpt-pricing-calculator","commit_stats":null,"previous_names":["danieldacosta/gpt-pricing-calculator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielDaCosta%2Fgpt-pricing-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielDaCosta%2Fgpt-pricing-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielDaCosta%2Fgpt-pricing-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielDaCosta%2Fgpt-pricing-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielDaCosta","download_url":"https://codeload.github.com/DanielDaCosta/gpt-pricing-calculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241101665,"owners_count":19909943,"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":["gpt","nlp"],"created_at":"2024-11-12T05:04:59.868Z","updated_at":"2025-02-28T04:44:13.259Z","avatar_url":"https://github.com/DanielDaCosta.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPT Pricing Calculator\nPricing calculator for OpenAI GPT API\n\n**tiktoken library**\n```\npip install tiktoken\n```\n## Usage\n\n**Example input**\n\n```json\nexample_message = [\n    {\n        \"role\": \"system\",\n        \"content\": \"You are a helpful, pattern-following assistant that translates corporate jargon into plain English.\",\n    },\n    {\n        \"role\": \"system\",\n        \"name\": \"example_user\",\n        \"content\": \"New synergies will help drive top-line growth.\",\n    },\n    {\n        \"role\": \"system\",\n        \"name\": \"example_assistant\",\n        \"content\": \"Things working well together will increase revenue.\",\n    },\n    {\n        \"role\": \"system\",\n        \"name\": \"example_user\",\n        \"content\": \"Let's circle back when we have more bandwidth to touch base on opportunities for increased leverage.\",\n    },\n    {\n        \"role\": \"system\",\n        \"name\": \"example_assistant\",\n        \"content\": \"Let's talk later when we're less busy about how to do better.\",\n    },\n    {\n        \"role\": \"user\",\n        \"content\": \"This late pivot means we don't have time to boil the ocean for the client deliverable.\",\n    },\n]\n```\n\n**Command**\n\nInput Params:\n- `--model_name`: `gpt-4`, `gpt-3.5`...\n- `--file_path`: JSON\n\n```python\npython pricing-calculator.py gpt-4 messages_example.json\n```\n\n**Output**\n```python\nWarning: gpt-4 may update over time. Returning num tokens assuming gpt-4-0613.\n129 prompt tokens counted by count_num_tokens_message().\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldacosta%2Fgpt-pricing-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanieldacosta%2Fgpt-pricing-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldacosta%2Fgpt-pricing-calculator/lists"}