How AI Providers are Calculating charges
Who are AI Providers?
"AI Providers" is a broad term encompassing a wide range of entities involved in the development, deployment, and maintenance of artificial intelligence technologies.
Tech Gaints Like Google, Amazon, Meta have their own AI and few open source and researches like OpenAI provide a AI capabilites.
Lets have a look at how these AI Providers charge
OpenAI
OpenAI combines the total tokens used for both requests (prompts) and responses to calculate the overall cost.
What is a token?
Tokens are the basic unit that OpenAI models (GPT Models) use to compute the length of a text. They are groups of characters, which sometimes align with words, but not always. In particular, it depends on the number of characters and includes punctuation signs or emojis.
Please go through the official OpenAI Tokenizer tool here https://platform.openai.com/tokenizer
Models and costs
There are many Models present in OpenAI few are GPT Models (3.5, 4)
These models will have different costs for requests (prompts) and responses (output).
Example: The Selected OpenAI model is gpt-4-32k
gpt-4-32k Input cost/1000 tokens is $0.06
gpt-4-32k output cost/1000 tokens is $0.12
The total cost is 0.06 + 0.12 = $0.18
Google (Gemini)
Google's generative AI charges every 1,000 characters of input (prompt) and every 1,000 characters of output (response).
Characters are counted by UTF-8 code points and white space is excluded from the count. At the end of each billing cycle, fractions of one cent ($0.01) are rounded to one cent.
Models and Costs
Similar to OpenAI, Google Also provides many models in their generative AI capabilities Text Bison, Text Bison 32k, and the Latest Gemini Pro.
These models will have different costs for requests (prompts) and responses (output).
Example: The selected Model is PaLM Text Bison
Input cost:
200 input characters x 5 prompts = 1,000 total input characters;
1,000 total input characters x ($0.00025 / 1000) = $0.00025 input cost.
Output cost:
400 output characters x 5 prompts = 2,000 total output characters;
2,000 total output characters x ($0.0005 / 1000) = $0.001 output cost.
Total: $0.00025 input cost + $0.001 output cost = $0.00125 total cost.
For more details and updated pricing of these models, please have a look at the pricing page https://cloud.google.com/vertex-ai/docs/generative-ai/pricing
Mistral
Mistral, works in a Pay as you go model, we would require to pay only for the usage we made. The Mistral calculation is based on 1 Million tokens
Models and Costs
Mistral provides many models in their generative AI capabilities
These models will have different costs for requests (prompts) and responses (output).Example: The selected Model is mistral-small
Input cost:
200 input tokens x 5 prompts = 1,000 total input tokens;
1000 input tokens, input cost on this model is $2/1M tokens,
2 * (1000 / 1000000) = $0.002 input Cost
Output cost:
400 output characters x 5 prompts = 2,000 total output characters;
2000 output tokens, output cost on this model is $6/1M tokens,
6 * (2000/ 1000000) = $0.012 output Cost
Total = input cost + output cost
Total = $0.002 + $0.012 = $0.014
For more details and updated pricing of these models, please have a look at the pricing page https://mistral.ai/technology/#pricing
Anthropic - Claude
Anthropic - Claude, is another famous AI provider with multiple models. The Anthropic calculation is based on 1 Million tokens
Anthropic provides many models in their generative AI capabilities
These models will have different costs for requests (prompts) and responses (output).Example: The selected Model is Claude 3 Opus
Input cost:
200 input tokens x 5 prompts = 1,000 total input tokens;
1000 input tokens, input cost on this model is $12/1M tokens,
15 * (1000 / 1000000) = $0.015 input Cost
Output cost:
400 output characters x 5 prompts = 2,000 total output characters;
2000 output tokens, output cost on this model is $75/1M tokens,
75 * (2000/ 1000000) = $0.15 output Cost
Total = input cost + output cost
Total = $0.015 + $0.15 = $0.164
For more details and updated pricing of these models, please have a look at the pricing page https://docs.anthropic.com/claude/docs/models-overview#model-comparison