EN ▾
Try with trial credit
per 1M input tokens
$0.15
Output tokens / 1M
$0.50
token context
100,000
trial credit
$0.50
requests per minute
300

OpenAI API Pricing: Common Mistakes and How to Avoid Them

OpenAI API pricing often surprises developers because input and output tokens are billed separately, and streaming responses can inflate costs if not tracked carefully. Understanding these mechanics helps you avoid unexpected charges while choosing the right model configuration for your budget.

Last updated

Summary

  • Input tokens cost $0.15 per million while output tokens cost $0.50 per million with our uncensored model.
  • Streaming responses still count all generated tokens toward your prepaid balance.
  • Context window limits affect both input and output token calculations.
  • Prepaid credits never expire and only charge for actual usage including errors.

Understanding token costs: input vs output

OpenAI API pricing charges separately for input and output tokens. This means your total cost depends on both how much you send and how much the model generates. Input tokens cover your prompt plus any conversation history. Output tokens cover the model's response text.

Our uncensored model charges $0.15 per million input tokens and $0.50 per million output tokens. The higher output cost reflects the compute required to generate text. Shorter responses cost less but still consume your prepaid credits.

  • Input tokens include your prompt and conversation history
  • Output tokens cover the model's complete response
  • Both token types count toward your prepaid balance
  • Errors and refusals consume zero tokens
curl https://api.mistralopenaicompatibleapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "list top 5 linux commands for disk cleanup"}]
  }'

Context window limits and unexpected charges

Context window limits directly affect your token costs because longer conversations consume more input tokens. Our uncensored model supports a 100,000 token context window for prompt plus completion together. You can generate up to 16,000 tokens per request. If you omit max_tokens the limit drops to 2,048 tokens.

Longer context windows mean higher input token costs but also enable more complex reasoning. Trimming conversation history reduces input costs but may degrade response quality. Find the balance that works for your use case.

  • 100,000 total context window for input plus output
  • 16,000 maximum output tokens per request
  • 2,048 default output tokens if max_tokens is omitted
  • Context window affects both costs and response quality
from openai import OpenAI

client = OpenAI(base_url="https://api.mistralopenaicompatibleapi.com/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Streaming vs non-streaming token calculation

Streaming responses calculate tokens the same way as non-streaming requests. Every token sent to the client counts toward your prepaid balance regardless of delivery method. Streaming just delivers tokens incrementally rather than all at once.

Use streaming when you need real-time feedback but track token usage carefully. The final chunk contains total token counts for both input and output. Monitor these counts to stay within your budget.

  • Streaming and non-streaming use identical token counting
  • Every token sent to the client consumes credits
  • Final chunk includes total input and output token counts
  • Track token usage in your streaming implementation
stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Common SDK configuration errors

SDK misconfigurations cause unexpected charges by sending too many tokens or making redundant requests. Developers often forget to set max_tokens resulting in unexpectedly long responses. Others miss streaming implementations that continue sending tokens after the response is complete.

Configure your SDK with explicit parameters. Set max_tokens to control output length. Enable streaming only when you need real-time feedback. Monitor token usage in your application logs.

  • Set explicit max_tokens to control output length
  • Enable streaming only when real-time feedback is needed
  • Monitor token counts in your application logs
  • Configure timeout values to prevent hanging requests
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.mistralopenaicompatibleapi.com/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Why prepaid credits save you money

Prepaid credits eliminate subscription waste by charging only for actual token usage. Our system charges $0.15 per million input tokens and $0.50 per million output tokens. Errors and refusals consume zero tokens so you never pay for failed requests.

Pay $20 to $500 in crypto for USDT on TRC20 or USDC on Base. Receive bonus credit when topping up $50 or more. Credits never expire so you can use them whenever needed. No monthly fees mean you only pay for what you actually consume.

  • Prepaid credits charge only for actual token usage
  • Errors and refusals consume zero tokens
  • Top up $20 to $500 in crypto
  • Credits never expire and bonus credit applies

Avoiding rate limit penalties

Rate limits prevent abuse but can interrupt your application if configured incorrectly. Our API allows 300 requests per minute per key and 8 concurrent requests per key. Request bodies must stay under 8 MB to avoid rejection.

Implement retry logic with exponential backoff when hitting rate limits. Monitor your request count per minute to stay within limits. Use separate keys for different application components to distribute load. One active key per account means you must manage key rotation carefully.

  • 300 requests per minute per API key
  • 8 concurrent requests allowed per key
  • Request bodies must be under 8 MB
  • One active key per account with replacement capability

Comparing uncensored model costs

Uncensored models often cost more than standard models due to specialized training and inference requirements. Our model charges $0.15 per million input tokens and $0.50 per million output tokens. This pricing reflects the compute resources needed for uncensored generation.

Standard models may cost less but include content restrictions that affect response quality. Uncensored models provide unrestricted responses for lawful adult content, fiction, and research. Choose based on your content needs rather than price alone.

  • Uncensored models require specialized training and inference
  • Our pricing reflects uncensored generation compute costs
  • Content restrictions affect response quality and cost
  • Choose based on content needs not just price

Tracking usage and billing alerts

Token usage tracking helps you monitor costs and prevent budget overruns. Our API returns token counts in every response including streaming responses. Track these counts in your application logs and dashboards.

Set up alerts when usage reaches certain thresholds. Monitor input versus output token ratios to optimize your prompts. Use the token counts to calculate actual costs and compare against your prepaid balance.

  • Token counts appear in every response including streaming
  • Monitor input versus output token ratios
  • Set usage alerts to prevent budget overruns
  • Calculate actual costs using token counts

Frequently asked questions

How do I calculate my API costs?

Multiply your input token count by $0.15 per million and your output token count by $0.50 per million. Add these values to get your total cost for a single request. Track token counts in your application logs to monitor usage over time.

Do streaming responses cost more than non-streaming?

No. Streaming and non-streaming responses use identical token counting. Every token sent to the client counts toward your prepaid balance regardless of delivery method. The final streaming chunk contains total token counts for both input and output.

What happens if I hit my rate limit?

Requests exceeding the 300 requests per minute or 8 concurrent request limit receive an error response. These errors consume zero tokens so you are not charged. Implement retry logic with exponential backoff to handle rate limits gracefully.

Do prepaid credits expire?

No. Prepaid credits never expire so you can use them whenever needed. You only pay for actual token usage including errors and refusals which consume zero tokens. Top up with crypto when you need more credits.

Get your API key

Register, grab the key, update your endpoint base URL. That’s it.