Integrating Wan Uncensored API: SDK Setup & Checklist
Engineers often seek a reliable path for integrating OpenAI-compatible endpoints into their pipelines. This guide provides a concrete setup for our uncensored text API, covering SDK configuration, key parameters, and a validation checklist to ensure consistent text-in, text-out performance.
Initial SDK Configuration
Starting your integration begins with configuring your software development kit (SDK) to point to the correct endpoint. Our API uses a standard OpenAI-compatible structure, which means you can likely use existing client libraries without major modifications. The base URL for all requests is https://api.wanuncensored.top/v1. You will need to set this in your environment variables or configuration files to ensure your application knows where to send requests.
Once the base URL is set, you must authenticate your requests. Our API uses an API key for authentication, which you receive immediately after signing up. You can sign up using Google or an email and password combination. The key is displayed right after creation, so make sure to copy it securely. This key must be included in the Authorization header of every request you make to the API.
It is important to note that our service is independent and not affiliated with any major tech company. While we follow standard conventions, always verify the current documentation for any updates. The model ID you need to send in your requests is simply "uncensored". This tells the system which open-weight text model to use for generating responses.
After setting the base URL and authentication, you should test the connection. A simple GET request to /v1/models will confirm that your credentials are valid and that you can reach the service. This step helps identify any network issues or incorrect key configurations before you look at more complex generation tasks.
Core Parameters for Text Generation
When making POST requests to /v1/chat/completions, you need to understand the core parameters that control how the model generates text. Our API supports several standard parameters that allow you to fine-tune the output. These include temperature, top_p, stop sequences, seed, and various penalties. Adjusting these settings can help you achieve the desired tone and structure for your text.
The temperature parameter controls the randomness of the output. A higher value makes the output more random, while a lower value makes it more focused and deterministic. The top_p parameter works similarly, controlling the diversity of the output by limiting the consideration of tokens to those with a cumulative probability above a certain threshold. These settings are important for balancing creativity and consistency in your generated text.
You can also use stop sequences to halt generation when a specific string is encountered. This is useful for controlling the length of the output or for stopping generation at specific markers. The seed parameter allows you to reproduce the same output for the same input, which is helpful for testing and debugging. Penalties can be used to discourage certain types of words or phrases in the output.
Our API serves one uncensored open-weight text model, which means it does not refuse lawful adult, fictional, security-research, or controversial topics. However, there is a hard content limit: requests involving sexual content with minors will be refused. Understanding these limits helps you design your application to handle refusals gracefully and manage user expectations.
Streaming and Real-Time Updates
For applications that require real-time feedback, our API supports streaming over Server-Sent Events (SSE). This allows you to receive tokens as they are generated, rather than waiting for the entire response to complete. Streaming is particularly useful for chat interfaces, where users expect immediate feedback. It also helps in managing latency, as users can start reading the response while it is still being generated.
When using streaming, the usage information (token counts) is included in the last chunk of the response. This means you need to handle the final chunk carefully to get the accurate token count for billing purposes. The API charges based on real token usage, so accurate tracking is essential for managing your prepaid credit.
To implement streaming, you need to set the appropriate headers in your HTTP request. The SDK you are using should have built-in support for SSE, which simplifies the process. You can listen for events and process the tokens as they arrive. This approach ensures that your application remains responsive and provides a smooth user experience.
Streaming also allows you to implement features like cancellation. If a user decides to stop the generation, you can close the connection and stop processing further tokens. This saves resources and improves the overall efficiency of your application. Make sure to handle connection closures gracefully to avoid leaks or errors.
Function Calling and JSON Mode
Our API supports function calling, which allows you to define tools that the model can invoke. This is useful for applications that need to interact with external systems or perform specific actions based on the text input. You can define the structure of the function calls in your request, and the model will return the appropriate arguments.
In addition to function calling, our API supports JSON mode. This ensures that the output is valid JSON, which is useful for parsing and processing the response in your application. JSON mode is particularly helpful when you need to extract structured data from the text, such as entities, dates, or other specific information.
When using function calling, you need to provide the function definitions in the request. The model will then decide whether to call a function and what arguments to pass. This allows for more dynamic and interactive applications, where the model can trigger actions based on the context of the conversation.
It is important to test your function calling setup thoroughly to ensure that the model is invoking the correct functions with the correct arguments. You can use the seed parameter to reproduce the same behavior for debugging. Additionally, make sure to handle cases where the model does not call a function, as this might require fallback logic in your application.
Pricing, Credits, and Limits
Understanding the pricing model is important for managing your budget. Our API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Credits are prepaid and charged based on real token usage. Errors and refusals are free, which means you only pay for successful generations. There is no monthly subscription fee, and paid credit never expires.
To add credit to your account, you can use crypto only. We accept USDT on the TRC20 network or USDC on the Base network. You can top up with any whole amount from $20 to $500. If you top up from $50, you receive a bonus credit ranging from +5% to +15%. This makes larger top-ups more cost-effective.
Our API has a rate limit of 300 requests per minute per key. This limit ensures fair usage and prevents abuse. If you exceed this limit, you will receive a 429 error. You can monitor your usage and adjust your request rate accordingly. It is also important to handle rate limit errors gracefully in your application by implementing retry logic with exponential backoff.
New accounts receive $0.50 of trial credit, which allows you to test the API without any initial investment. This trial credit has no card requirement, making it easy to get started. However, note that the trial credit is limited, so you will need to top up to continue using the service for more extensive testing or production use.
When Our API Is Not the Right Choice
While our API is excellent for uncensored text generation, it may not be the right choice for every use case. Our service is designed for text-in, text-out scenarios. If you need embeddings, image generation, audio, video generation, OCR, or fine-tuning, our API does not support these features. You would need to use a different service for those capabilities.
Additionally, if you require an SLA (Service Level Agreement) with specific uptime guarantees, our API does not provide one. We do not claim any SLA percentages, certifications like SOC2 or HIPAA, or on-prem deployment options. If these are critical for your business, you might need to consider other providers.
Our API also does not offer model routing, meaning you cannot switch between different models dynamically. You are limited to the single uncensored open-weight text model we provide. If you need the flexibility to choose from multiple models, this might be a limitation.
Finally, if you need a free unlimited tier, our API is not the right choice. We operate on a prepaid credit model, and while we offer a small trial credit, all other usage requires payment. For applications that require a free tier with no usage limits, you might need to explore other options.
Validation Checklist and Error Handling
To ensure your integration is reliable, you should follow a validation checklist. First, verify that your API key is correct and that you can successfully authenticate with the API. Second, test the basic text generation functionality to ensure that the model is responding as expected. Third, check the streaming functionality to ensure that tokens are being received in real-time.
Error handling is important for a reliable integration. Our API returns specific error codes for different issues. A 401 error indicates an invalid key, so make sure your key is correct. A 402 error means you have no credit, so you need to top up your account. A 429 error indicates that you have exceeded the rate limit, so you may need to slow down your requests.
It is also important to handle network errors and timeouts gracefully. Implement retry logic with exponential backoff to handle transient errors. Additionally, log your requests and responses for debugging purposes. This will help you identify issues and optimize your integration over time.
Finally, test your application with various inputs to ensure that it handles different scenarios correctly. This includes testing with long prompts, short prompts, and edge cases. By following this checklist, you can ensure that your integration is reliable and performs well under different conditions.
Frequently asked questions
How do I get started with the API?
Sign up using Google or email to receive an API key immediately. Set the base URL to https://api.wanuncensored.top/v1 and include your key in the Authorization header. You can then make your first request to /v1/models to verify connectivity.
What payment methods are accepted?
We accept crypto only: USDT on TRC20 or USDC on Base. You can top up with amounts between $20 and $500. New accounts receive $0.50 in trial credit with no card required.
Does the API support streaming?
Yes, the API supports streaming over Server-Sent Events (SSE). This allows you to receive tokens in real-time, which is ideal for chat interfaces. Usage data is included in the final chunk of the stream.
What happens if I exceed the rate limit?
If you exceed 300 requests per minute per key, you will receive a 429 error. You should implement retry logic with exponential backoff to handle this gracefully and avoid overwhelming the service.