Integrating Dolphin Uncensored with Python SDK
Connecting to an uncensored endpoint can feel daunting when you need reliable text generation without the usual filters. This guide provides a tested checklist of SDK settings, headers, and a working code snippet to get your first response.

Understanding the API Structure
Before writing any code, it is essential to understand the structure of the API endpoint. Our service provides a hosted, OpenAI-compatible chat-completions API. This means you can use standard libraries that expect an OpenAI-style interface. The base URL for all requests is https://api.dolphinuncensoredllm.com/v1. You do not need to worry about complex routing or multiple endpoints for different models.
The API serves one uncensored open-weight text model. When you send a request, you must specify the model ID as 'uncensored'. This ensures you are connecting to the correct model that does not refuse lawful adult, fictional, security-research, or controversial topics. The interface is strictly text in, text out, which simplifies integration for developers who only need text generation.
It is important to note that this API does not support embeddings, image generation, audio, video, OCR, fine-tuning, or model routing. If you need those features, you will need to look elsewhere. For this integration, we focus solely on text completion and chat interactions. The simplicity of having a single model ID reduces configuration errors and makes debugging easier.
When you start integrating, ensure your Python environment has the necessary libraries installed. The standard requests library or a dedicated SDK can be used. The key is to match the headers and payload structure expected by the API. This ensures that your requests are processed correctly and you receive the expected text responses without unnecessary delays or errors.
Authentication and Key Management
Authentication is handled via an API key that you generate during signup. You can sign up using Google or an email and password combination. Once registered, the key is shown immediately, so make sure to copy it securely. This key is required for all API calls. If you send a request without a valid key, you will receive a 401 invalid key error.
The key must be included in the Authorization header of your HTTP requests. This is a standard practice in API development. Ensure that you do not expose your key in public repositories or client-side code. Keep it secure and use environment variables to store it in your Python scripts. This prevents accidental leaks and ensures that your account remains secure.
If you do not have sufficient credit, the API will return a 402 no credit error. You can top up your account using crypto, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. There is no monthly fee, and prepaid credit never expires. This allows you to pay only for what you use.
Errors and refusals are free, meaning you are not charged for tokens in failed requests. However, rate limits are enforced. If you exceed 300 requests per minute per key, you will receive a 429 rate limit error. This limit helps maintain service stability. Monitor your usage to ensure you stay within these bounds, especially if you are running automated scripts or batch processing tasks.
Configuring the Python SDK
Setting up the Python SDK involves configuring the base URL and the API key. You should create a client instance that points to https://api.dolphinuncensoredllm.com/v1. This client will handle the communication with the server. Make sure to set the model parameter to 'uncensored' in your client configuration. This ensures that all requests are directed to the correct model.
When configuring the SDK, pay attention to the parameters that control the generation behavior. You can adjust the temperature, top_p, stop sequences, and seed. These parameters allow you to fine-tune the output of the model. For example, a higher temperature will result in more creative and varied responses, while a lower temperature will produce more deterministic outputs.
JSON mode is also supported, which is useful if you need structured data from the API. You can enable this mode to ensure that the output is valid JSON. This is particularly helpful when integrating with other systems that expect structured data. The API supports function calling as well, allowing you to define tools that the model can use.
Streaming over Server-Sent Events (SSE) is another important feature. This allows you to receive the response in chunks as it is generated. This is useful for real-time applications where you want to display the output to the user as it is being typed. The usage information is included in the last chunk of the stream, which helps you track your token consumption accurately.
Writing the First Request
Writing your first request is straightforward once you have the SDK configured. You need to construct a payload that includes the messages you want to send to the model. The messages should be in the format expected by the API, typically a list of dictionaries with roles and content. The model will then generate a response based on these messages.
Make sure to include the model ID 'uncensored' in your request. This is important for ensuring that you are using the correct model. The API will process your request and return a response. If you encounter any errors, check the status codes. A 401 error indicates an invalid key, a 402 error indicates no credit, and a 429 error indicates a rate limit exceeded.
It is important to handle exceptions in your code. If the API returns an error, your script should log the error and handle it appropriately. This could mean retrying the request, notifying the user, or stopping the process. Proper error handling ensures that your application remains stable and reliable.
When you receive the response, you can extract the text from the message object. This text is the output of the model. You can then process this text as needed, whether it is displaying it to the user, saving it to a database, or sending it to another service. The simplicity of the text-in, text-out interface makes this step easy to implement.
Handling Streaming Responses
Streaming responses are a powerful feature of the API. By enabling streaming, you can receive the output in real-time as it is generated. This is particularly useful for chat applications where you want to show the user the response as it is being typed. The API uses Server-Sent Events (SSE) to stream the data.
To implement streaming, you need to set the stream parameter to true in your request. The API will then send a series of chunks, each containing a part of the response. You can process each chunk as it arrives, updating the user interface in real-time. This creates a smoother and more engaging user experience.
One important detail to note is that the usage information is included in the last chunk of the stream. This means you can track your token consumption accurately by aggregating the usage data from the final chunk. This helps you manage your prepaid credit and avoid unexpected charges.
When handling streaming responses, ensure that your code can handle partial responses. If the connection is interrupted, you may need to resume the stream or handle the partial data gracefully. This requires careful error handling and state management in your Python script. Properly managing streaming responses ensures that your application remains responsive and reliable.
When This API Is Not the Right Choice
While our API is excellent for text generation, it may not be the right choice for everyone. If you need features like image generation, audio processing, or video creation, this API will not meet your needs. The service focuses solely on text-in, text-out interactions. If your project requires multimodal capabilities, you should look for a provider that offers those specific features.
Additionally, if you need fine-tuning capabilities to customize the model for your specific domain, this API does not support fine-tuning. The model is fixed, and you cannot train it on your own data. If fine-tuning is a critical requirement for your application, you should consider other options that offer this functionality.
Another consideration is the payment method. We accept only crypto, specifically USDT on TRC20 or USDC on Base. If you prefer to pay with credit cards, PayPal, or bank transfers, this API may not be suitable for you. The prepaid credit system also means you need to manage your balance carefully, as there is no monthly subscription.
Finally, if you need a service with a specific SLA or certifications like SOC2 or HIPAA, this API does not offer those guarantees. It is an independent service focused on providing uncensored text generation. If your organization has strict compliance requirements, you should verify that this API meets those needs before integrating it into your workflow.
Troubleshooting Common Issues
When integrating the API, you may encounter common issues such as rate limits or authentication errors. If you receive a 429 rate limit error, it means you have exceeded the 300 requests per minute limit. To resolve this, you can implement exponential backoff in your code to wait before retrying the request. This helps prevent overwhelming the API and ensures that your requests are processed smoothly.
Authentication errors, indicated by a 401 status code, usually mean that your API key is invalid or missing. Double-check that you are using the correct key and that it is included in the Authorization header. If you have lost your key, you can generate a new one from your account dashboard.
If you encounter a 402 no credit error, it means your account has insufficient funds. You can top up your account using crypto to continue using the API. Remember that errors and refusals are free, so you are not charged for failed requests. This allows you to experiment with the API without worrying about excessive costs.
Another common issue is handling the response format. Ensure that you are parsing the response correctly, especially when using JSON mode or streaming. If the response is not in the expected format, your code may fail to process it. Always validate the response structure before using the data in your application. This helps ensure that your integration is reliable and reliable.
Frequently asked questions
What is the model ID for the uncensored model?
The model ID is 'uncensored'. You must specify this ID in your requests to ensure you are using the correct model.
How can I top up my credit?
You can top up your credit using USDT on TRC20 or USDC on Base. The minimum amount is $20, and the maximum is $500.
What happens if I exceed the rate limit?
If you exceed 300 requests per minute, you will receive a 429 rate limit error. You should implement backoff strategies to handle this gracefully.
Does the API support streaming?
Yes, the API supports streaming over Server-Sent Events (SSE). This allows you to receive responses in real-time as they are generated.