Troubleshooting Unexpected API Spikes
Sudden spikes in API costs can drain a prepaid balance faster than expected, especially when working with large context windows. This guide helps you identify common causes of unexpected token usage and implement safeguards to keep your budget stable.

Understanding the Cost Structure
When you integrate an uncensored open-weight model, the primary driver of cost is token volume. Our API charges $0.15 per million input tokens and $0.50 per million output tokens. This means that while reading context is relatively inexpensive, generating text is significantly more costly. A single long response can double your bill for a single request compared to a short one.
It is important to distinguish between input and output costs. Input tokens include your prompt and any system instructions. Output tokens are the words the model generates. Since our model is uncensored, it may produce longer, more detailed responses than a filtered model, which directly impacts your $0.50 per million output rate.
Unlike some providers that offer complex tiered pricing, our pricing is linear. You pay for what you use. There are no monthly fees, and prepaid credit never expires. However, this linear model means that inefficiencies in your prompt design or response handling will directly increase your costs without any hidden discounts to offset them.
Always verify the current pricing of other vendors in their own documentation. While our rates are fixed, other services may change their prices frequently. By understanding our specific rates, you can better budget for your projects and avoid surprise charges when switching between different LLM services.
Monitoring Output Token Limits
One of the most common causes of unexpected spikes is unbounded output generation. If you do not set a maximum token limit, the model may continue generating text until it hits the context window or runs out of time. This can result in responses that are thousands of tokens long, quickly consuming your prepaid credit.
Always set a max_tokens parameter in your requests. This limits the length of the response, ensuring that you know the maximum cost per request. For example, if you set a limit of 1,000 tokens, you know the output cost will be at most $0.50 for that million-token block, scaled down proportionally.
Use streaming to monitor token usage in real-time. Our API supports streaming over SSE, allowing you to see the usage statistics in the last chunk of the response. This helps you track how many tokens are being consumed during a session, giving you immediate feedback on whether your costs are aligning with your expectations.
Keep in mind that our API does not support image, audio, or video generation. All costs are purely text-based. If you need multimodal capabilities, you will need to integrate other services. For text-only tasks, our API provides a straightforward cost model that is easy to predict if you manage your output limits effectively.
Avoiding Infinite Loops in Function Calling
Function calling, or tool use, is a powerful feature that allows the model to interact with external systems. However, it can also lead to infinite loops if not handled correctly. If the model repeatedly calls a function without making progress, it will consume input tokens with each iteration, driving up costs rapidly.
To prevent this, implement a maximum iteration limit in your application logic. If the model calls a function more than a certain number of times, force a stop and return the current state. This ensures that even if the model gets stuck, your costs remain bounded.
Use the stop parameter to define specific sequences that should terminate the response. This can help prevent the model from generating unnecessary text or repeating function calls. By controlling the flow of the conversation, you can reduce the number of tokens consumed during complex interactions.
Remember that our API supports function calling, but it does not handle the logic for you. You are responsible for detecting loops and enforcing limits. This gives you full control over the process, but it also requires careful implementation to avoid unexpected costs.
Optimizing Prompt Efficiency
Your prompt is the foundation of every request, and its length directly impacts your input token costs. Long prompts with redundant information can waste money, especially if you are sending the same context with every request. Optimize your prompts by removing unnecessary details and using concise language.
Use system instructions to set the behavior of the model once, rather than repeating them in every prompt. This reduces the input token count for subsequent requests. For example, instead of including a detailed system prompt in every call, send it once and rely on the model's memory within the context window.
Consider using JSON mode for structured outputs. This can reduce the amount of text the model needs to generate, as it focuses on producing valid JSON rather than natural language. This can lead to shorter responses and lower output costs.
Regularly review your prompts to ensure they are as efficient as possible. Small improvements in prompt design can lead to significant savings over time, especially if you are making high volumes of requests. Always check the vendor's documentation for best practices on prompt engineering.
When Our API Is Not the Right Choice
Our API is designed for text-only tasks using a single uncensored model. If you need image generation, audio processing, or video creation, our API is not the right choice. You will need to integrate other services to handle those multimodal tasks.
Similarly, if you require fine-tuning or model routing, our API does not support these features. We offer a hosted, OpenAI-compatible chat-completions API, but we do not provide the infrastructure for training custom models or routing requests to different models based on complexity.
If you need OCR capabilities or search functionality, our API will not meet your needs. It is strictly a text-in, text-out service. For these advanced features, you should look for specialized providers that offer those specific capabilities.
Our API is ideal for developers who need a simple, uncensored text model with predictable pricing. If your project requires a complex suite of AI tools, you may find that our API is too limited. In such cases, consider a platform that offers a broader range of features.
Addressing Common Developer Concerns
Developers often worry about the cost of re-explaining project structures in new chats. This can lead to significant token usage, especially for large codebases. To mitigate this, consider breaking your projects into smaller, manageable chunks. This reduces the amount of context needed for each request.
Another common concern is the cost of pair-programming sessions. If you are using the API for extended coding tasks, you may find that the input tokens accumulate quickly. Use streaming to monitor your usage and set limits to prevent runaway costs.
Some developers have found that using memory tools or external repositories can help reduce the need to re-send context. By storing project structures externally, you can reference them rather than including them in every prompt. This can lead to substantial savings over time.
It is also worth noting that some tools claim to reduce API tool calls significantly. While these tools can be helpful, they may not address all aspects of cost optimization. Always evaluate whether a tool is necessary for your specific use case before integrating it.
Budgeting and Prepaid Credit
Our API uses a prepaid credit system, which means you pay for what you use. There are no monthly fees or subscriptions, and your credit never expires. This makes it easy to budget for your projects, as you only spend what you need.
You can top up your credit using crypto, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. You can also receive bonus credit for larger top-ups, which can help you stretch your budget further.
Errors and refusals are free, which means you do not pay for failed requests. This can help you save money when testing your application or debugging issues. However, keep in mind that successful requests will still incur costs based on token usage.
Always verify the current pricing of other vendors in their documentation. While our rates are fixed, other services may change their prices. By understanding our specific rates, you can better plan your budget and avoid surprise charges.
Frequently asked questions
How do I prevent infinite loops in function calling?
Implement a maximum iteration limit in your application logic. If the model calls a function more than a set number of times, force a stop. Use the stop parameter to define specific sequences that should terminate the response.
What is the cost of output tokens?
Our API charges $0.50 per million output tokens. This is higher than the input token rate of $0.15 per million, so be mindful of the length of your responses.
Can I use the API for image generation?
No, our API is text-only. It does not support image, audio, or video generation. You will need to integrate other services for multimodal tasks.
How do I track token usage in real-time?
Use streaming over SSE. Our API provides usage statistics in the last chunk of the response, allowing you to monitor token consumption during a session.