EN ▾

Uncensored text API for your pipeline

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

Integrating SDXL API: SDK Setup & Checklist

Developers often need a reliable text engine to drive SDXL workflows. This guide provides a tested checklist for integrating our uncensored text API into Python scripts, ensuring smooth text-in and text-out responses.

Developer workspace with AI code and crypto symbols

Why Use an Uncensored Text API for SDXL?

SDXL models excel at image generation but often struggle with complex prompt structures. An uncensored text API provides a dedicated engine to craft detailed prompts without the restrictions found in mainstream models. This separation allows you to generate rich, nuanced text inputs that SDXL can then interpret effectively. The model does not refuse lawful adult, fictional, or controversial topics, giving you full creative control over your output.

Our service serves a single uncensored open-weight text model accessible via the ID uncensored. This ensures consistency in your workflow, as you are not routed to different models with varying behaviors. The API is designed for text in and text out, making it ideal for generating the descriptive text that drives your image generation pipelines.

Unlike other services that offer embeddings or fine-tuning, this API focuses purely on high-quality text generation. This simplicity reduces complexity in your integration. You can rely on the model to handle the creative writing aspects while your SDXL instance handles the visual synthesis. This division of labor often leads to more predictable and higher-quality results.

When integrating, remember that the model is uncensored but respects a hard limit on sexual content involving minors. This boundary is enforced by the model itself. Understanding this limit helps you design your prompts and post-processing steps accordingly. It ensures that your final images align with your intended content guidelines without unexpected refusals for lawful adult themes.

Preparing Your Python Environment

Start by setting up a clean Python environment. Use a virtual environment to manage dependencies and avoid conflicts with other projects. Install the OpenAI Python SDK, as our API is fully compatible with its interface. This allows you to use familiar methods and structures for your requests. The SDK handles the HTTP communication and JSON parsing for you.

Ensure you have Python 3.8 or later installed. This version supports the type hints and features used in modern SDKs. You can verify your installation by running a simple script that imports the library. This step confirms that your environment is ready for the integration. It also helps identify any missing packages before you begin coding.

Configure your API key securely. Store it in an environment variable rather than hardcoding it in your script. This practice prevents accidental exposure if you share your code. The key is shown immediately after signup, so you can add it to your environment right away. This immediate availability allows you to start testing without delay.

Install any additional libraries you might need for image processing. While the API handles text, you will likely use libraries like Pillow or OpenCV to handle the SDXL outputs. Keeping these dependencies separate from the API SDK helps maintain a clean project structure. It also makes it easier to update each component independently as needed.

Authentication and API Key Management

Authentication is straightforward with our service. You can sign up using Google or an email and password. The API key is displayed immediately after signup, allowing you to copy it without waiting for an email. This key is essential for all requests to the API. Keep it secure and treat it like a password.

Include the key in the Authorization header of your requests. The format is typically Bearer your_api_key. Ensure there are no extra spaces or characters in the key. An invalid key will result in a 401 error. This error indicates that the key is missing or incorrect. Check your environment variables and header formatting if this occurs.

Our API does not support card, PayPal, or bank transfers. Payments are crypto-only, specifically USDT on TRC20 or USDC on Base. You can top up with whole amounts from $20 to $500. Bonus credit is available for larger top-ups. This prepaid model means you only pay for what you use, with no monthly fees.

Monitor your credit usage regularly. Errors and refusals are free, so you are not charged for failed requests. However, successful completions consume credit based on token usage. The trial credit of $0.50 is available for new accounts without a card. This allows you to test the integration before committing to a top-up. It is a low-risk way to verify your setup.

Making Your First API Request

Construct your request using the OpenAI SDK. Set the model ID to uncensored. This tells the API which model to use for generation. The endpoint for chat completions is /v1/chat/completions. You can also use /v1/responses for different response formats. Both endpoints support the same underlying model.

Define your prompt in the messages parameter. Use a system message to set the tone and constraints. For SDXL workflows, you might ask the model to generate a detailed description of a scene. Include specific details about lighting, style, and composition. This guidance helps the model produce text that SDXL can interpret effectively.

Set the stream parameter to true if you want real-time updates. Streaming over SSE allows you to receive tokens as they are generated. This is useful for long responses or for providing immediate feedback to users. The usage information is included in the last chunk of the stream. This allows you to track token consumption in real-time.

Handle the response carefully. The API returns JSON with the generated text. Parse this response and pass it to your SDXL script. Ensure that the text is clean and free of unwanted characters. You might need to post-process the text to format it correctly for SDXL. This step ensures that the image generation process runs smoothly without errors.

Handling Parameters and Options

The API supports several parameters to fine-tune the output. You can adjust the temperature to control creativity. Higher values produce more diverse outputs, while lower values are more deterministic. Use top_p to control the nucleus sampling. This parameter limits the probability mass of the tokens considered.

Use the stop parameter to define sequences that terminate the generation. This is useful for controlling the length of the output or stopping at specific markers. The seed parameter allows you to reproduce results. Set a seed to get consistent outputs for testing. This is invaluable for debugging and ensuring reproducibility in your workflows.

Penalties can be applied to discourage certain tokens. This helps in avoiding repetitive or unwanted phrases. Use these parameters to shape the model's output to your needs. Experiment with different combinations to find the optimal settings for your SDXL prompts. The API also supports JSON mode for structured outputs.

Function calling is supported, allowing you to integrate the API with other tools. You can define tools that the model can call during generation. This enables more complex workflows where the API interacts with other services. Use this feature to enhance your SDXL pipeline with dynamic data or external APIs. It adds flexibility to your integration.

When Our API Is Not the Right Choice

Our API is specialized for uncensored text generation. It does not support image, audio, video, or embedding generation. If you need a service that handles multiple modalities, this API is not the right choice. It focuses purely on text in and text out. For tasks requiring image generation or audio synthesis, you would need a different service.

The API also does not offer fine-tuning or model routing. If you need to train a custom model or route requests to different models based on content, this service does not support those features. It serves a single uncensored open-weight model. For advanced customization, you might need a platform that offers fine-tuning capabilities.

Additionally, the API has a context window of 100,000 tokens. While this is large, it may not be sufficient for extremely long documents or conversations. If your use case requires processing massive texts, ensure that your chunking strategy is efficient. The API handles long contexts well, but you must manage the input size appropriately.

Finally, payments are crypto-only. If you prefer using credit cards or PayPal, this service might not be convenient. You must use USDT on TRC20 or USDC on Base for top-ups. This limitation applies to all transactions, from the initial trial to larger purchases. Consider your payment preferences before integrating this API into your workflow.

Troubleshooting and Best Practices

Common errors include 401 for invalid keys and 402 for insufficient credit. If you encounter a 401, check your API key and header format. For 402 errors, top up your credit using crypto. The 429 error indicates a rate limit of 300 requests per minute. If you hit this limit, implement exponential backoff in your script.

Always handle errors gracefully in your code. Catch exceptions and log them for debugging. This helps you identify issues quickly and maintain a reliable integration. Use the /v1/models endpoint to verify the available models. This ensures that your script is using the correct model ID.

Test your integration with small prompts before scaling up. This allows you to verify that the text output is correct and that the SDXL pipeline works as expected. Once you are confident in the results, you can increase the volume of requests. Monitor your token usage to manage your credit effectively.

Keep your SDK and dependencies up to date. This ensures compatibility with the API and access to the latest features. Review the API documentation regularly for any updates or changes. Staying informed helps you adapt your integration to new requirements. This proactive approach minimizes disruptions in your workflow.

Frequently asked questions

How do I authenticate with the SDXL API?

Include your API key in the Authorization header as a Bearer token. You can obtain this key immediately after signing up with Google or email. Keep it secure and do not share it publicly.

What payment methods are accepted?

The API accepts only crypto payments: USDT on TRC20 or USDC on Base. You can top up with amounts between $20 and $500. Credit cards and PayPal are not supported.

Does the API support image generation?

No, the API is for text only. It generates text prompts that you can send to an SDXL model for image generation. It does not produce images, audio, or videos itself.

What is the context window size?

The context window is 100,000 tokens, including both prompt and completion. This allows for long conversations and detailed prompt generation within a single request.