EN ▾

Uncensored text API for your pipeline

Base URLhttps://api.sdxlapi.com/v1Modeluncensored
Get API key

SDXL API Cost Estimation & Budgeting Guide

Developers often ask how to predict token usage for large-scale SDXL prompt generation to avoid surprise bills. This article teaches a method for estimating input and output token volume using our pricing model, complete with a worked example to help you budget effectively. You will learn to calculate costs based on token counts rather than fixed fees.

Developer workspace with laptop showing token counting code and floating digital tokens

Understanding Our Pricing Model

Our API charges based on actual token usage rather than a fixed subscription fee. This pay-as-you-go model is ideal for developers who want predictable costs without monthly commitments. You pay $0.15 per one million input tokens and $0.50 per one million output tokens. This structure allows you to scale your usage up or down without penalty.

Unlike services that charge per request, our pricing depends on the volume of text processed. A single request with a short prompt and a brief response costs very little. However, large-scale batch processing of SDXL prompts can accumulate tokens quickly. Understanding this distinction helps you forecast expenses more accurately.

The API uses a prepaid credit system. You top up with cryptocurrency, and the balance is deducted as you make requests. Errors and refusals do not consume credits, which saves money when testing parameters or handling edge cases. This feature is particularly useful during the development phase when you might send invalid requests frequently.

There are no hidden fees or monthly minimums. Your prepaid credit never expires, so you can pause development and resume later without losing your funds. This flexibility supports indie builders who work in bursts rather than continuous high-volume production. You control your budget by managing your top-up amounts and monitoring token consumption.

Calculating Input and Output Tokens

To estimate your costs, you must first understand how tokens are counted. Tokens include both the text you send in the prompt and the text the model generates in the response. The API processes these together within a context window of 100,000 tokens. This limit applies to the combined total of input and output tokens in a single request.

Input tokens consist of the system instructions, the user prompt, and any additional parameters like function definitions. For SDXL prompt generation, your input might include the base prompt, style descriptors, and negative prompts. You can estimate this volume by counting the words and dividing by a standard token-to-word ratio, though exact counts depend on the tokenizer used.

Output tokens are generated by the model based on your prompt. The length of the response varies depending on the complexity of the SDXL prompt you are generating. A simple prompt might yield a short output, while a detailed scene description could produce a longer response. You should budget for the maximum expected output length to avoid running out of credits mid-generation.

By tracking both input and output volumes, you can predict your monthly spend. Use the API's response headers or the usage field in the final chunk of streaming responses to monitor token consumption in real time. This data helps you refine your prompts and optimize token usage for better cost efficiency.

Worked Example: Budgeting for SDXL Prompts

Let us walk through a practical example to show how to calculate costs. Suppose you want to generate 1,000 SDXL prompts. Each prompt takes approximately 200 input tokens. This results in 200,000 input tokens for the batch. At $0.15 per million input tokens, the cost for input is calculated by dividing 200,000 by 1,000,000 and multiplying by $0.15.

Now consider the output. If each generated prompt averages 100 tokens, the total output volume is 100,000 tokens. The cost for output is found by dividing 100,000 by 1,000,000 and multiplying by $0.50. This method gives you a precise estimate of your expenses without guessing. You can adjust the token counts based on your actual usage data for greater accuracy.

Combine the input and output costs to get the total for the batch. This approach ensures you do not underestimate your budget. It also highlights the impact of output length on cost, as output tokens are more expensive than input tokens. By optimizing your prompts to reduce unnecessary output, you can lower your overall spend.

Remember that errors and refusals are free. If some requests fail due to rate limits or invalid parameters, you do not pay for those tokens. This safety net protects your budget during testing phases. Always monitor your usage to ensure you stay within your planned budget.

Managing Credits and Top-Ups

Our API requires prepaid credit, which you can top up using cryptocurrency. We accept USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. You can choose any whole amount within this range. This flexibility allows you to manage your cash flow according to your project needs.

New accounts start with $0.50 of trial credit, which requires no credit card. This allows you to test the API immediately without financial commitment. If you top up from $50, you receive a bonus credit ranging from 5% to 15%. This bonus provides extra value for larger investments and supports long-term projects.

Since there is no monthly fee, your credit remains available until you use it. There is no expiration date, so you can top up when prices are favorable or when you anticipate high usage. This feature is beneficial for developers who work on projects with irregular timelines. You can accumulate credits during quiet periods and use them during peak development.

Keep track of your balance to avoid unexpected service interruptions. The API returns a 402 error when you have no credit, so you can plan your top-ups in advance. By understanding the top-up process and bonus structure, you can maximize the value of your investment in the API.

When Our API Is Not the Right Choice

While our API excels at text generation, it is not designed for image, audio, or video processing. If you need to generate images directly, you should look for a dedicated image generation API. Our service provides the text prompts that can be used with other tools, but it does not render the images itself.

Similarly, if you require embeddings for semantic search or fine-tuning models for specific tasks, our API does not support these features. We offer a straightforward chat-completions interface for text in and text out. Developers needing advanced model routing or OCR capabilities should evaluate other providers.

Our uncensored model is optimized for creative and controversial topics, but it does not guarantee specific benchmark scores or SLA percentages. If your project requires strict compliance with SOC2 or HIPAA standards, or if you need on-prem deployment, our hosted service may not meet those requirements. Check the documentation of other vendors for these specific features.

Finally, if you need real-time audio or video generation, our text-only API is not suitable. We focus on high-quality text outputs for SDXL prompts and other use cases. For multimedia projects, consider integrating our API for text generation alongside other specialized tools. This hybrid approach allows you to use our strengths in text while using other services for media.

Integrating with SDXL Workflows

Integrating our API into your SDXL workflow involves sending POST requests to /v1/chat/completions. You can use the model ID 'uncensored' to access our open-weight model. The API supports streaming over SSE, which allows you to receive responses in real time. This is useful for monitoring progress and handling large outputs efficiently.

You can also use function calling to structure your outputs. This feature is helpful when generating structured data for SDXL prompts. By defining tools in your request, you can ensure consistent formatting. The API supports JSON mode, which simplifies parsing the response in your application code.

Parameters like temperature, top_p, and seed allow you to control the creativity and reproducibility of the outputs. Adjusting these settings can help you achieve the desired style for your SDXL prompts. You can also set stop sequences to truncate responses at specific points, which helps manage token usage.

Rate limits are set at 300 requests per minute per key. If you exceed this limit, you will receive a 402 error. Plan your batch processing to stay within this limit. You can spread requests over time or use multiple keys if necessary. This ensures smooth operation for large-scale SDXL prompt generation tasks.

Troubleshooting and Best Practices

Common issues include invalid keys, insufficient credit, and rate limits. A 401 error indicates an invalid key, so verify your API key is correct. A 402 error means you have no credit, so check your balance. A 429 error signals a rate limit, so wait before retrying. These errors help you diagnose problems quickly.

To avoid surprises, monitor your token usage regularly. Use the usage field in the streaming response to track consumption. This data helps you identify inefficient prompts or excessive output lengths. By optimizing your inputs, you can reduce costs and improve performance.

Always handle errors gracefully in your code. Retry logic can help manage transient errors like rate limits. However, avoid infinite loops that could consume your credit. Set a reasonable number of retries and a timeout period. This ensures your application remains responsive and cost-effective.

Finally, take advantage of the trial credit to test your integration. Use the $0.50 trial to verify your API calls and parameter settings. This low-risk approach allows you to validate your workflow before committing to larger top-ups. It is a smart way to ensure your SDXL prompt generation system works as expected.

Frequently asked questions

How do I calculate the cost of a single API request?

Multiply the number of input tokens by $0.15 and the number of output tokens by $0.50, then divide each by one million. Add the two results to get the total cost for that request.

What happens if I run out of credit?

The API returns a 402 error, and your requests will fail. You can top up with USDT or USDC to restore service. Errors and refusals do not consume credit, so you only pay for successful token processing.

Can I use the API for image generation?

No, our API is text-only. It generates prompts that can be used with other image generation tools. If you need direct image generation, you should use a dedicated image API alongside our text service.

How do I top up my account?

You can top up using USDT on TRC20 or USDC on Base. The minimum amount is $20, and the maximum is $500. You can also receive bonus credit if you top up $50 or more.