EN ▾
Get API key

Estimating WanAPI Uncensored API Costs

Developers often ask how to budget for high-volume uncensored generation. This article teaches a step-by-step method to calculate token usage and total spend using the API's specific per-million-token rates.

Digital illustration of a blockchain ledger with flowing data streams and a token counter

Understanding the Pricing Model

The pricing structure for this service is straightforward and based entirely on token consumption. You pay $0.15 per one million input tokens and $0.50 per one million output tokens. This model ensures that you only spend money on actual usage, with no hidden subscription fees or monthly commitments. Errors and refusals do not incur charges, which helps in managing your budget effectively during the development phase.

It is important to distinguish between input and output tokens. Input tokens include your prompt and any system instructions, while output tokens are the words generated by the model. Since the output rate is higher, optimizing your prompts can significantly reduce costs. The API charges for real token usage, meaning that even if a request takes time to process, you are only billed for the tokens sent and received.

The prepaid credit system means you must top up your account before you can make requests. Credits are charged by real token usage, and unlike some competitors, your paid credit never expires. This allows you to buy credits when prices are favorable or when you anticipate high usage, without worrying about them vanishing after a billing cycle.

Payment is handled exclusively through cryptocurrency. You can top up with USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. For amounts starting at $50, you receive a bonus credit ranging from 5% to 15%. This crypto-only approach keeps transaction fees low and allows for quick funding of your account.

Calculating Input Token Costs

To estimate your costs, you first need to count the tokens in your input. This includes the user prompt, any system messages, and the context window history. The API uses a context window of 100,000 tokens, which is the sum of both prompt and completion tokens. Keeping your input concise is the most effective way to control expenses.

Let us look at a concrete example. Suppose you send a prompt that is 1,000 tokens long. To calculate the cost, you divide the token count by one million and multiply by the input rate of $0.15. The formula is (1,000 / 1,000,000) * 0.15. This results in a very small fraction of a cent, demonstrating that input costs are generally low for typical prompts.

However, as you scale up to high-volume applications, these small fractions add up. If you process one million input tokens in a month, your cost will be exactly $0.15. This linear pricing model makes it easy to predict your expenses. You can simply multiply your expected monthly token volume by the rate to get your budget estimate.

When integrating with other tools, remember that token counts can vary depending on the tokenizer used. While our API is OpenAI-compatible, it is best to use the API's own tokenization for accurate billing. You can check the usage in the last chunk of a streaming response to see exactly how many tokens were consumed in that request.

Calculating Output Token Costs

Output tokens are more expensive than input tokens, with a rate of $0.50 per one million tokens. This higher rate reflects the computational cost of generating text. When designing your application, you should consider how much text you need the model to produce. Longer responses will naturally cost more.

Consider a scenario where the model generates 5,000 tokens in response to your prompt. Using the formula (5,000 / 1,000,000) * 0.50, you can determine the exact cost. This calculation helps you understand the financial impact of verbose outputs. If you need detailed explanations or long-form content, you must account for this higher rate in your budget.

One way to manage output costs is to use parameters like max_tokens to limit the length of the response. This prevents the model from generating unnecessary text, which can save money in high-volume scenarios. You can also use the stop parameter to halt generation when a specific condition is met, ensuring you do not pay for extra tokens beyond what you need.

It is also worth noting that the API supports function calling and JSON mode. When using these features, the model may output structured data that is more compact than natural language. This can sometimes reduce the number of output tokens required, offering a potential cost saving for developers who need structured data rather than prose.

When Our API Is Not the Right Choice

While our API is excellent for text generation, it is not a universal solution. It is important to recognize when this service might not fit your project needs. The API serves only one uncensored open-weight text model. It does not support embeddings, image generation, audio processing, or video creation. If your application requires multimodal capabilities, this API will not suffice.

Additionally, the API does not offer fine-tuning or model routing. You are using a single model with a fixed set of parameters. If you need to switch between different models for different tasks, or if you require a model fine-tuned for a specific domain, you would need a different provider. Our API is designed for simplicity and consistency, not for complex model orchestration.

The payment method is also a limiting factor for some users. Since top-ups are crypto-only, users who prefer credit cards, PayPal, or bank transfers may find the onboarding process cumbersome. If your team lacks a crypto wallet or prefers traditional payment methods, you might need to use a third-party service to convert fiat currency into crypto for top-ups.

Finally, the hard content limit means that sexual content involving minors is refused. If your application requires a completely uncensored experience with no such restrictions, you may need to look elsewhere. For most other controversial, adult, or security-research topics, the model remains uncensored, but this specific limit is a key constraint to consider.

Managing Your Budget and Limits

Understanding your rate limits is important for maintaining a stable application. The API allows 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. This limit is per key, so you can increase your throughput by using multiple API keys, provided you manage the distribution of requests effectively.

To stay within your budget, you should monitor your token usage regularly. The API provides usage information in the response headers or within the streaming chunks. By tracking your input and output tokens, you can predict when you might run out of credit. This is particularly important for high-volume applications where usage can spike unexpectedly.

Errors do not consume credit, which is a significant advantage. If you send a request with an invalid key or if the model refuses a request due to content filters, you are not charged. This means you can test your integration extensively without worrying about wasting your prepaid balance. Use the trial credit to verify your setup before committing to a larger top-up.

When you do run out of credit, you will receive a 402 error. Since there is no subscription, you must manually top up your account to continue using the service. The process is simple: send crypto to the provided address, and the credit is added to your account. This pay-as-you-go model ensures you never pay for what you do not use.

Getting Started with Trial and Top-up

New accounts receive $0.50 of trial credit, which requires no card or payment method. This is a great way to test the API without any financial commitment. You can use this trial credit to make your first few requests, verify the integration, and get a feel for the model's behavior. The trial credit is charged by real token usage, so it will be depleted as you make requests.

Once you are ready to scale, you can top up your account with crypto. The minimum top-up is $20, and the maximum is $500. You can use USDT on the TRC20 network or USDC on the Base network. For top-ups of $50 or more, you receive a bonus credit ranging from 5% to 15%. This bonus can significantly extend your usable balance, making larger top-ups more cost-effective.

Signing up is easy. You can continue with Google or use an email and password. Your API key is shown immediately after signup, allowing you to start making requests right away. The key is unique to your account and should be kept secure. You can generate multiple keys if you need to manage different projects or environments.

Remember that the trial credit is a one-time benefit for new accounts. Once it is used, you must top up with crypto to continue. This encourages developers to test the API thoroughly before investing in a larger balance. It also allows you to evaluate the model's quality and compatibility with your application before committing to a paid plan.

Troubleshooting Common Issues

When integrating the API, you may encounter various errors. A 401 error indicates an invalid key. This usually happens if you copy the key incorrectly or if you are using a key from a different account. Double-check your key and ensure it is being sent in the authorization header.

A 402 error means you have no credit. This is common if you have used up your trial credit or your prepaid balance. Simply top up your account with crypto to resolve this issue. Since errors do not consume credit, you can retry your request after topping up without losing any funds.

A 429 error indicates that you have hit the rate limit of 300 requests per minute. If you see this error, you should implement exponential backoff in your code to retry the request after a short delay. You can also distribute your requests across multiple API keys to increase your throughput.

Finally, ensure that your requests are well-formed. The API expects a specific JSON structure for the chat completions endpoint. If you send invalid data, you may receive an error. Check the documentation for the correct format and ensure that all required fields are present. This will help you avoid unnecessary errors and ensure smooth operation.

Frequently asked questions

How do I calculate the cost of a single request?

Divide the total number of input and output tokens by one million, then multiply by the respective rates of $0.15 and $0.50. Sum these values to get the total cost for that request.

What happens if I exceed the rate limit?

You will receive a 429 error. You should implement exponential backoff in your application to retry the request after a delay. Using multiple API keys can also help increase your throughput.

Can I use a credit card to top up?

No, top-ups are crypto-only. You can use USDT on the TRC20 network or USDC on the Base network. The minimum top-up is $20, and the maximum is $500.

Is there a monthly subscription fee?

No, there is no monthly fee or subscription. You pay only for the tokens you use. Your paid credit never expires, so you can top up whenever you need.