EN ▾
Get API key

Integrating the Uncensored Chat API for Developers

Developers often seek reliable ways to integrate uncensored language models into their applications. This guide covers the essential steps for connecting to the text-only chat endpoint. We focus on practical configuration details like headers and retry mechanisms.

Developer integrating an uncensored chat API with code and tokens

Understanding the Endpoint Structure

Before writing code, it is essential to understand the base URL and the specific endpoints available for integration. The service provides a hosted, OpenAI-compatible chat-completions API that serves a single uncensored open-weight text model. The primary endpoint for generating responses is POST /v1/chat/completions. This endpoint accepts text input and returns text output, making it straightforward to integrate into existing workflows that already support standard chat completions.

In addition to the chat endpoint, there is a POST /v1/responses endpoint and a GET /v1/models endpoint for verification. The base URL for all requests is https://api.gptnofilter.com/v1. It is important to note that this service does not support embeddings, image generation, audio processing, video generation, OCR, fine-tuning, or model routing. Keeping these limitations in mind helps developers set realistic expectations for the integration process.

The model identifier you must send in your requests is uncensored. This ensures that the correct model is selected for your queries. Since the API is uncensored, it does not refuse lawful adult, fictional, security-research, or controversial topics. However, there is a hard content limit regarding sexual content involving minors, which will be refused by the model. Understanding these boundaries is important for designing reliable application logic.

When integrating, ensure that your client library or HTTP client is configured to handle JSON payloads effectively. The API expects standard JSON formatting for both requests and responses. By sticking to the core chat endpoint and understanding the model identifier, you can avoid common integration errors. This focused approach allows for a cleaner and more maintainable codebase, especially when dealing with high-volume text generation tasks.

Configuring Authentication and Headers

Authentication for the API is handled via an API key, which is displayed immediately upon signup. You can sign up using Google or an email and password combination. The key is shown right after you create your account, so it is important to copy it securely. This key must be included in the HTTP headers of every request you make to the API. Without a valid key, you will receive a 401 error, indicating an invalid or missing key.

The standard way to pass the API key is through the Authorization header. Most SDKs and HTTP clients allow you to set this header globally or per-request. Ensure that the header format matches the expectations of the client library you are using. Typically, this involves prefixing the key with Bearer or using a specific header name like X-API-Key, depending on the library's configuration. Consistency in header usage prevents authentication failures during runtime.

It is also important to set the Content-Type header to application/json for POST requests. This informs the server that the payload is in JSON format. Failing to set this header correctly may result in parsing errors on the server side. Additionally, some clients may automatically set this header, but it is good practice to verify it explicitly, especially when using custom HTTP clients or lower-level libraries.

Remember that the API key is tied to your account and has a rate limit of 300 requests per minute. If you exceed this limit, you will receive a 429 error, indicating a rate limit violation. To avoid this, implement appropriate rate limiting in your application logic. This might involve queuing requests or adding delays between requests if you are processing large batches of data. Proper header configuration and rate management are key to a smooth integration experience.

Implementing Retry Logic

Network issues and server errors are inevitable in any distributed system. Implementing retry logic is a best practice to ensure reliability. The API returns specific error codes that can guide your retry strategy. A 401 error indicates an invalid key, which usually does not benefit from retrying unless the key was temporarily invalid. A 402 error means you have no credit, so retrying will not help until you top up. A 429 error indicates a rate limit, which suggests you should wait and retry after a delay.

For rate limit errors (429), it is common to implement an exponential backoff strategy. This means waiting for a short period, then doubling the wait time for subsequent retries. This helps prevent overwhelming the server when it is under load. You should also consider setting a maximum number of retry attempts to avoid infinite loops. If the API is down or returning 5xx errors, a similar backoff strategy can be effective.

It is important to distinguish between transient errors and permanent errors. Transient errors, like 429 or 5xx, are good candidates for retrying. Permanent errors, like 401 or 402, should not be retried without changing the underlying issue. For example, if you get a 402 error, you need to add credit before retrying. Implementing logic to handle these different error types ensures that your application behaves predictably.

When using SDKs, many libraries have built-in retry mechanisms. You can configure these to handle specific HTTP status codes. If you are using a custom HTTP client, you may need to write your own retry logic. This gives you more control over the retry behavior, such as the delay duration and the number of attempts. Proper retry logic helps maintain a smooth user experience even when the API experiences temporary hiccups.

Managing Tokens and Context Windows

The API has a context window of 100,000 tokens, which includes both the prompt and the completion. This is a significant capacity, allowing for long conversations or large documents. However, it is important to monitor token usage to manage costs effectively. The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Credits are prepaid, and errors and refusals are free, so you only pay for actual token usage.

To estimate costs, you can use the formula: (tokens divided by 1,000,000) times the per-million price. For example, if you send 10,000 input tokens, the cost is (10,000 / 1,000,000) * $0.15. This straightforward calculation helps you budget for your API usage. Since prepaid credit never expires, you can top up as needed without worrying about losing your balance.

Top-ups can be done using crypto only, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. There is also a bonus credit feature for top-ups of $50 or more, ranging from +5% to +15%. This bonus can help reduce your effective cost per token. Understanding these payment methods and limits is important for managing your account balance.

When designing your application, consider how you will handle token limits. If you exceed the context window, you may need to truncate previous messages or summarize older parts of the conversation. This is a common challenge in long-running chat applications. By monitoring token usage and implementing smart truncation strategies, you can ensure that your application stays within the context window limits while maintaining conversation quality.

Utilizing Advanced Features

The API supports several advanced features that can enhance your application's functionality. These include streaming over SSE (Server-Sent Events), function calling (tools), and JSON mode. Streaming allows you to receive responses in chunks, providing a better user experience for long responses. The usage information is included in the last chunk, so you can track token consumption in real-time.

Function calling enables the model to invoke specific functions based on the input. This is useful for building agents that can interact with external systems or perform specific tasks. You can define tools and let the model decide when to call them. This feature adds a layer of intelligence to your application, allowing it to perform actions beyond simple text generation.

JSON mode ensures that the output is valid JSON, which is useful for parsing responses in your application. You can also control the output using parameters like temperature, top_p, stop sequences, seed, and penalties. These parameters allow you to fine-tune the model's behavior, such as controlling creativity or enforcing specific output formats. Experimenting with these parameters can help you find the right balance for your use case.

When using these features, it is important to test them thoroughly. For example, when using streaming, ensure that your client can handle partial responses correctly. When using function calling, verify that the model calls the correct functions with the right arguments. These advanced features add power to your application but require careful implementation to work correctly.

When This API Is Not the Right Choice

While this API is powerful for text generation, it may not be the right choice for all use cases. If your application requires image generation, audio processing, or video creation, this text-only API will not suffice. Similarly, if you need embeddings for semantic search or fine-tuning for custom model behavior, this service does not offer those capabilities. Developers looking for a multi-modal solution should consider other options.

Additionally, if you need on-premises deployment for data privacy or compliance reasons, this hosted service may not fit your needs. The API is a cloud-based solution, so data is processed on the provider's servers. If you have strict data residency requirements, you might need to evaluate whether this trade-off is acceptable for your application.

Another consideration is the payment method. This service accepts crypto only, specifically USDT on TRC20 or USDC on Base. If your organization prefers traditional payment methods like credit cards, PayPal, or bank transfers, this might be a barrier to adoption. The prepaid credit system also means you need to manage your balance proactively, as there is no subscription or monthly fee.

Finally, if you need a service with a guaranteed SLA or specific certifications like SOC2 or HIPAA, this independent service does not claim those. It is an uncensored, open-weight model focused on flexibility and lack of refusal. For applications that require strict compliance or uptime guarantees, you may need to look for a more enterprise-focused provider. Always evaluate your specific needs before committing to this API.

Troubleshooting Common Issues

Even with careful integration, you may encounter issues. One common problem is authentication failures. If you receive a 401 error, double-check that your API key is correct and has not been expired or revoked. Ensure that the key is being passed in the correct header. Another common issue is rate limiting. If you hit the 300 requests per minute limit, you will receive a 429 error. Implementing exponential backoff can help you recover from this gracefully.

Another issue is running out of credit. A 402 error indicates that you have no credit left. Since errors and refusals are free, this error only occurs when you have no prepaid credit. You can top up using crypto to continue using the API. It is a good practice to monitor your credit balance and set up alerts if possible, so you are not caught off guard.

Context window limits can also cause issues if not managed properly. If your conversation exceeds 100,000 tokens, you may need to truncate older messages. This can lead to loss of context, so it is important to design your application to handle this gracefully. You might implement a strategy to summarize older parts of the conversation or drop the oldest messages.

Finally, ensure that your HTTP client is configured correctly for JSON payloads. Incorrect content types or malformed JSON can lead to parsing errors. Test your integration with simple requests before moving to complex scenarios. This helps isolate issues and ensures that your client is communicating with the API as expected. By addressing these common issues, you can build a more reliable and reliable integration.

Frequently asked questions

How do I authenticate with the API?

Include your API key in the Authorization header of your requests. The key is displayed immediately after signup. Ensure you use the correct header format for your HTTP client.

What happens if I exceed the rate limit?

You will receive a 429 error. Implement exponential backoff to wait and retry. The limit is 300 requests per minute per key.

Can I use this API for image generation?

No, this is a text-only API. It does not support image, audio, or video generation. It serves only the uncensored text model.

How is pricing calculated?

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Credits are prepaid, and errors are free. Use the token count to estimate costs.