EN ▾
Try with trial credit

Integrating Uncensored GPT API with Python and Node.js

Developers often seek reliable ways to connect their applications to uncensored language models without complex infrastructure. This guide provides a tested checklist for setting up SDKs and configuring endpoints for smooth text-in, text-out workflows using our hosted service.

Developer workspace showing API integration with code and digital nodes

Understanding the API Structure

Our service provides a hosted, OpenAI-compatible chat-completions API that serves a single uncensored open-weight text model. The primary model identifier you must send is "uncensored". This design ensures that every request follows a predictable pattern, making integration straightforward for developers familiar with standard chat interfaces. The API operates on a simple text-in, text-out basis, meaning you send a structured prompt and receive a generated response without additional complexity.

The base URL for all requests is https://api.gptuncensoredapi.com/v1. This endpoint handles all communication for your application. You will interact with three specific endpoints: POST /v1/chat/completions for generating text, POST /v1/responses for alternative response formats, and GET /v1/models to verify available models. Keeping these endpoints in mind helps you structure your HTTP clients correctly.

Unlike many competitors, our API does not support embeddings, image generation, audio processing, or video generation. It also lacks OCR, fine-tuning capabilities, and model routing features. This focus on pure text generation means the API is lightweight and fast. Developers who need multi-modal capabilities should look elsewhere, but for pure text workflows, this service offers a clean and efficient solution.

The context window supports up to 100,000 tokens for both the prompt and the completion combined. This large window allows for extensive context retention, which is useful for long conversations or processing large documents. However, it is important to monitor your token usage closely, as costs are based on actual token consumption. Understanding the token limit helps you design your application to stay within budget while maintaining performance.

Setting Up Authentication

Authentication is handled via API keys that are generated immediately upon signup. You can sign up using Google or by creating an account with an email and password. Once registered, your API key is shown immediately, allowing you to start making requests without delay. This key must be included in the Authorization header of every request you send to the API.

When making requests, ensure you use the correct HTTP method and headers. For POST requests to /v1/chat/completions, you must include the Authorization header with your Bearer token. This ensures that your requests are authenticated and processed correctly. If the key is invalid, the API will return a 401 error, indicating that the key is not recognized or has been revoked.

It is important to keep your API key secure and avoid exposing it in public repositories or client-side code. Since the key is the primary method of access, any unauthorized use will consume your prepaid credit. The API does not offer subscriptions or monthly fees, so your credit is charged based on real token usage. Errors and refusals are free, which helps protect your balance during testing.

If you encounter a 402 error, it means you have no credit left. In this case, you will need to top up your account before making further requests. The API supports crypto payments only, specifically USDT on TRC20 or USDC on Base. You can top up with any whole amount between $20 and $500. Bonus credit is available for top-ups of $50 or more, ranging from +5% to +15%. This flexible payment structure allows you to manage your budget effectively.

Integrating with Python

Integrating the API with Python is straightforward using the requests library or the official OpenAI Python SDK. Since the API is OpenAI-compatible, you can use the same code structure you would use for other OpenAI services. Simply set the base URL to https://api.gptuncensoredapi.com/v1 and provide your API key. This compatibility reduces the learning curve for developers who are already familiar with the OpenAI ecosystem.

When making requests, you can send parameters such as temperature, top_p, stop sequences, and seed. These parameters allow you to control the randomness and creativity of the model's responses. For example, setting the temperature to a lower value will make the output more deterministic, while a higher value will introduce more variability. Experimenting with these parameters helps you find the best settings for your specific use case.

Streaming responses are supported via Server-Sent Events (SSE). This feature allows you to receive the model's output in real-time, which is useful for chat applications or live text generation. The usage information, including token counts, is included in the last chunk of the stream. This allows you to track your token consumption accurately as the response is generated.

Function calling and JSON mode are also available, enabling you to integrate the API with structured data workflows. You can define tools or functions that the model can call, and the API will return the appropriate JSON response. This is particularly useful for building applications that require the model to extract data or perform specific actions based on the input. The API supports all standard parameters, making it a versatile tool for Python developers.

Integrating with Node.js

For Node.js developers, the integration process is similarly simple. You can use the axios library or the official OpenAI Node.js SDK to make requests. Set the base URL to https://api.gptuncensoredapi.com/v1 and include your API key in the headers. The OpenAI SDK's compatibility means you can reuse much of your existing code, making the transition smooth and efficient.

When handling responses in Node.js, you can process streaming data using the EventSource or similar libraries. This allows you to handle real-time updates from the API, which is essential for building responsive chat interfaces. The usage data is provided in the final chunk, allowing you to monitor your token usage and manage your credit balance effectively.

Function calling and JSON mode are supported in Node.js as well. You can define tools and functions that the model can invoke, and the API will return the corresponding JSON data. This feature is valuable for applications that require structured output, such as data extraction or automated workflows. The API's flexibility makes it suitable for a wide range of Node.js applications.

Error handling is important in any integration. The API returns specific error codes that help you diagnose issues. A 401 error indicates an invalid key, while a 402 error means you have no credit. A 429 error signifies that you have exceeded the rate limit of 300 requests per minute per key. Understanding these errors helps you build reliable applications that handle failures gracefully.

Managing Tokens and Costs

Understanding token usage is essential for managing costs with our API. The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This pricing structure is transparent and based on real usage, with no hidden fees or subscription costs. Prepaid credit is charged based on actual token consumption, ensuring you only pay for what you use.

To estimate costs, you can use the formula: (tokens divided by 1,000,000) times the per-million price. For example, if you use 10,000 input tokens, the cost is (10,000 / 1,000,000) * $0.15. This simple calculation helps you budget for your projects and avoid unexpected charges. It is also important to note that errors and refusals are free, which can save you money during testing phases.

The API supports a context window of 100,000 tokens, which allows for extensive context retention. However, larger contexts consume more tokens, so it is important to manage your input size carefully. You can optimize your prompts to reduce token usage while maintaining the quality of the output. This is particularly useful for applications that process large documents or long conversations.

Credit never expires, so you can top up your account whenever needed. The minimum top-up amount is $20, and the maximum is $500. You can pay using USDT on TRC20 or USDC on Base. Bonus credit is available for top-ups of $50 or more, ranging from +5% to +15%. This bonus credit can help you maximize your budget and get more value from your API usage.

When This API Is Not the Right Choice

While our API is powerful for text generation, it may not be the right choice for all developers. If you need multi-modal capabilities such as image, audio, or video generation, this service does not support those features. It is also not suitable for applications requiring OCR, fine-tuning, or model routing. Developers who need these capabilities should look for other solutions that offer a broader range of features.

Additionally, if you require a free unlimited tier, our API may not meet your needs. We offer a trial credit of $0.50 for new accounts, but ongoing usage requires prepaid credit. There is no free tier beyond the initial trial, so you will need to budget for your API usage. This makes the service more suitable for developers who are willing to pay for high-quality, uncensored text generation.

If you need an on-prem deployment solution, our hosted API may not fit your infrastructure requirements. We do not offer on-prem options, so you will need to integrate with our hosted service. This is a trade-off for the convenience of a managed service, but it may not be ideal for organizations with strict data residency or security requirements.

Finally, if you are looking for a service with named customers or benchmark scores, our API does not provide these metrics. We are an independent service focused on delivering high-quality text generation without the bells and whistles of larger competitors. This makes our API ideal for developers who value simplicity and reliability over extensive marketing and branding.

Addressing Common Developer Questions

Developers often ask about the best ways to set up uncensored AI models on local hardware or cloud instances. Threads on r/Qwen_AI and r/AskReddit discuss options like running local LLMs on Chromeboxes or renting GPU clusters. While running local models gives you full control, it requires significant hardware resources. Our API offers a hosted alternative that eliminates the need for local infrastructure, making it easier to get started without managing hardware.

Another common question is how to find reliable uncensored models when other services go offline. Users on r/deepweb have discussed the reliability of various tools, noting that some models may become unavailable. Our API provides a stable, hosted solution that ensures consistent access to the uncensored model. This reliability is a key advantage for developers who need a dependable service for their applications.

Developers also inquire about the best ways to integrate uncensored APIs into their workflows. Many users on r/AIJailbreak share their experiences with different models and prompt techniques. Our API supports standard parameters like temperature, top_p, and stop sequences, allowing you to customize the output to fit your needs. This flexibility makes it easy to integrate the API into existing projects with minimal changes.

Finally, developers often ask about the cost-effectiveness of using our API compared to other options. While local models can be cheaper in the long run, they require upfront investment in hardware. Our API offers a pay-as-you-go model with no monthly fees, making it cost-effective for developers who want to avoid hardware costs. The prepaid credit system ensures you only pay for what you use, providing financial flexibility and control.

Frequently asked questions

How do I get an API key?

You can sign up using Google or an email and password. Your API key is shown immediately after registration, allowing you to start making requests right away.

What payment methods are accepted?

We accept crypto payments only, specifically USDT on TRC20 or USDC on Base. You can top up with amounts between $20 and $500.

Does the API support streaming?

Yes, the API supports streaming over Server-Sent Events (SSE). Usage information is included in the last chunk of the stream.

What happens if I run out of credit?

If you have no credit, you will receive a 402 error. You can top up your account using crypto to resume making requests.