EN ▾

How to Calculate Content Moderation API Costs

Developers often ask how to budget for real-time moderation in production. This article teaches a method to estimate token usage and costs using our specific per-million-token pricing model.

Understanding the Pricing Model

Our API uses a straightforward per-token pricing model that charges only for actual usage. You pay $0.15 for every one million input tokens and $0.50 for every one million output tokens. This means your costs scale directly with the volume of text you process, rather than being tied to a fixed monthly subscription or tiered plan. Errors and refusals do not incur charges, which protects your budget when dealing with edge cases or invalid requests.

It is important to note that we do not charge for embeddings, image generation, audio processing, or video analysis. Our service is strictly text-in, text-out. This focus allows us to keep the pricing simple and predictable for developers who need reliable content moderation without paying for features they do not use.

The prepaid credit system ensures you never face unexpected bills. You top up your account with crypto, and the credit is charged in real-time as tokens are consumed. There are no monthly fees, and your paid credit never expires. This structure is ideal for indie builders and small teams who want to control their spending precisely.

When you send a request, the system counts the tokens in your prompt and the tokens in the model's response. You can monitor your usage through the API response headers or by checking your account dashboard. This transparency helps you track your spending and adjust your budget as your application grows.

Estimating Token Usage

To estimate your costs, you need to understand how tokens are counted. A token is a basic unit of text that the model processes. For English text, one token is roughly equivalent to four characters. However, this ratio can vary depending on the language and the specific text content. You can estimate the number of tokens in your input by dividing the character count by four.

For example, if you have a prompt with 1,000 characters, you can estimate it contains approximately 250 tokens. If the model generates a response of 500 characters, that is about 125 tokens. You can then use the formula (tokens divided by 1,000,000 times the per-million price) to calculate the cost. This method gives you a rough estimate that is usually close to the actual token count.

It is also helpful to consider the context window, which is 100,000 tokens. This means you can send long prompts and receive long responses without hitting a limit. For content moderation, this allows you to process entire documents or long conversations in a single request. This can be more efficient than breaking down text into smaller chunks, which might increase the total token count due to overhead.

Keep in mind that the token count includes both the prompt and the completion. If you are processing a large volume of text, you should test your application with real data to get an accurate token count. This will help you refine your budget and ensure you have enough credit to cover your usage.

Budgeting for Production

When planning your budget, start by estimating the number of requests your application will handle. Consider the average length of the text you will moderate and the expected response length. Multiply these estimates by the number of requests to get a total token count. Then, apply the pricing formula to calculate the estimated cost.

It is wise to add a buffer to your budget to account for variations in usage. For example, if you estimate you will use 10 million tokens in a month, you might budget for 12 million tokens to cover spikes in traffic or unexpected usage. This buffer helps you avoid running out of credit during peak periods.

You can also use the trial credit of $0.50 to test your integration without committing to a purchase. This allows you to verify that your code works correctly and to get a feel for the token usage in a real-world scenario. Once you are confident in your integration, you can top up your account with crypto to start processing production traffic.

Remember that the top-up amounts range from $20 to $500. You can choose any whole amount within this range. If you top up with $50 or more, you may receive a bonus credit of 5% to 15%. This bonus can help you stretch your budget further and reduce the frequency of top-ups.

When This API Is Not the Right Choice

While our API is excellent for text-based content moderation, it may not be the right choice for all projects. If you need to moderate images, audio, or video, our API does not support these media types. You would need to use a different service that specializes in multimodal moderation to handle these formats.

Similarly, if you require fine-tuning the model to detect specific types of content unique to your domain, our API does not offer fine-tuning capabilities. You would need to look for a service that allows you to train custom models on your data. Our API uses a fixed uncensored model, which is great for general moderation but may not meet the needs of highly specialized use cases.

If you need real-time inference with extremely low latency for a large-scale application, you might consider a smaller, faster guardrail model. Some developers discuss using small, fast guardrail models for real-time applications to detect toxicity quickly. Our API is designed for high-quality moderation with a large context window, which may introduce more latency than a smaller model.

Finally, if you prefer to pay with credit cards or PayPal, our API only accepts crypto payments. You must top up with USDT on TRC20 or USDC on Base. If your team or company policy requires traditional payment methods, you might find another service that offers more flexible payment options.

Addressing Common Developer Questions

Developers often ask about the performance of guardrail models for real-time moderation. In threads on r/LocalLLaMA and r/LLMDevs, users discuss the importance of speed and accuracy when detecting unsafe content. They mention that small, fast guardrail models are ideal for real-time applications because they can process text quickly and detect 14 types of unsafe content.

Our API provides a reliable solution for text moderation, but it is not a guardrail model in the traditional sense. It uses a large, uncensored model to generate detailed moderation responses. This approach offers high accuracy and context awareness, but it may not be as fast as a dedicated guardrail model. Developers should weigh the trade-off between speed and depth of analysis when choosing a service.

Another common question is about the cost-effectiveness of using a large model for moderation. Some developers worry that the token usage will be too high, leading to increased costs. However, our pricing model is transparent, and you can estimate your costs accurately using the token count formula. This allows you to budget effectively and avoid surprise charges.

Users also ask about the reliability of the service. Our API offers a 300 requests per minute limit per key, which is sufficient for most applications. If you need higher throughput, you can use multiple keys to distribute the load. This flexibility allows you to scale your moderation system as your application grows.

Integrating with Your Application

Integrating our API into your application is straightforward. You can use the standard OpenAI-compatible endpoints to send requests. The base URL is https://api.contentmoderationapis.com/v1, and you can use the POST /v1/chat/completions endpoint to send your text for moderation. You need to include your API key in the Authorization header to authenticate your requests.

You can also use the streaming feature to receive responses in real-time. This is useful for applications that need to display moderation results as they are generated. The streaming response includes usage information in the last chunk, which helps you track your token consumption. You can implement this feature using Server-Sent Events (SSE) in your frontend or backend.

If you need to enforce specific output formats, you can use the JSON mode parameter. This ensures that the model returns a structured response that is easy to parse in your code. You can also set parameters like temperature, top_p, and stop sequences to control the model's behavior and improve the quality of the moderation results.

Don't forget to handle errors gracefully. The API returns specific error codes for different issues. A 401 error indicates an invalid key, a 402 error means you have no credit, and a 429 error indicates you have hit the rate limit. By handling these errors appropriately, you can ensure a smooth user experience even when things go wrong.

Optimizing Your Usage

To optimize your usage, consider the length of your prompts. Since the context window is 100,000 tokens, you can send long texts without hitting a limit. However, longer prompts may increase the token count and, consequently, the cost. Try to keep your prompts concise and focused on the relevant text. This can help reduce the number of tokens used and lower your costs.

Another way to optimize usage is to use the stop parameter to limit the length of the response. If you only need a short moderation result, you can set a stop sequence to terminate the response early. This can save tokens and reduce the processing time. Experiment with different stop sequences to find the best balance between completeness and efficiency.

You can also use the seed parameter to get consistent results for testing. This is useful when you are debugging your integration or testing different prompts. By setting a fixed seed, you can ensure that the model returns the same response for the same input, which makes it easier to identify and fix issues.

Finally, monitor your usage regularly to identify any patterns or anomalies. If you notice a sudden increase in token usage, it may indicate a problem with your integration or a spike in traffic. By keeping an eye on your usage, you can take proactive steps to manage your budget and ensure that your application runs smoothly.

Frequently asked questions

How much does it cost to use the API?

The API charges $0.15 per million input tokens and $0.50 per million output tokens. You pay only for the tokens used, and errors are free.

What payment methods are accepted?

We accept crypto payments only. You can top up with USDT on TRC20 or USDC on Base. Credit cards and PayPal are not supported.

Can I use the API for image moderation?

No, the API is text-only. It does not support image, audio, or video moderation. You need a different service for multimodal content.

What is the context window size?

The context window is 100,000 tokens, which includes both the prompt and the completion. This allows you to process long texts in a single request.