How much does one OpenAI API call cost?
OpenAI doesn't charge per call; it charges per token, with separate prices for input and output tokens that depend on the model. The cost of one call is input tokens times the input price plus output tokens times the output price, and every response tells you the token counts in its usage field. Check OpenAI's pricing page for current per-million-token prices, since they differ a lot between models and change over time.
See the API Translate Text API — natural translation into any language · $0.01 / call
The formula
cost = input_tokens / 1,000,000 x input price + output_tokens / 1,000,000 x output price
Prices are quoted per million tokens. As a rough rule for English, a token is about four characters, or about three quarters of a word. Other languages and code often use more tokens for the same text.
Measure a real call in Python
Put the prices for your model in the two variables (from OpenAI's pricing page), then read the token counts from the response:
- To estimate before sending, count tokens locally with the tiktoken library.
import os, requests
INPUT_PRICE = 0.0 # USD per 1M input tokens, from the pricing page
OUTPUT_PRICE = 0.0 # USD per 1M output tokens
r = requests.post(
'https://api.openai.com/v1/chat/completions',
headers={'Authorization': f"Bearer {os.environ['OPENAI_API_KEY']}"},
json={'model': 'YOUR_MODEL', 'messages': [{'role': 'user', 'content': 'Summarise: ...'}]},
timeout=60,
)
u = r.json()['usage']
cost = u['prompt_tokens'] / 1e6 * INPUT_PRICE + u['completion_tokens'] / 1e6 * OUTPUT_PRICE
print(u, f'${cost:.6f}')
What makes one call cost more than you expect
- Chat history. Every call resends the whole conversation, so the tenth message pays for the first nine again.
- Long system prompts and tool definitions, which count as input on every call.
- Reasoning models, which bill their hidden reasoning tokens as output, even though you don't see them.
- Images, audio and files, which are priced their own way.
- Retries after timeouts, which you pay for again.
Ways to pay less
- Use the smallest model that does the job well; test a cheaper one on 20 real examples before deciding.
- Set a max output length and ask for short, structured answers.
- Keep the unchanging part of the prompt at the start, so OpenAI's prompt caching can apply its discount on repeated input.
- Send jobs that can wait to the Batch API, which is priced lower in exchange for slower results.
- Trim chat history, or summarise it, instead of resending everything.
When a fixed price per call is simpler
For narrow, repeated jobs, a fixed price per call is easier to budget than tokens. Our translation API costs $0.01 per call for up to 5,000 characters, whatever the language; our page reader costs $0.02 per page. They're paid per call with x402 in USDC on Base, with no account, and you're charged only when the call works. They aren't general chat models, so for open-ended reasoning you'll still want an LLM.
The product
Questions
Is there a minimum charge per call?
No. You pay for the tokens used, so a tiny call costs a tiny amount.
Do failed calls cost money?
Requests rejected before the model runs, such as invalid keys, don't use tokens. A call that runs and returns an answer you don't like is still billed.
How do I see my total spend?
The usage page in the OpenAI dashboard shows it, and you can set budget alerts there.
Related
Updated 2026-12-01
