├── LICENSE ├── README.md └── index.html /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 rUv 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GPT API Cost Estimation for Enterprises 2 | 3 | _By rUv, CTO Generative AI, EY Americas 4 | 5 | ## HTML OpenAi Cost Estimator 6 | https://ruvnet.github.io/openai-cost-estimator 7 | 8 | ## Purpose 9 | 10 | This document aims to provide a structured approach to estimating the costs associated with using OpenAI's GPT models in an enterprise setting. It covers various factors and formulas to offer a comprehensive view of potential costs. 11 | 12 | ### Understanding Token Costs 13 | 14 | The primary driver for costs in OpenAI deployments is token usage. Tokens can be as short as one character or as long as one word. Costs are incurred for both input and output tokens. 15 | 16 | **Formula:** 17 | 18 | ``` 19 | Total Token Cost = (Input Tokens + Output Tokens) x Cost per Token 20 | ``` 21 | --- 22 | 23 | ### Deployment Costs 24 | 25 | Deploying the GPT-4 API, for instance, involves costs based on the number of requests and the tokens per request. 26 | 27 | **Formula:** 28 | 29 | ``` 30 | Deployment Cost = Requests per Day x Days per Month x (Average Input Tokens per Request + Average Output Tokens per Request) x Cost per Token 31 | ``` 32 | 33 | --- 34 | 35 | ### Fine-tuning Costs (GPT-3.5 Only) 36 | 37 | Fine-tuning GPT-3.5 with your specific data involves a one-time training cost and ongoing usage costs for input/output tokens. 38 | 39 | **Formula:** 40 | ``` 41 | Training Cost = Dataset Size x Training Epochs x Cost per Token for Training 42 | ``` 43 | ``` 44 | Monthly Usage Cost = (Daily Input Tokens + Daily Output Tokens) x Days of Operation per Month x Cost per Token for Usage 45 | ``` 46 | 47 | --- 48 | 49 | ### Ongoing Interaction Costs 50 | 51 | For applications requiring continuous interaction with the GPT API (intelligent agents, etc.), the frequency of interaction and average tokens per interaction should be estimated. 52 | 53 | **Formula:** 54 | 55 | ``` 56 | Ongoing Interaction Cost = Number of Applications x Frequency of Interaction x Average Tokens per Interaction x Cost per Token 57 | ``` 58 | 59 | --- 60 | 61 | ### Additional Considerations 62 | 63 | - Be aware of the assumptions you make, such as average token count, as actual usage may vary. 64 | - Consider the context size (8K or 32K) when deploying GPT-4 as it impacts the cost per token. 65 | - Account for any potential increase in usage over time. 66 | 67 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GPT-4 API Cost Estimation 5 | 6 | 12 | 13 | 75 | 141 | 142 | 143 |

GPT-4 API Cost Estimation

144 |
145 | 146 | Select Model: 147 |
152 | Cost per 1K Tokens (Input):
153 | Cost per 1K Tokens (Output):
154 |
155 | 156 |
157 | 158 | 159 | 160 |
161 | 162 |
163 |

Understanding Token Costs

164 |
165 | Input Tokens:
166 | Output Tokens:
167 | Cost per Token:
168 |

Total Token Cost: $0.00

169 |
170 |
171 | 172 |
173 |

Deployment Costs

174 |
175 | Requests per Day:
176 | Days per Month:
177 | Average Input Tokens per Request:
178 | Average Output Tokens per Request:
179 |

Deployment Cost: $0.00

180 |
181 |
182 | 183 |
184 |

Fine-tuning Costs

185 |
186 |

Only GPT-3.5 Turbo supports fine-tuning

187 | Dataset Size:
188 | Training Epochs:
189 | Cost per Token for Training:
190 | Daily Input Tokens:
191 | Daily Output Tokens:
192 | Days of Operation per Month:
193 | Cost per Token for Usage:
194 |

Training Cost: $0.00, Monthly Usage Cost: $0.00

195 |
196 |
197 |
198 |
GitHub Repo
199 | 203 | 204 | 205 | --------------------------------------------------------------------------------