EN ▾

Text API for video pipelines

Censored Text Generator in Python: Uncensored Options

Most Python text generators refuse some prompts. This page shows how to call an uncensored, OpenAI-compatible model from Python in a few lines, with streaming, JSON output and cost math.

Terminal streaming text through an open padlock into chat bubbles, illustrating Python text generation without refusals

Updated

Key points

  • Use the standard openai package and change only the base URL, key and model ID.
  • Streaming, JSON mode, tool calling and the usual sampling parameters are supported.
  • A typical 2,000-token prompt with a 500-token reply costs $0.00055.
  • Handle 429 responses with a short backoff and keep concurrency at or below 8.

No card needed. After sign-up, claim $0.50 of free test credit with one click (once per person).

Get API key

What people mean by a censored text generator in Python

The phrase censored text generator python shows up in two kinds of searches. Some developers want a script that filters or masks words in text, for example a profanity blocker. Others have the opposite problem: they call a hosted model from Python, and it refuses or waters down requests that are perfectly lawful, such as dark fiction, villain dialogue or blunt feedback. This article is about the second case.

If you only need to mask words in a string, a regular expression and a word list will do, and you do not need a model at all. If you need a language model that answers instead of declining, the rest of this page applies. The API here serves one open-weight model, tuned to answer without content refusals for lawful adult use. It is run by an independent provider and it is not the official API of any model vendor. It is text only, and one rule is fixed: no sexual content involving minors.

The API follows the OpenAI chat format, so your Python code looks the same as it would for any other provider. Only three values change: the base URL, the key and the model ID.

Install the SDK and make the first call

You need Python 3.9 or newer and the official openai package. Create a key first on the API key page. New accounts can claim $0.50 of trial credit with one click there, valid for 7 days and with no card needed.

pip install openai
export API_KEY="your-key-here"

Then a minimal script:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.unrestrictedvideogenerator.com/v1",
    api_key=os.environ["API_KEY"],
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a blunt fiction editor."},
        {"role": "user", "content": "Write a menacing monologue for a ship captain who has lost his crew."},
    ],
    temperature=0.9,
)

print(resp.choices[0].message.content)
print(resp.usage)

The model ID is uncensored. The only endpoints are POST /v1/chat/completions and GET /v1/models, so you can confirm your key works with client.models.list() before you build anything bigger.

Wrap it in a reusable function

Scripts grow. Put the client in one place and expose a small function, so every caller gets the same defaults and error handling.

import os, time
from openai import OpenAI, RateLimitError, APIConnectionError

client = OpenAI(
    base_url="https://api.unrestrictedvideogenerator.com/v1",
    api_key=os.environ["API_KEY"],
    max_retries=0,
)

def generate(prompt, system="You are a helpful writer.", temperature=0.8, tries=4):
    delay = 5
    for attempt in range(tries):
        try:
            r = client.chat.completions.create(
                model="uncensored",
                messages=[
                    {"role": "system", "content": system},
                    {"role": "user", "content": prompt},
                ],
                temperature=temperature,
            )
            return r.choices[0].message.content
        except RateLimitError:
            time.sleep(delay)
            delay *= 2
        except APIConnectionError:
            time.sleep(2)
    raise RuntimeError("generation failed after retries")

print(generate("Describe a rainy harbour town in three sentences."))

Retries are turned off in the client (max_retries=0) so that your own loop controls the pacing. When the service is briefly overloaded it answers with HTTP 429 and a Retry-After: 5 header, so a first wait of five seconds matches what the server asks for.

Streaming, JSON mode and tool calls

Streaming

For long outputs such as chapters or scene drafts, stream the reply so your program can print or save text as it arrives. Streaming uses server-sent events, and usage is reported at the end of the stream.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write the opening page of a noir story."}],
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Keep in mind that a streamed request holds its concurrency slot until the stream finishes. If you open eight streams and never read them to the end, the ninth request is rejected.

JSON mode

When the output feeds another program, ask for JSON and parse it.

import json
r = client.chat.completions.create(
    model="uncensored",
    response_format={"type": "json_object"},
    messages=[
        {"role": "system", "content": "Reply with a JSON object with keys name, motive, secret."},
        {"role": "user", "content": "Invent a morally grey smuggler for a fantasy campaign."},
    ],
)
character = json.loads(r.choices[0].message.content)
print(character["name"])

Say the word JSON and name the keys in your prompt; the format switch alone does not tell the model what shape you want. Tool calling also works (tools, tool_choice, results sent back as role: "tool"), which is useful if your generator needs to look up facts from your own code between turns. Parameters such as temperature, top_p, stop, seed and the penalties are passed through to the model.

Count the cost before you run a batch

Billing is pay as you go from prepaid credit: $0.15 per 1M input tokens and $0.50 per 1M output tokens. Failed or refused requests are not charged, and credit never expires. The pricing page lists the same rates and the top-up bonuses.

Take a realistic call: a 2,000-token prompt (system text plus context) and a 500-token reply.

  • Input: 2,000 / 1,000,000 x $0.15 = $0.0003
  • Output: 500 / 1,000,000 x $0.50 = $0.00025
  • Total per call: $0.00055

A batch of 1,000 such calls costs $0.55. The $0.50 trial credit covers about 909 of them. If your prompts carry a long shared preamble, remember it is billed on every call, so trimming a 6,000-token preamble down to 1,500 tokens saves 4,500 input tokens per request, or $0.000675 each.

Every response also carries an X-Balance-USD header. With the SDK you can read it through with_raw_response:

raw = client.chat.completions.with_raw_response.create(
    model="uncensored",
    messages=[{"role": "user", "content": "One sentence about lighthouses."}],
)
print(raw.headers.get("X-Balance-USD"))
completion = raw.parse()

Log that number at the end of a long job and you will always know what is left. Top-ups run from $20 to $500 in whole dollars, with +5% from $50, +10% from $100 and +15% from $200, paid in USDT on TRC20 or USDC on Base.

Prompting habits that reduce wasted calls

A model that does not refuse still needs clear instructions. Most failed generations in scripts come from vague prompts, not from the model. Four habits help.

  • Put the role and the format in the system message. "You are a fiction editor. Reply with plain prose, no headings" saves you from stripping markdown afterwards.
  • Give one example. A single sample of the tone you want beats three sentences describing it.
  • Set a stop sequence when you expect a fixed ending, such as a closing tag, so the model does not keep writing past it.
  • Use seed when you compare prompts. It is passed through to the model, so two runs of the same prompt are easier to compare while you tune wording.

Keep the conversation history short in loops. A script that appends every answer to the message list grows its prompt on each call, and since input tokens are billed every time, a 40-step loop can quietly turn a 500-token start into a 20,000-token prompt. Summarise older turns into a short note, or start a new message list per item. The model also has a 100,000-token window, so the loop will not crash soon, but it will get slower and more expensive long before that.

Limits and the errors you will meet

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 concurrent requests and 60 per minute. The request body can be up to 8 MB, and the context window is 100,000 tokens, prompt and completion together. max_tokens is optional; without it the completion can use whatever room is left in the window.

Two 429 errors look similar but need different fixes:

Error codeMeaningFix
rate_limitedMore than the allowed requests per minuteSpace out calls or lower the worker count
concurrencyToo many requests running at onceCap the pool at 8 (2 on a trial key)

A thread pool with a hard cap is the simplest way to stay inside the limits:

from concurrent.futures import ThreadPoolExecutor

prompts = [f"Write a two-line epitaph for character number {i}." for i in range(40)]
with ThreadPoolExecutor(max_workers=6) as pool:
    results = list(pool.map(generate, prompts))

Six workers leave headroom under the limit of eight. Each response includes X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency and X-Request-Id; keep the last one in your logs so a support request can point at a specific call. The full parameter list is in the API documentation.

Where this fits in a larger project

A plain text endpoint is a building block. Writers use it for character sheets, dialogue passes and story drafts. Developers wire it behind queues, bots and content tools. If your pipeline produces scripts or captions for video work, the video pipeline page shows where a text step sits next to rendering tools. This API does not generate images, audio or video, and it has no embeddings or fine-tuning, so plan for a separate service if you need those.

On privacy: prompts are not used for training. Beyond that, treat your own data the way you would with any hosted service and avoid sending secrets you would not paste into a web form.

A practical way to start is small. Run the first script above with the trial key, read the usage numbers, then scale up the worker count a step at a time while watching for 429 responses. Save every response to disk as you go, so a crash at item 700 of 1,000 does not cost you the first 699. Keep the prompt text in files rather than strings in code, so you can version your wording and see which edit improved the output.

Questions and answers

Is this a censored or an uncensored text generator?

The model is tuned to answer without content refusals for lawful adult use. The one hard limit is that it will not produce sexual content involving minors.

Do I need a special Python library?

No. The official openai package works once you set base_url to the API address and use model uncensored. Plain requests or curl calls to /v1/chat/completions work too.

How much does a typical Python call cost?

A 2,000-token prompt with a 500-token reply costs $0.00055 at $0.15 and $0.50 per 1M tokens. Failed or refused requests are not charged.

Can I pay by card?

Top-ups on this site are made with crypto, using USDT on TRC20 or USDC on Base, from $20 to $500. The trial credit needs no payment at all.

Your key is one form away

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

Get API key