How to Budget LLM API Costs for Your Project
Developers often ask how to predict token usage and avoid surprise bills when integrating large language models. This article teaches a method to estimate costs using input and output token counts, with a worked example based on our pricing structure.

Understanding Token-Based Pricing
Most modern LLM APIs charge based on the number of tokens processed rather than a flat monthly fee. This model means your costs scale directly with usage, which can be efficient for sporadic traffic but requires careful monitoring during high-volume periods. Our API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This structure rewards efficient prompting because input tokens are significantly cheaper than the model's responses.
Input tokens include your system prompt, user messages, and any context history sent with each request. Output tokens are generated by the model and can vary widely depending on the complexity of the answer. Since output tokens are more expensive, optimizing your prompts to reduce unnecessary context can lower your bill without affecting quality.
It is important to note that our API does not charge for errors or refusals. If a request fails or is refused due to content filters, you are not billed for those tokens. This feature helps protect your budget during development when you are testing edge cases or refining your prompt engineering strategies.
When planning your budget, you should estimate both input and output volumes separately. This allows you to see where the bulk of your spending will occur. For many applications, input costs are predictable, while output costs can fluctuate based on user behavior and response length.
Estimating Input Token Usage
Input tokens are determined by the length of your prompt and the context window you send. Our API supports a context window of 100,000 tokens, which is the sum of the prompt and the completion together. This large window allows you to send extensive documents or conversation histories in a single request.
To estimate input costs, count the tokens in your system prompt, user message, and any attached files. You can use standard tokenizers to get an accurate count. Since input tokens cost $0.15 per million, even large prompts are relatively inexpensive. For example, a 10,000-token prompt costs only a fraction of a cent.
However, if you are building a chat application, you must include the entire conversation history in each request. This means input tokens accumulate quickly as the conversation grows. You might consider truncating old messages to stay within the context window and control costs.
Function calling and JSON mode also add to the input token count. When you define tools or specify a JSON schema, these definitions are part of the prompt. Ensure your tool definitions are concise to minimize this overhead. Regularly review your prompt structure to remove redundant information.
Estimating Output Token Usage
Output tokens are generated by the model and are more expensive than input tokens. Our API charges $0.50 per 1 million output tokens. This price reflects the computational cost of generating text. Output length can vary significantly based on the model's creativity and the complexity of the task.
To estimate output costs, consider the average length of responses you expect. If your application requires detailed explanations, output tokens will be higher. You can set parameters like temperature and top_p to control the randomness and length of the output. Lower temperatures often produce more concise responses, which can reduce costs.
Streaming responses do not change the token count but can help you manage latency. Our API supports streaming over SSE, allowing you to receive tokens as they are generated. This is useful for user experience but does not affect the billing calculation.
Always monitor your output token usage during the testing phase. If you notice unexpectedly high output counts, review your prompts and system instructions. Sometimes, vague prompts lead to verbose responses, which increases costs. Refining your instructions can help the model produce more focused answers.
Calculating Total Project Costs
Once you have estimated your input and output token volumes, you can calculate the total cost using the formula: tokens divided by 1,000,000 times the per-million price. This formula applies to both input and output tokens separately. You then sum the two values to get the total cost for a single request.
For example, if a request uses 5,000 input tokens and 1,000 output tokens, the cost is calculated as follows: (5,000 / 1,000,000) * $0.15 for input, and (1,000 / 1,000,000) * $0.50 for output. This method ensures you account for the different pricing tiers accurately.
When budgeting for a project, multiply the cost per request by the expected number of requests per day. This gives you a daily cost estimate. You can then scale this to monthly or annual figures based on your project's growth projections. Remember to include a buffer for unexpected usage spikes.
Our API does not have a monthly subscription fee, so your costs are purely usage-based. This flexibility is beneficial for projects with variable traffic. However, it also means you need to monitor your usage closely to avoid surprise bills. Regularly reviewing your token counts helps you stay within budget.
When Our API Is Not the Right Choice
Our API is designed for text generation and chat completions. It does not support image, audio, or video generation, embeddings, OCR, or fine-tuning. If your project requires these capabilities, our API may not be the right choice. You would need to integrate additional services or choose a different provider.
For example, if you need to generate images from text descriptions, you would need an image generation API. Our API only handles text in and text out. You can use our API for the text steps around image generation, such as generating prompts for an image model, but it cannot create the images itself.
Similarly, if you need to analyze documents using OCR or extract embeddings for semantic search, our API does not offer these features. You would need to use a specialized service for these tasks. Our API is best suited for applications that rely on conversational AI or text generation.
Additionally, our API does not offer on-prem deployment or named customers. If you require data residency on your own servers or a dedicated instance, you might need a different solution. Our service is a hosted API, which is ideal for developers who want a simple, scalable backend without managing infrastructure.
Managing Credits and Limits
Our API uses a prepaid credit system with no monthly fees. You can top up your account with crypto, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. You can choose any whole amount within this range. Bonus credit is available for top-ups of $50 or more, ranging from +5% to +15%.
Errors and refusals do not consume your credit. This means you can test your application extensively without worrying about burning through your balance. If a request fails due to an invalid key or rate limit, you are not charged. This feature is helpful for debugging and testing.
Our API has a rate limit of 300 requests per minute per key. This limit helps ensure fair usage and prevents abuse. If you exceed this limit, you will receive a 429 error. You can monitor your usage and adjust your request frequency to stay within the limit.
Prepaid credit never expires, so you can top up whenever it is convenient. There is no subscription to manage, and you only pay for what you use. This model is ideal for indie builders and developers who want predictable costs without long-term commitments.
Testing and Optimization Tips
When integrating our API, start with a small test to estimate token usage. Send a few requests and monitor the input and output token counts. This will give you a baseline for your costs. You can then scale up your usage and adjust your budget accordingly.
Use the streaming feature to improve user experience without affecting costs. Streaming allows users to see responses as they are generated, which can reduce perceived latency. However, it does not change the token count, so your costs remain the same.
Optimize your prompts to reduce output token usage. Clear and concise instructions can help the model produce shorter, more relevant responses. This not only improves user experience but also lowers your costs. Regularly review your prompts to ensure they are efficient.
Check our documentation for current prices, limits, and features. Our API supports function calling, JSON mode, and various parameters like temperature and top_p. These features can help you tailor the model's behavior to your needs. Always refer to the official documentation for the most up-to-date information.
Frequently asked questions
How do I calculate the cost of a single API request?
Calculate the cost by dividing the input tokens by 1,000,000 and multiplying by $0.15, then divide the output tokens by 1,000,000 and multiply by $0.50. Sum these two values to get the total cost for the request.
Does our API charge for failed requests?
No, our API does not charge for errors or refusals. You are only billed for successful token usage. This includes cases where the model refuses to generate a response due to content filters.
What payment methods are accepted for top-ups?
We accept crypto only, specifically USDT on TRC20 or USDC on Base. The minimum top-up is $20, and the maximum is $500. Bonus credit is available for top-ups of $50 or more.
Can I use this API for image generation?
No, our API is for text generation only. It does not support image, audio, or video generation. You would need to integrate a separate service for those capabilities.