EN ▾

Uncensored LLM API for developers.

Get API key

Unrestricted AI for Story Writing: API Setup and Tips

Fiction needs villains who frighten, grief that hurts and conflict that goes somewhere. This guide shows how to use an uncensored model through an API to draft long stories without being refused halfway through.

Updated

Open book unfolding into a lantern-lit path toward a castle, representing long-form fiction writing

Why writers hit walls with mainstream assistants

If you have tried unrestricted ai for story writing, it was probably after a mainstream assistant stopped a scene mid-chapter. The usual triggers are not exotic. A war novel with an atrocity in the backstory, a crime thriller narrated by the criminal, a horror short with a convincing monster, a drama that depicts abuse so a reader understands it. Cautious models often decline these, or soften them until the scene loses its point.

The cost to a writer goes beyond the refusal itself. It is the broken flow, the rewrite of a prompt, the sanitised paragraph you have to fix by hand. When you build a writing tool on top of such a model, your users experience the same thing, and they blame your product.

An uncensored model removes that friction. This one is an open-weight model run by an independent provider and tuned to answer without content refusals for lawful adult use. For fiction that means the model treats a dark theme as material to write, not as a policy problem. Be clear about the other side as well: sexual content involving minors is a hard limit, and the service is for adult writers and adult audiences.

Set up a story session

The API is OpenAI-compatible, so you can use the openai package. The base URL is https://api.unrestrictedaimodels.cc/v1 and the model ID is uncensored. A minimal chapter request looks like this:

from openai import OpenAI

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

system = (
    "You are a literary fiction co-writer. Write in close third person, past tense. "
    "Keep scenes concrete and sensory. Do not summarise the plot or moralise. "
    "Continue exactly where the last chapter ended."
)

resp = client.chat.completions.create(
    model="uncensored",
    temperature=0.95,
    top_p=0.95,
    frequency_penalty=0.3,
    messages=[
        {"role": "system", "content": system},
        {"role": "user", "content": "Chapter 7. Mara returns to the flooded mill and finds the foreman waiting. Write about 1,500 words."},
    ],
)
print(resp.choices[0].message.content)

The sampling values deserve a note. Creative writing usually likes a temperature between 0.8 and 1.1. A small frequency penalty discourages the model from repeating the same pet phrases. If you need a draft to be reproducible while you tune the prompt, pass seed. Full parameter details are in the API documentation.

Add a short "voice sample" to the system prompt as well: two hundred words of your own prose, labelled as the target style. Models imitate rhythm and diction from examples far better than from adjectives like "lyrical" or "spare". Replace the sample when the book changes register, for instance between a quiet chapter and an action chapter.

Use the long context for a story bible

The context window is 100,000 tokens, shared between your prompt and the completion. A common rule of thumb for English is that a word is about 1.3 tokens, so the window holds something like 70,000 words in total. That is enough to carry a lot of structure with you.

A good request layout has fixed material at the top and moving material at the end:

  1. Style sheet. Point of view, tense, sentence rhythm, words to avoid.
  2. Story bible. Characters with voice notes, locations, timeline, rules of the world, running motifs.
  3. Plot outline. What happens in each remaining chapter, so the model can foreshadow.
  4. Recent text. The last one or two chapters verbatim, so continuity is exact.
  5. The instruction. What to write now, how long, and what must happen.

Keep the bible short and specific. "Tomas: ex-medic, speaks in short sentences, never swears in front of his daughter" helps. Three paragraphs of backstory the scene never uses only invites the model to show it off.

When the window fills

Once the full manuscript exceeds the window, switch to rolling summaries. After each chapter, make a second call that asks for a 200 word summary containing events, character changes and open threads. Store these. For the next chapter, send all earlier summaries plus the last chapter in full. A hundred chapters of summaries fit comfortably, and the cost of the extra call is small.

Tag your bible entries so you can include only what the scene needs. A chapter set in the mill does not need the full cast list from the capital. Smaller contexts produce more focused prose, and they cost less. Treat the 100,000 token window as a ceiling, not a target.

Stream drafts and let the writer steer

Long output takes time, and staring at a spinner kills momentum. Streaming prints words as they arrive, and lets the writer stop a draft that has gone the wrong way before paying for the rest.

import OpenAI from "openai";

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

const stream = await client.chat.completions.create({
  model: "uncensored",
  stream: true,
  temperature: 1.0,
  messages: [
    { role: "system", content: "Co-write a gothic novel. Stay in the established voice." },
    { role: "user", content: "Continue: the tide had left something on the stairs." },
  ],
});

let text = "";
for await (const part of stream) {
  const piece = part.choices[0]?.delta?.content ?? "";
  text += piece;
  process.stdout.write(piece);
}

Remember that a streamed request holds one of your concurrency slots until the stream ends. A full key allows 8 at once and a trial key 2, so a writing app with many users needs a queue or a per-user limit.

Give the writer control points as well. A "continue", "rewrite this paragraph darker" and "give me three alternatives for the last line" button, each mapped to a small prompt, makes a better tool than a single big generate button. For alternatives, call the API with a higher temperature and ask for a numbered list; for strict edits, lower it to around 0.6.

Prompting for strong dark fiction

Fewer refusals do not write good scenes on their own. A few habits help.

  • Specify the point of view and what the reader should feel, not the topic. "The reader should understand why she stays" beats "write about an abusive relationship".
  • Ask for restraint where it serves the scene. The strongest horror often implies. Tell the model what to leave off the page.
  • Give each character a want and a lie they believe. Models write antagonists with real menace when the antagonist has a coherent logic.
  • Forbid the tics. If you keep getting "a shiver ran down her spine", add a banned-phrases line to the system prompt.
  • Edit in passes. Draft at high temperature, then run a second call at low temperature asking to tighten and fix continuity errors against the bible.

Roleplay and companion apps follow the same logic: put the persona, boundaries and memory in the system prompt, keep recent turns verbatim, and summarise the old ones. For adult audiences, state the age gate in your product, and keep the minors rule in your own moderation as well.

Feedback loops help too. After a draft, ask the model for a critique before asking for a rewrite: "list five places where the dialogue sounds generic and say why". Then feed the critique back with the instruction to revise only those places. Two focused passes usually beat one long prompt trying to do everything.

What a chapter costs

Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Take a realistic case: you send a 30,000 token context (bible, outline and recent chapters) and receive a 4,000 token chapter.

  • Input: 30,000 ÷ 1,000,000 × $0.15 = $0.0045
  • Output: 4,000 ÷ 1,000,000 × $0.50 = $0.0020
  • Total per chapter: $0.0065

A forty-chapter novel written that way costs 40 × $0.0065 = $0.26 in tokens. Add a summary call after each chapter with 5,000 tokens in and 300 out: $0.00075 + $0.00015 = $0.0009 per call, or $0.036 for forty. Even with many rewrites, generation costs stay small next to your time.

New users can claim $0.50 of trial credit with one click on the API key page after sign-up. It is valid for 7 days, one per person, and needs no card. Later top-ups run from $20 to $500 with bonuses of 5%, 10% and 15% from $50, $100 and $200; see pricing. Refused or failed requests are not charged, and credit never expires.

If you charge your own users for a writing tool, these numbers give you a margin to work with. A heavy user who generates twenty chapters in a month spends about $0.13 in tokens at the figures above, since 20 × $0.0065 = $0.13. Your pricing can be about the product, not about token anxiety.

Limits and where to read more

Know what the service does not do. It is text only, so no cover art or audio narration. There is no fine-tuning, so voice consistency comes from your prompts and examples, not from a trained model. Prompts are not used for training, which matters for unpublished manuscripts.

For a broader look at how this kind of model differs from filtered ones, read our developer guide to models without guardrails. Then run one real chapter through the API with your own style sheet. That test tells you more than any benchmark.

Questions and answers

Can I use it for dark or violent fiction?

Yes, for lawful adult fiction the model writes dark themes without content refusals. Sexual content involving minors is never allowed.

How long a story can it hold in memory?

The context window is 100,000 tokens for prompt plus completion. For longer projects, keep a story bible and rolling summaries.

Are my manuscripts used for training?

No. Prompts are not used for training.

Which settings work best for creative writing?

Many writers start with temperature around 0.9 to 1.0, top_p 0.95 and a small frequency penalty such as 0.3. Adjust from there for your style.

Your key is one form away

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