This article marks the beginning of a two-part series. In the first part, we will provide an overview of OpenAI’s pricing structure, and in the second part, we will dive into the specifics of pricing for each of OpenAI’s services.


In this article, we will learn about : 

  • What is OpenAI ?
  • What are tokens ?
  • How OpenAI pricing works ?

OpenAI, a pioneering artificial intelligence research organization, has revolutionized the world of technology with its cutting-edge innovations. Among its many groundbreaking offerings, the OpenAI API stands out as a powerful tool that has the potential to transform industries and streamline processes.

In this article, we will dive into the complexities of OpenAI pricing, providing you with a comprehensive understanding of the cost structure for utilizing this game-changing technology. The pricing is simple yet flexible and are based on a pay-what-you-use basis

Before going further, we need to understand what “token” means,

Tokens :

Tokens are the fundamental units of language that enable computer programs to comprehend and generate text. These units encompass not only complete words but also their constituent parts, including prefixes, suffixes, and even individual characters. When engaging with OpenAI’s services, such as their language models, your usage is quantified based on the number of tokens involved. This includes both the tokens you provide as input and those received in the model’s response. This pricing model is employed because processing more tokens necessitates greater computational resources, impacting the overall cost of utilizing OpenAI’s services.

Token Example:

Let’s illustrate the concept of tokens with a practical example. Suppose you wish to employ an AI language model to answer a question:

Question: “Can you explain artificial intelligence in simple terms?”

Now, we’ll dissect this question into its constituent tokens:

  • “Can” – 1 token
  • “you” – 1 token
  • “explain” – 1 token
  • “artificial” – 1 token
  • “intelligence” – 1 token
  • “in” – 1 token
  • “simple” – 1 token
  • “terms” – 1 token
  • “?” – 1 token (punctuation counts as well)

Thus, your question comprises a total of 9 tokens. Now, you send this question to the AI model, and it generates a response:

Response: “Sure! Artificial intelligence, often called AI, is the field of computer science that focuses on creating systems that can perform tasks that typically require human intelligence, such as understanding language, recognizing patterns, and making decisions.”

Let’s break down the response into tokens:

  • “Sure” – 1 token
  • “!” – 1 token
  • “Artificial” – 1 token
  • “intelligence” – 1 token
  • “,” – 1 token
  • “often” – 1 token
  • “called” – 1 token
  • “AI” – 1 token

And it will carry on in a similar manner. The response consists of a total of 42 tokens.

In this example, we used 9 tokens in our question, and the AI model generated 42 tokens in its response. To calculate the total token usage for this interaction, we should sum these two numbers: 9 (your input) + 42 (model’s output) = 51 tokens. In OpenAI’s pricing model, you would be charged based on the total token count of 51 for this interaction.

Now, let’s understand how pricing works when using a text-based AI like GPT-3.5 Turbo. The cost depends on the amount of text you request from the AI.

  1. Tokens: Tokens serve as the fundamental units of text that the AI employs for comprehension and generation. These tokens can be individual words or even smaller components of words. If your query or request consists of 200 tokens, that’s your starting point.
  2. Max Tokens: This represents the maximum number of tokens you permit the AI to generate in response to your request. For instance, if you ask the AI to generate up to 850 tokens, that’s the limit you set.

Here’s how the pricing calculation unfolds:

– Your input consists of 200 tokens.     – You instruct the AI to generate up to 850 tokens.

The total token usage is calculated as the sum of your input tokens (200 tokens) and the AI-generated tokens (850 tokens), resulting in 1050 tokens.

Pricing is determined by these tokens and the corresponding rates:

– The rate for your input tokens (200 tokens) is $0.0015 per token.

– The rate for the AI-generated tokens (850 tokens) is $0.002 per token.

To calculate the total cost, combine the costs of your input tokens and the AI-generated tokens:

(200 tokens * $0.0015) + (850 tokens * $0.002) = $0.3 + $1.7 = $2.0

It’s important to note that this total cost is divided by 1000 to convert it to dollars, resulting in $0.002.

So, in this example, generating text with 200 input tokens and requesting up to 850 tokens from the AI would incur a cost of $0.002.

One can easily discover token usage, by simply logging in to Open-AI account and accessing the usage tracking dashboard, which displays the number of tokens consumed in current and previous billing cycles.
You can read the second part here: https://racenext.com/2023/09/13/openai-services-and-their-pricing/