Pricing calculation
AiPrice uses different libraries to be able to calculate the token count in a prompt. Our API will then apply the pricing per token per the model to the token count. The pricing can be calculate as such:
pricing = token_count * models_price_per_token[model_name]
Take for example the following prompt:
This train went from east to west in under 30 seconds. Where did the train go?
This prompt contains 18
tokens. If we were to use the gpt-3.5-turbo
model, it will cost us $0.000002
per token.
The calculation will be:
pricing = 18 * 0.000002 # equals $0.000036
Keep in mind that the same model used in a different way may cost differently. For example, using the Babbage
model for training may cost you $0.0000006
per token while using it for usage will cost $0.0000024
per token.
All these calculations are included in our API.