If you’re planning to use OpenAI’s API, it’s important to understand how pricing works.
OpenAI charges based on tokens, which are chunks of words. This post will explain:
✅ How tokens work
✅ How OpenAI calculates costs
✅ How much it costs to process real-world examples
✅ How to track your usage to avoid unexpected charges
How OpenAI Charges for API Usage
🔹 OpenAI charges based on tokens, which represent parts of words.
🔹 1 token ≈ 4 characters of English text (roughly 75 words = 100 tokens).
🔹 There are input tokens (what you send to OpenAI) and output tokens (what OpenAI generates in response).
🔹 Some models generate longer responses, increasing token usage.
OpenAI Pricing Per Million Tokens
| Model | Input Cost | Output Cost |
|---|---|---|
| GPT-4o | $2.50 | $10.00 |
| GPT-4o Mini | $0.15 | $0.60 |
| o1 | $15.00 | $60.00 |
| o3-mini | $1.10 | $4.40 |
🔹 Cached input and batching can help reduced costs. I’ll cover batching another time.
🔹 Output tokens usually cost more than input tokens because they require more computation.
💡 Tip: The prices above are current as of this post. Check prices here.
Example: Running a Study with 10,000 Restaurant Reviews
Let’s say you’re conducting a study with 10,000 restaurant reviews and using OpenAI to assign emotional valence scores to each review.
Here’s an example restaurant review and prompt:
review_text = """
Visited their food truck at NIH campus during the summer and have gone to their brick and mortar location. Pop up poutine specializes in Montreal style cuisine (has similarities to French food). Their trademark dish is poutine, which are fries covered with different toppings. The traditional choice is cheese curds and gravy, but they also have various vegetable and meat toppings. Their smoked meat (tastes similar to corned beef) is also very good (tender and full of flavor). They also have steamies (hot dogs), chicken tenders and Montreal style bagels and pastries.
This outing I ordered the Jacques platter (French fries with slices of smoked meat), a tourtiere (beef pie) and sausage roll. All very very tasty. The meat pastries were buttery and flaky with generous amounts of meat.
The Jacques platter had piping hot crisp fries and thick slices of that smoked brisket meat.
"""
# Define prompt for OpenAI API using a single review
prompt = f"""
Analyze the following restaurant review and assign an overall emotional valence score. Consider positive valence for phrases indicating pleasure, satisfaction, or appeal, negative valence for displeasure, and neutral for descriptive statements.
Return only the final overall_valence_score as a single numeric value.
Review:
{review_text}"""
Token Breakdown Per Review
You can use OpenAI’s tokenizer to copy paste the text of a typical review (e.g., the above), and your prompt instructions. For example for the review you get:

This is interesting because you get the number of 4o tokens and the tokens that it detects. Doing this across the prompt and a single digit, you would find:
- Review text = 186 tokens
- Prompt text = 59 tokens
- Model output = 1 token (since the response is just a single number from 1 to 5)
So, your typical input per submission to the API would be 186+58=244 tokens, while the output would be just 1 token.
Cost Calculation using GPT-4o
- Input cost: (186 + 59) tokens ÷ 1,000 × $2.50 per million tokens = $0.0006625 per review
- Output cost: 1 token ÷ 1,000 × $10.00 per million tokens = $0.00001 per review
- Total per review = $0.0006725
For 10,000 reviews, the total cost using GPT-4o would be:
📌 10,000 × $0.0006725 = $6.23
Cost Calculation for o1
Assuming that o1 uses the same tokens as 4o (which it does not, but we’ll do it for simplicity), we get:
- Input cost: (186 + 59) tokens ÷ 1,000 × $15.00 per million tokens = $0.003975 per review
- Output cost: 1 token ÷ 1,000 × $60.00 per million tokens = $0.00006 per review
- Total per review = $0.004035
For 10,000 reviews, the total cost using o1 would be:
📌 10,000 × $0.004035 = $37.35
Key Takeaways
GPT-4o is extremely cost-effective, processing 10,000 reviews for just $6.23. Still, o1, even with only 1 token output, costs significantly more, at $37.35 for 10,000 reviews. If cost is a concern, GPT-4o Mini or o3-mini might be even cheaper options to the extent that the ratings they generate are still valid. Don’t forget about validating the codings generated!
You can monitor your API usage at:
🔗 https://platform.openai.com/account/usage
💡 Tip: If you’re running large-scale research, set a usage limit in the billing settings to prevent unexpected charges.
Leave a comment