EN ▾
https://api.sdxlnsfw.cc/v1$0.15 per 1M input tokens$0.50 Output tokens / 1M100,000 token context
Get API key

Troubleshooting SDXL NSFW API Errors

Developers integrating uncensored text models often encounter errors that disrupt their workflows. This guide explains common issues like rate limits and invalid keys, offering clear steps to resolve them. We focus on practical troubleshooting for our API to help you maintain smooth operations.

Server rack with glowing blue LEDs representing an API endpoint

Understanding Common HTTP Errors

When integrating our API, you will likely encounter specific HTTP status codes that indicate the state of your request. The most common errors are 401, 402, and 429. A 401 error indicates an invalid key, which usually happens when the key is missing, expired, or incorrectly formatted in your authorization header. It is important to verify that you are sending the correct key immediately after signup.

A 402 error signals that you have no prepaid credit remaining. Since our service operates on a prepaid model with no monthly subscriptions, requests will fail once your balance hits zero. This is distinct from a subscription model where access might persist for a billing cycle. You must top up your credit to resume service.

The 429 error represents a rate limit violation. Our API allows 300 requests per minute per key. If you exceed this limit, subsequent requests will be rejected until the window resets. This limit applies to all endpoints, including chat completions and responses. Monitoring your request frequency is essential to avoid interruptions in your application.

These errors are designed to protect the service and ensure fair usage. By understanding each code, you can quickly identify whether the issue is authentication, billing, or traffic-related. This knowledge allows for faster debugging and a more stable integration experience for your users.

Managing Prepaid Credit and Payments

Our API uses a prepaid credit system charged by real token usage. Errors and refusals are free, meaning you only pay for actual token consumption. The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This model ensures you only pay for what you use, without hidden fees or monthly commitments.

To add credit, you must use 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. There are no options for credit cards, PayPal, or bank transfers. This crypto-only approach simplifies the billing process and reduces friction for international users.

When you top up from $50, you receive bonus credit ranging from 5% to 15%. This bonus is added to your account immediately. The credit never expires, so you can top up when prices are favorable or when you anticipate high usage. There is no need to worry about losing your balance due to inactivity.

New accounts receive $0.50 of trial credit, allowing you to test the API without immediate payment. This trial credit is sufficient for small tests but will be consumed quickly with larger context windows. Always check your balance before running heavy workloads to ensure uninterrupted service.

Handling Rate Limits and Streaming

Rate limits are a critical aspect of using our API efficiently. With a limit of 300 requests per minute, you can send multiple concurrent requests if needed. However, if you exceed this limit, you will receive a 429 error. It is important to implement exponential backoff in your code to handle these errors gracefully.

Our API supports streaming over Server-Sent Events (SSE). This allows you to receive responses in real-time, which is useful for chat interfaces. The usage information is included in the last chunk of the stream. You can parse this data to track token consumption and ensure you stay within your budget.

Function calling and JSON mode are also supported. You can define tools for your model to call, and the API will return structured data. This is particularly useful for building agents or automating tasks. Ensure your JSON schema is valid to avoid parsing errors on the client side.

Parameters like temperature, top_p, stop, and seed allow you to control the model's behavior. You can also set penalties to influence the output. Experiment with these settings to find the right balance for your use case. Proper configuration can help reduce the number of tokens used, saving you money.

Context Window and Token Management

Our API has a context window of 100,000 tokens, which includes both the prompt and the completion. This large window allows for extensive conversations and detailed inputs. However, it is important to manage your tokens efficiently to control costs. Each token counts towards your usage, so optimizing your prompts can lead to significant savings.

When sending requests, ensure that your input does not exceed the context window. If you do, the API may truncate the prompt or return an error. It is best to monitor the length of your inputs and compress them if necessary. You can use techniques like summarization to reduce the size of long documents.

The model id to send is "uncensored". This model does not refuse lawful adult, fictional, security-research, or controversial topics. However, there is a hard content limit: no sexual content involving minors. Requests violating this limit will be refused. Understanding these limits helps you design your application to avoid unnecessary refusals.

Token usage is calculated based on the actual tokens sent and received. You can estimate costs by dividing the token count by 1,000,000 and multiplying by the per-million price. This formula helps you budget for your projects. Keep track of your usage to ensure you have enough credit for your workloads.

When Our API Is Not the Right Choice

While our API is powerful for text generation, it may not be the right choice for all projects. If you need image, audio, video generation, embeddings, OCR, or fine-tuning, this service does not support those features. Our API is strictly for text input and output. You should look for other providers if your project requires these additional capabilities.

Additionally, if you require an SLA with specific uptime guarantees, our API may not meet your needs. We do not claim SLA percentages, certifications like SOC2 or HIPAA, or on-prem deployment options. If your business requires these guarantees, you should evaluate other vendors that offer them.

For projects that need model routing or multiple model support, our API serves only one uncensored open-weight text model. If you need to switch between different models based on performance or cost, this service may not be suitable. You would need a provider that offers model routing and multi-model support.

Finally, if you prefer traditional payment methods like credit cards or PayPal, our crypto-only payment system might be a barrier. We accept USDT on TRC20 or USDC on Base, with no card or bank transfer options. If your organization prefers fiat payments, you may need to find a provider that supports those methods.

Integration Best Practices for Developers

Integrating our API requires careful attention to detail. Always use the correct base URL: https://api.sdxlnsfw.cc/v1. The endpoints are POST /v1/chat/completions, POST /v1/responses, and GET /v1/models. Ensure that your requests include the correct headers and authentication keys. Misconfigured headers are a common source of errors.

Use the GET /v1/models endpoint to verify the available models. This can help you ensure that your application is compatible with the current API version. It is also a good practice to check the model details regularly, as updates may affect functionality.

Implement reliable error handling in your code. Catch 401, 402, and 429 errors and respond appropriately. For 401 errors, prompt the user to re-authenticate. For 402 errors, notify the user to top up their credit. For 429 errors, implement backoff logic to retry the request after a delay.

Test your integration thoroughly before deploying to production. Use the trial credit to test various scenarios, including streaming, function calling, and JSON mode. This helps you identify potential issues early and ensures a smooth user experience. Regular testing can prevent unexpected failures in your application.

Addressing Common Developer Questions

Developers often ask why they receive rate limits or invalid response errors during uncensored text generation. These issues are typically related to the API's usage policies and configuration. Understanding the root cause can help you resolve them quickly. For example, rate limits are enforced to ensure fair usage across all users.

Another common question is how to handle streaming responses. Our API supports streaming over SSE, which allows for real-time updates. You can parse the usage information in the last chunk to track token consumption. This is useful for monitoring costs and ensuring you stay within your budget.

Users also inquire about the differences between our API and other providers. While our API is uncensored and supports large context windows, it lacks features like image generation and fine-tuning. It is important to choose a provider that matches your specific needs. Always check the vendor's documentation for current prices and limits.

Finally, developers ask about the best practices for managing credit. Since our API uses a prepaid model, it is important to monitor your usage closely. You can estimate costs using the token count and per-million prices. This helps you avoid unexpected charges and ensures you have enough credit for your workloads.

Frequently asked questions

What causes a 401 error?

A 401 error indicates an invalid key. This usually happens when the key is missing, expired, or incorrectly formatted in your authorization header. Verify that you are sending the correct key immediately after signup.

How do I top up my credit?

You can top up your credit using crypto only. We accept USDT on the TRC20 network or USDC on the Base network. The minimum amount is $20, and the maximum is $500.

What is the context window size?

Our API has a context window of 100,000 tokens, which includes both the prompt and the completion. This allows for extensive conversations and detailed inputs.

Does the API support image generation?

No, our API serves only one uncensored open-weight text model. It does not support image, audio, video generation, embeddings, OCR, or fine-tuning. It is strictly for text input and output.