OpenAI API Cost Calculator (GPT-3.5 Turbo & GPT-4)

Select the base language model:

Input Tokens Cost: $0

Output Tokens Cost: $0

Estimated Price: $0

Welcome to Our OpenAI API Pricing Calculators

The OpenAI calculators have been designed to offer users a seamless experience when estimating the cost implications of integrating OpenAI models into their systems or applications.

 This documentation provides a step-by-step guide on how to navigate and utilize these calculators.

How Our Calculator Helps:

  1. Dynamic Pricing Overview: Instead of manually calculating costs by referring to the pricing table each time, our calculator provides instantaneous results based on your input and expected output tokens.

  2. Model Comparison: You can easily compare the costs between different models and contexts, allowing for a quick understanding of the most cost-effective choice for your needs.

  3. Accuracy: By using the calculator, users can avoid potential mistakes in manual calculations, ensuring accurate estimations every time.

  4. Input and Output Costs: The calculator breaks down the costs for both input and output tokens, giving users a clear understanding of where their expenses come from.

  5. Future Budgeting: With predictable results, businesses can use our calculator for budgetary planning, ensuring they allocate appropriate funds to their AI operations.

How OpenAI Charges for Language Models:

OpenAI charges for the usage of their language models based on a token system. A token can be thought of as a piece of a word. Typically, 1,000 tokens equate to about 750 words.

 To give a clear perspective, the introductory paragraph provided is only 35 tokens long. It’s crucial to understand that both input (what you send to the model) and output (what the model responds with) tokens are counted when determining the total cost.

What are Tokens?

In the context of language models like GPT-3 and GPT-4, a token can be considered as a piece of a word or sometimes an entire word itself. For instance, the word “a” is a token, but longer words like “calculator” might be split into multiple tokens like “calc”, “ul”, “ator”. This tokenization enables the model to process and understand text efficiently. 

why not see them in action? Use our user-friendly tokenizer tool to break down and visualize your text into individual tokens. It’s a great way to get a hands-on understanding and ensure you’re efficiently managing your interactions with OpenAI’s API.

Understanding the Cost Calculation for Chat Completions:

When it comes to figuring out the charges for chat completion requests, it all boils down to the count of input tokens you send, plus the tokens that make up the output returned by the API.

Let’s break it down: The total number of tokens for which you’ll be billed is the sum of the tokens in your input and the tokens in the output. The output token count depends on your request settings, including the max_tokens and the number of completions you ask for (whether you’re using the best_of or n parameters). The charges for these tokens are based on the specific engine’s rate mentioned earlier.

To give you a clearer picture: Imagine you’re using the gpt-3.5-turbo-1106 API for a request. Your prompt is 200 tokens long, and you’re asking for a single completion that’s 900 tokens. Your total token count here is 1,100. The cost for this would be [(200 * $0.001) + (900 * $0.002)] / 1,000, which works out to $0.002.

If you’re looking to keep your costs in check, consider shortening your prompts or the maximum length of the responses. You might also want to think about how often you use best_of/n options, include effective stop sequences, or opt for engines that have lower costs per token.

OpenAI Model Pricing Update Announced on DevDay:

GPT-4 Turbo: With 128k context, fresher knowledge, and the broadest set of capabilities, GPT-4 Turbo is more powerful than GPT-4 and offered at a lower price.

  • gpt-4-1106-preview: $0.01 per 1,000 tokens (input), $0.03 per 1,000 tokens (output)
  • gpt-4-1106-vision-preview: $0.01 per 1,000 tokens (input), $0.03 per 1,000 tokens (output)

GPT-4: Known for broad general knowledge and domain expertise, GPT-4 can follow complex instructions in natural language and solve difficult problems with accuracy.

  • gpt-4: $0.03 per 1,000 tokens (input), $0.06 per 1,000 tokens (output)
  • gpt-4-32k: $0.06 per 1,000 tokens (input), $0.12 per 1,000 tokens (output)

GPT-3.5 Turbo: GPT-3.5 Turbo models are capable and cost-effective.

  • gpt-3.5-turbo-1106: $0.0010 per 1,000 tokens (input), $0.0020 per 1,000 tokens (output)
  • gpt-3.5-turbo-instruct: $0.0015 per 1,000 tokens (input), $0.0020 per 1,000 tokens (output)

Assistants API:

  • Code interpreter: $0.03 per session (free until 12/1/2023)
  • Retrieval: $0.20 per GB per assistant per day

Fine-tuning models: Create your own custom models by fine-tuning our base models with your training data.

  • gpt-3.5-turbo: $0.0080 per 1,000 tokens (training), $0.0030 (input), $0.0060 (output)
  • davinci-002: $0.0060 per 1,000 tokens (training), $0.0120 (input), $0.0120 (output)
  • babbage-002: $0.0004 per 1,000 tokens (training), $0.0016 (input), $0.0016 (output)

Embedding models:

  • ada v2: $0.0001 per 1,000 tokens

Base models:

  • davinci-002: $0.0020 per 1,000 tokens
  • babbage-002: $0.0004 per 1,000 tokens

Image models (DALL·E):

  • DALL·E 3 Standard: 1024×1024 at $0.040 per image, 1024×1792 or 1792×1024 at $0.080 per image
  • DALL·E 3 HD: 1024×1024 at $0.080 per image, 1024×1792 or 1792×1024 at $0.120 per image
  • DALL·E 2: 1024×1024 at $0.020 per image, 512×512 at $0.018 per image, 256×256 at $0.016 per image

Audio models:

    • Whisper: $0.006 per minute
    • TTS: $0.015 per 1,000 characters
    • TTS HD: $0.030 per 1,000 characters