EN ▾
Get API key

Unrestricted API Troubleshooting Guide

When integrating an uncensored API into your backend, the most common failures stem from incorrect base URLs, misconfigured streaming parsers, or misunderstanding token limits. This guide resolves these specific technical friction points so you can swap in a drop-in replacement for OpenAI's chat completions without rewriting your integration layer.

Unrestricted API Troubleshooting Guide

Updated

Key points

  1. Use the correct base URL https://api.unrestrictedgpt.cc/v1 and send requests to the /v1/chat/completions endpoint, not the base URL itself.
  2. Streaming responses require parsing Server-Sent Events (SSE); token usage data appears only in the final chunk, not every chunk.
  3. JSON mode validation errors occur when the model outputs non-JSON text; use the 'response_format' parameter to enforce strict JSON output.
  4. Rate limits are enforced per key with a concurrency limit of 8 simultaneous requests and a cap of 300 requests per minute.

Why Your Base URL Might Be Wrong

Many developers assume the base URL is the endpoint. This is incorrect. The base URL for our service is https://api.unrestrictedgpt.cc/v1. The actual endpoint for generating text is POST /v1/chat/completions. If you append /v1/chat/completions to the base URL incorrectly, you will receive a 404 or 405 error.

Ensure your SDK configuration sets the base URL to the full domain path. For example, in Python using the OpenAI SDK, you would set base_url="https://api.unrestrictedgpt.cc/v1". The SDK will automatically append /chat/completions when you call client.chat.completions.create(). Do not manually append the path unless you are making raw HTTP requests.

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedgpt.cc/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Using the correct base URL ensures your requests reach the uncensored model routing layer. If you are migrating from another provider, verify that your base URL matches the target API's documentation exactly. Mismatched base URLs are the most common cause of initial integration failures.

Handling Streaming Responses Correctly

Streaming returns a series of Server-Sent Events (SSE). Each chunk contains a partial delta of the response. A common mistake is assuming every chunk contains token usage data. Token usage information is only present in the final chunk of the stream.

Parse the SSE stream line by line. Look for lines starting with data: . If the line is data: [DONE], the stream has ended. Parse the JSON object from each data line to extract the token delta. Do not attempt to parse the final chunk for usage data until you have received the [DONE] signal or confirmed it is the last chunk.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Accurate stream handling prevents memory leaks and ensures you can track token consumption correctly. If you are using a third-party SDK, ensure it supports SSE parsing. Otherwise, you may need to implement a custom parser.

Debugging Function Calling Failures

Function calling relies on the model outputting valid JSON that matches your provided schema. If the model outputs invalid JSON or misses required fields, the function call will fail. This is common with uncensored models that may prioritize creativity over strict schema adherence.

Ensure your function definitions are precise. Use the tool_choice parameter to force the model to call a function if needed. If the model refuses to call a function, it may be due to the prompt's context or the model's training data. Try adjusting the temperature parameter to lower values for more deterministic output.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.unrestrictedgpt.cc/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Always validate the model's output against your schema before executing the function. If validation fails, retry the request with a lower temperature or provide explicit instructions in the system prompt to adhere to the schema. This reduces the likelihood of parsing errors.

Understanding Token Limits

The context window is 100,000 tokens, combining prompt and completion. There is no separate output cap. If you do not set the max_tokens parameter, the response can run to the end of the window. The 100,000-token window is a hard limit, not a suggestion.

Exceeding the context window results in an error, not truncation. Ensure your input tokens plus the desired output tokens do not exceed 100,000. Monitor your token usage closely, as uncensored models may generate longer responses than fine-tuned models. Use the max_tokens parameter to control output length precisely.

curl https://api.unrestrictedgpt.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Token counting can be complex due to special characters and encoding. Use a reliable tokenizer library to count tokens accurately. This prevents unexpected errors and ensures you stay within your rate limits and context window constraints.

JSON Mode Validation Errors

When using JSON mode, the model is instructed to output strictly valid JSON. However, uncensored models may still produce minor formatting errors, such as trailing commas or missing quotes. These errors cause validation failures in your application.

Use the response_format parameter set to {"type": "json_object"}. This instructs the model to output JSON. If validation fails, try post-processing the output to fix common JSON errors. You can also adjust the temperature to lower values to encourage more deterministic output.

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedgpt.cc/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Always handle JSON parsing errors gracefully. If the output is invalid, log the error and retry the request. This ensures your application remains solid even when the model produces imperfect JSON. JSON mode is a helpful tool, but not a guarantee of perfect output.

Rate Limiting and Concurrent Requests

Our API enforces a rate limit of 300 requests per minute per key. Additionally, there is a concurrency limit of 8 simultaneous requests per key. Exceeding these limits results in 429 Too Many Requests errors.

Monitor your request volume and concurrency. If you are experiencing frequent 429 errors, reduce your request rate or increase the concurrency limit by upgrading your plan. Use exponential backoff when retrying failed requests to avoid overwhelming the server.

curl https://api.unrestrictedgpt.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Rate limiting is essential for maintaining service stability. Ensure your application handles 429 errors gracefully. Implementing a retry mechanism with exponential backoff is the best practice for handling rate limit errors. This prevents your application from failing during peak usage times.

Authentication Header Issues

Authentication is handled via the Authorization header. The format is Bearer YOUR_API_KEY. Ensure you are using the correct API key and that it has not been revoked or expired.

If you receive a 401 Unauthorized error, verify your API key. Check for any typos or extra spaces. Ensure you are using the correct base URL. If you have multiple keys, ensure you are using the active one. Remember, only one key is active per account at any time.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.unrestrictedgpt.cc/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Store your API key securely. Do not expose it in client-side code or public repositories. Use environment variables or a secrets manager to store your key. This prevents unauthorized access to your account and ensures your API usage is billed correctly.

Model ID Configuration

The model ID to send in your requests is uncensored. This is the only model available. Ensure your requests include the model parameter set to uncensored. If you omit the model parameter, the API may default to a different model or return an error.

Verify your model ID in your SDK configuration. If you are migrating from another provider, ensure you update the model ID to uncensored. This ensures your requests are routed to the correct uncensored model. Using the wrong model ID can result in unexpected behavior or errors.

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedgpt.cc/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Model ID configuration is a simple but critical step. Ensure you are using the correct model ID to access the uncensored capabilities. If you are unsure, check the API documentation for the correct model ID. This prevents confusion and ensures your requests are processed correctly.

Billing and Token Usage Discrepancies

Billing is based on real token usage. Errors and refusals are free. If you notice a discrepancy in your token usage, check your request logs. Ensure you are not double-counting tokens or including extra tokens in your calculations.

Token usage is calculated based on the input and output tokens. Ensure you are using a reliable tokenizer to count tokens accurately. If you are using a third-party library, verify its token counting logic. This ensures your billing is accurate and you are not overcharged.

curl https://api.unrestrictedgpt.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

Monitor your token usage regularly to avoid surprises. Set up alerts for high usage or unexpected charges. This helps you manage your budget and ensure you are getting the most value from your API usage. Accurate token counting is essential for understanding your costs.

Questions and answers

What is the base URL for the unrestricted api?

The base URL is https://api.unrestrictedgpt.cc/v1. You must send your requests to the /v1/chat/completions endpoint. Do not append /v1/chat/completions to the base URL if you are using an SDK that handles this automatically.

How do I handle streaming responses?

Streaming returns Server-Sent Events (SSE). Parse the stream line by line. Token usage data is only available in the final chunk. Ensure your parser handles the [DONE] signal correctly.

What happens if I exceed the rate limit?

You will receive a 429 Too Many Requests error. The limit is 300 requests per minute per key, with a concurrency limit of 8 simultaneous requests. Implement exponential backoff to handle these errors gracefully.

How is billing calculated?

Billing is based on real token usage. Errors and refusals are free. Credit is prepaid and never expires. You can top up by crypto (USDT on TRC20, USDC on Base) for a bonus.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.