EN ▾
Get API key

Best LLM API for Creative Writing and Fiction

The best LLM API for creative writing is the one that keeps a story coherent over many pages, does not stop to lecture you mid-scene, and costs little enough to let you redraft. This page lists the criteria, a test prompt, and a working long-story setup.

Updated

Typewriter feeding a long glowing scroll of light, representing long-form AI fiction writing

Key points

  • Fiction needs a big context window, steady character voices and an API that does not refuse dark themes between lawful adults.
  • Sampling settings matter: temperature, top_p, penalties and seed change prose more than the prompt wording does.
  • With a 100,000-token window you can keep a story bible, a running summary and recent chapters in every call.
  • A 1,500-token chapter costs well under a cent at $0.50 per 1M output tokens.

What fiction asks of an API

Writing fiction is a different load from answering support tickets. A novel chapter depends on everything before it: who knows which secret, what the weather was, which character lies when nervous. Most failures writers report are not about grammar. They are about memory and tone.

Here is what to check, in rough order of importance:

  1. Context size. A story that fits in the window can be continued without losing facts. This API has a 100,000-token window for prompt plus completion, which is on the order of 70,000 words of English.
  2. Refusal behaviour. Thrillers, war stories, horror and morally grey characters involve violence, crime and cruelty. A model that stops with a warning in the middle of a scene breaks the work. This service runs a model tuned to answer without content refusals for lawful adult use. The hard limit is that sexual content involving minors is never allowed.
  3. Controls. You want temperature, top_p, stop, seed and the penalties passed through unchanged. All of them are.
  4. Price per redraft. Writers regenerate a lot. Cheap output tokens change how freely you experiment.
  5. Streaming. Watching a scene appear lets you stop a draft that is going wrong.

Be wary of rankings that claim to know which model writes the best prose. Taste varies, and any comparison needs your own prompts. The benchmark notes and the overview of uncensored models are a starting point, but run the test below yourself.

A 10-minute test you can run

Pick one scene that your usual tool handles badly and run it on every candidate with the same settings. A good test prompt has constraints that can be checked:

Write a 400-word scene in third person past tense. Mara, a smuggler, interrogates a captured guard on a night train. Keep the guard stubborn and the dialogue short. Mara never raises her voice. End on a line that changes what the reader believes about the guard.

Then score the output on yes or no questions:

  • Did it finish the scene without refusing, warning or moralising?
  • Is it close to 400 words, in the right tense and person?
  • Does Mara stay quiet, and is the guard stubborn?
  • Does the last line shift the reader's view?

Run it five times with different seeds. If one run in five fails the checks, that is your real failure rate, and it tells you more than a single good sample. At about 700 output tokens per run, five runs cost 3,500 x 0.50 / 1,000,000 = $0.00175 in output, plus a few hundred input tokens. Testing is nearly free.

Settings that change the prose

Four parameters do most of the work.

temperature

Lower values give plainer, safer text; higher values give stranger word choices. For drafting scenes, start around 0.8 to 1.0. For editing or continuity checks, go down to 0.3 or lower, because you want accuracy.

top_p

This trims the unlikely tail of word choices. A value around 0.9 to 0.95 with a high temperature keeps variety without nonsense. Change either temperature or top_p first, not both, so you know which one caused the effect.

frequency_penalty and presence_penalty

If a character keeps "letting out a breath she did not know she was holding", raise the frequency penalty slightly (0.2 to 0.5). Too high and the model avoids names it needs to repeat.

seed

With the same seed, prompt and settings you get a comparable result, which helps when you want to see what one change did. Treat it as a tool for comparison. Do not rely on it for exact reproduction across long periods.

The documentation lists the parameters the endpoint accepts.

A long-story setup that fits in 100k tokens

The structure that works for long fiction is a fixed prefix that you build once and a short tail that changes. Put these in the prompt, in this order:

  1. A system message with voice and rules: point of view, tense, style, things to avoid.
  2. A story bible: characters, setting, timeline, open plot threads. Keep it under 2,000 tokens.
  3. A running summary of earlier chapters, rewritten after each chapter. Keep it under 3,000 tokens.
  4. The text of the last one or two chapters, for rhythm and continuity.
  5. The instruction for the next chapter.
from openai import OpenAI

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

SYSTEM = "You are a novelist. Third person past tense. Plain, concrete prose. No summaries of the plot, no moral commentary."

def write_chapter(bible, summary, last_chapter, instruction):
    messages = [
        {"role": "system", "content": SYSTEM},
        {"role": "user", "content": "STORY BIBLE\n" + bible},
        {"role": "user", "content": "SO FAR\n" + summary},
        {"role": "user", "content": "PREVIOUS CHAPTER\n" + last_chapter},
        {"role": "user", "content": "NEXT CHAPTER: " + instruction},
    ]
    r = client.chat.completions.create(
        model="uncensored",
        messages=messages,
        temperature=0.9,
        top_p=0.95,
        frequency_penalty=0.3,
        max_tokens=2500,
    )
    return r.choices[0].message.content

def update_summary(summary, chapter):
    r = client.chat.completions.create(
        model="uncensored",
        temperature=0.2,
        messages=[{"role": "user", "content":
            "Update this summary with the new chapter. Keep it under 500 words.\n\n"
            + summary + "\n\nNEW CHAPTER\n" + chapter}],
    )
    return r.choices[0].message.content

Notice the low temperature on the summary call. Summaries should be accurate, not creative, and a drifting summary is how a story forgets that a character lost an arm in chapter three.

What it costs to write a novel

Say each chapter call carries 20,000 input tokens (bible, summary, previous chapter, instruction) and produces 1,500 output tokens, about 1,100 words. The summary update adds roughly 3,000 input and 700 output tokens.

Chapter:  20,000 x $0.15 / 1M = $0.0030   1,500 x $0.50 / 1M = $0.00075
Summary:   3,000 x $0.15 / 1M = $0.00045    700 x $0.50 / 1M = $0.00035
Per chapter, both calls: $0.00455
40 chapters: $0.182

So a 40-chapter draft costs about 18 cents, and ten complete redrafts about $1.82. Even if you resend 80,000 tokens of context on every call, that is 80,000 x 0.15 / 1,000,000 = $0.012 of input per call. The pricing page shows the rates and top-up bonuses; the smallest top-up is $20.

Keeping a long story consistent

A large window does not remove the need for care. Models pay less attention to the middle of very long prompts, so put the most important facts at the start (the bible) and the end (the instruction). Do not dump 80,000 tokens of raw chapters in and hope. A tight summary beats a long transcript.

When the model contradicts the bible, correct it in the next prompt with a short line such as "Reminder: Mara's left hand is missing two fingers." Fix the bible too, so the correction persists.

For multi-character scenes, give each character a one-line voice note in the bible ("Tomas speaks in short questions"). Dialogue that sounds the same for everyone is the most common complaint about generated fiction, and voice notes reduce it more than raising the temperature does.

This service is meant for lawful adult use. Mature themes in fiction are fine; sexual content involving minors is not permitted under any framing.

Getting started

Create an account and claim the trial: one click gives $0.50 of credit, valid for 7 days, no card. That covers about 100 chapters at the rate above. Paid top-ups run from $20 to $500 by crypto (USDT on TRC20, USDC on Base), with a bonus from $50. Credit does not expire, so a long project can be paid for once.

Questions and answers

How much text fits in the context window?

The window is 100,000 tokens for the prompt plus the reply. In English that is roughly 70,000 words, less once you account for the reply you want back.

Does the API refuse dark themes in fiction?

The model is tuned to answer without content refusals for lawful adult use, so violence, crime and morally grey characters in fiction are not blocked. Sexual content involving minors is never allowed.

Can I get repeatable output?

The seed parameter is passed through, so the same seed, prompt and settings give comparable results. Use it to compare settings, and expect small differences over time.

Are there other API features I can use for writing tools?

Streaming, JSON mode for structured outlines and tool calling are all supported on the same endpoint.

Your key is one form away

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

Get API key