EN ▾

Uncensored Qwen API for developers

Qwen Uncensored API Cost Calculator

Developers often ask how to estimate token costs for high-volume uncensored generation without hidden fees. This article teaches a method for calculating budget using our specific per-million-token rates, including a worked example for a typical 27B model use case.

Developer workspace with laptop showing code and floating crypto tokens

Understanding the Pricing Structure

When integrating an uncensored LLM into your application, understanding the cost structure is essential for sustainable development. Our API operates on a prepaid model, meaning you must fund your account before making requests. This approach eliminates monthly subscription fees and ensures that you only pay for what you actually use. The pricing is straightforward: $0.15 per million input tokens and $0.50 per million output tokens. This structure allows for precise budgeting, as you can track exactly how much each conversation or data processing task costs.

It is important to note that errors and refusals do not incur charges. If your request fails due to a technical issue or if the model refuses a prompt due to content policy, you are not billed for those tokens. This feature is particularly useful during the development phase, where you might send many test requests to fine-tune your prompts. You can experiment freely without worrying about accumulating costs from failed attempts.

The prepaid credit never expires, which provides flexibility for developers who may not use the API consistently. You can top up your account when needed, and the balance remains available for future use. This is advantageous for projects with intermittent usage patterns, as you do not lose your investment if you pause development for a few weeks.

However, the payment methods are limited to cryptocurrency. You can top up using USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. If you add between $50 and $500, you receive a bonus credit ranging from 5% to 15%. This bonus can help stretch your budget further, making it more cost-effective for larger projects.

Calculating Token Costs

To estimate your costs, you need to understand how tokens are counted. A token is a basic unit of text, and the API charges based on the total number of tokens in the prompt and the completion. The context window for our model is 100,000 tokens, which includes both the input prompt and the output completion. This large window allows for extensive context, which is useful for complex tasks like document analysis or long-form content generation.

Let's look at a simple example. Suppose you send a prompt that is 1,000 tokens long, and the model generates a response of 500 tokens. The total tokens used are 1,500. To calculate the cost, you multiply the input tokens by the input rate and the output tokens by the output rate. For this example, the cost would be (1,000 / 1,000,000) * $0.15 for input and (500 / 1,000,000) * $0.50 for output. This results in a very small fraction of a cent, demonstrating the efficiency of the pricing model for small requests.

For larger requests, the calculation remains the same. If you are processing a large document with 50,000 tokens and generating a 10,000-token summary, the input cost would be (50,000 / 1,000,000) * $0.15, and the output cost would be (10,000 / 1,000,000) * $0.50. This method allows you to predict costs accurately, even for high-volume usage. You can use this formula to estimate your monthly budget based on your expected request volume.

It is also worth noting that the API supports streaming over Server-Sent Events (SSE). This allows you to receive the response in chunks as it is generated. While this does not change the token count, it can improve the user experience by reducing perceived latency. You can monitor the usage in the last chunk of the stream, which helps in tracking real-time costs during active sessions.

Budgeting for High-Volume Use

For developers running high-volume applications, budgeting becomes a critical task. High-volume usage can lead to significant costs if not managed properly. To keep costs under control, you should monitor your token usage closely and optimize your prompts to minimize unnecessary tokens. For example, you can truncate long contexts or use more concise prompts to reduce input token counts.

One effective strategy is to use the seed parameter for reproducible results. This allows you to test different prompts with the same seed, ensuring consistent outputs. By testing with a fixed seed, you can determine the optimal prompt length and structure without incurring extra costs from multiple trials. This is particularly useful for fine-tuning your application's behavior.

Another consideration is the use of function calling and JSON mode. These features allow you to structure your requests and responses more efficiently. For instance, you can use function calling to request specific data formats, reducing the need for post-processing. This can save tokens by ensuring that the model generates only the necessary information, rather than verbose explanations.

When budgeting, it is also important to consider the rate limits. Our API allows 300 requests per minute per key. If your application exceeds this limit, you will receive a 429 error. To avoid this, you can implement retry logic with exponential backoff. This ensures that your application handles rate limits gracefully without overwhelming the API. By planning for these limits, you can maintain a steady flow of requests without unexpected interruptions.

When Our API Is Not the Right Choice

While our API is excellent for text generation, it may not be the right choice for all use cases. If your application requires image, audio, or video generation, our API does not support these modalities. You would need to use a different service for those tasks. Similarly, if you need embeddings for vector search, our API does not provide this feature. You would need to integrate a separate embedding service.

Another scenario where our API might not be suitable is if you require fine-tuning capabilities. Our API serves a pre-trained model, and you cannot fine-tune it directly through the API. If you need to customize the model's behavior through fine-tuning, you would need to use a different provider. Additionally, if you require model routing to switch between different models based on the task, our API does not support this feature.

OCR (Optical Character Recognition) is another capability that our API does not offer. If your application needs to extract text from images, you would need to use a dedicated OCR service. Similarly, if you need to generate audio or video content, our text-only API will not suffice. In these cases, you would need to combine our API with other tools to achieve your desired outcome.

Finally, if you are looking for a service with a free unlimited tier, our API may not meet your needs. We offer a prepaid model with a trial credit of $0.50, but ongoing usage requires payment. If your project has a very low budget and can tolerate higher latency or lower quality, a free tier might be more appropriate. However, for high-quality, uncensored text generation, our API provides a reliable and cost-effective solution.

Addressing Common Developer Questions

Developers often have questions about the performance and capabilities of uncensored models. On Reddit, users have discussed the ease of switching between censored and uncensored modes. One common theme is the ability to have instant runtime control without reloading the model. This feature allows developers to A/B test prompts quickly, comparing the output of different models on the same hardware and seed. This flexibility is valuable for optimizing your application's behavior.

Another topic of discussion is the quality of the output. Some users have noted that the uncensored model can produce grainy or unusual effects when used with other tools, such as image editing. This is a characteristic of the model itself and may not be suitable for all creative applications. However, for text generation, the output is generally high-quality and consistent.

Users have also asked about the availability of different model variants. For example, some developers are interested in running the model locally on their hardware. The model is available in various quantizations, such as Q4, Q3, and Q5, which can be selected based on your hardware capabilities. This allows for local deployment if you prefer to host the model yourself.

Finally, there is interest in the optimization of the model. Some users have reported that the uncensored version is more optimized and provides better token per second performance compared to other versions. This can be beneficial for applications that require high throughput. By understanding these community insights, you can make informed decisions about how to integrate our API into your workflow.

Integrating with Your Application

Integrating our API into your application is straightforward, thanks to its OpenAI-compatible interface. You can use the standard /v1/chat/completions endpoint to send requests. The base URL for our API is https://api.qwenuncensored.top/v1. You can use any OpenAI-compatible SDK to interact with the API, which simplifies the integration process.

When making requests, you need to provide your API key in the authorization header. The key is shown immediately after signup, so you can start using it right away. You can sign up using Google or an email and password. The key is unique to your account and should be kept secure to prevent unauthorized usage.

The API supports various parameters, including temperature, top_p, stop, and seed. These parameters allow you to control the randomness and behavior of the model. For example, setting a lower temperature will make the output more deterministic, while a higher temperature will introduce more creativity. You can experiment with these parameters to find the best settings for your application.

Additionally, the API supports function calling and JSON mode. This allows you to request structured outputs, which can be useful for data processing tasks. You can define functions that the model can call, and the model will return the arguments in a structured format. This feature enhances the utility of the API for applications that require precise data extraction.

Troubleshooting and Limits

Even with a well-designed application, you may encounter errors. Our API returns specific HTTP status codes to help you troubleshoot issues. A 401 error indicates an invalid API key, which means you need to check your credentials. A 402 error indicates that you have no credit left, so you need to top up your account. A 429 error indicates that you have exceeded the rate limit of 300 requests per minute.

To handle these errors, you can implement retry logic in your application. For 429 errors, you can use exponential backoff to wait before retrying the request. This prevents overwhelming the API and ensures that your application handles rate limits gracefully. For 401 and 402 errors, you should notify the user or admin to check their account status.

It is also important to monitor your token usage to avoid unexpected charges. You can track the number of tokens used in each request and compare it to your budget. If you notice a sudden increase in costs, you can investigate the cause, such as a change in prompt length or a bug in your code. By staying vigilant, you can keep your costs under control.

Finally, remember that our API has a hard content limit. Requests involving sexual content with minors will be refused. This is the only major content restriction, so you can generate a wide variety of other content without worry. By understanding these limits and error codes, you can build a reliable and efficient application using our API.

Frequently asked questions

How do I calculate the cost of a request?

Multiply the input tokens by $0.15 per million and the output tokens by $0.50 per million. Errors and refusals are free, so you only pay for successful token usage.

What payment methods are accepted?

We accept USDT on the TRC20 network and USDC on the Base network. You can top up between $20 and $500, with a bonus for larger amounts.

Can I use the API for image generation?

No, our API is text-only. It does not support image, audio, or video generation. You would need a different service for those modalities.

What happens if I exceed the rate limit?

You will receive a 429 error. You should implement retry logic with exponential backoff to handle this gracefully and avoid overwhelming the API.