EN ▾

Uncensored LLM API for developers

unfilteredstory.cc

Get API key

AI Dungeon Alternative: Run Your Own Story Client

If you want an ai dungeon alternative, you have two routes: another finished game, or your own small client on top of a text API. This page covers the second route, with a working Python client and honest trade-offs.

Updated

Key points

  • A finished game gives you an interface, community and content tools; your own client gives you control of prompts, memory and cost.
  • A story client is small: a loop, a message list, streaming and a memory block.
  • The 100,000-token window lets you keep a long adventure in view without constant summaries.
  • A 100-turn session costs a few cents at $0.15 and $0.50 per 1M tokens.
Open book with a glowing path rising to a floating castle, for building a custom text adventure client
Typewriter whose page becomes a glowing ribbon winding through floating books, representing long-form story writing

Game or client: pick by what you want to control

AI Dungeon is a well-known text adventure game that runs in the browser and on phones. If you want to open an app and play, a finished game is the easier path, and nothing here replaces that. Check each service's current features, plans and content rules on its own site before you decide.

A custom client makes sense when you want something a game does not give you: your own system prompt and story rules, a fixed world with named characters, an interface shaped for one genre, or the freedom to wire the model into a Discord bot, a site or a writing tool. You also pay per token rather than a flat plan, which suits light and bursty use.

Finished gameYour own client on an API
SetupSign up and playWrite about 60 lines of code
Prompt controlLimited to what the app exposesFull: system prompt, memory, sampling
InterfaceFixedAnything: terminal, web, bot
Community and shared scenariosBuilt inYou build it or go without
Cost modelCheck their current plansPer token from prepaid credit

This site offers the API side: one open-weight model, OpenAI-compatible, tuned to answer without content refusals for lawful adult fiction. Sexual content involving minors is never allowed.

The smallest story client

A text adventure needs only a loop: read the player's action, send the story so far, print the continuation. Get a key from the API key page and set it as an environment variable.

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.unfilteredstory.cc/v1", api_key=os.environ["STORY_KEY"])

SYSTEM = (
    "You are the narrator of an interactive text adventure. "
    "Write in second person, present tense, 80 to 150 words per reply. "
    "Describe results of the player's action and end with an open moment. "
    "Never decide the player's actions or thoughts."
)
story = [{"role": "system", "content": SYSTEM},
         {"role": "assistant", "content": "You wake on a salt-crusted dock. A lantern swings above you."}]
print(story[-1]["content"])

while True:
    action = input("\n> ").strip()
    if action in ("quit", "exit"):
        break
    story.append({"role": "user", "content": action})
    stream = client.chat.completions.create(
        model="uncensored", messages=story, temperature=0.9, stream=True,
    )
    parts = []
    for chunk in stream:
        piece = chunk.choices[0].delta.content or ""
        parts.append(piece)
        print(piece, end="", flush=True)
    print()
    story.append({"role": "assistant", "content": "".join(parts)})

That is a playable adventure. Streaming makes it feel alive, because text appears as it is written. Everything else in this article improves on this loop.

Memory: keep a long story coherent

Early text games forget details quickly. With a 100,000-token window you have far more room. A typical reply is 150 to 250 tokens, so even 300 turns is around 60,000 tokens, which fits. Still, a good client treats memory in layers.

  • Story rules (system message): genre, tone, what the narrator never does.
  • World notes: a short list of places, factions and named characters. The player or the author edits it.
  • Running summary: key events as one-line facts, updated every 20 turns by a separate call.
  • Recent turns: the last 20 to 40 messages in full.
  • Author's note: one line added near the end of the prompt, such as "Keep the mood tense; the storm is getting worse." Instructions placed near the end affect the next reply most.

Build the message list from these layers on every request. A reader can find more on handling long stories in the guide to the best AI for writing unfiltered stories, and the page on unlimited roleplay covers character-driven play.

Features worth adding next

Once the loop works, the improvements are small and local.

Undo and retry

Store each exchange. "Retry" removes the last assistant message and calls again, ideally with a slightly different temperature. "Undo" removes both messages. These two commands are the features players use most.

Save and load

Write the message list to a JSON file after every turn. Reloading the file restores the exact story, and you can share it.

Modes

Keep a small table of prompt snippets: "do" (the player acts), "say" (the player speaks), "story" (the player writes narration directly). Each mode wraps the input differently before sending.

Presets

Offer a few starter prompts per genre. Ship them as text files; players can add their own.

For a hosted chatbot-style setup rather than a game loop, see the unfiltered chatbot API page.

What a session costs

Prices are $0.15 per 1M input tokens and $0.50 per 1M output tokens. In a story client the input grows as the story grows, so use a mid-story turn for the estimate: 4,000 tokens sent and 250 tokens received.

  • Input: 4,000 / 1,000,000 x $0.15 = $0.0006
  • Output: 250 / 1,000,000 x $0.50 = $0.000125
  • Turn total: $0.000725

One hundred turns at that size cost $0.0725, a bit over seven cents. Early turns are cheaper and late ones in a long adventure cost more, so treat this as a middle value. Failed or refused requests are not charged. Credit is prepaid, never expires, and has no subscription; top-ups are any whole amount from $20 to $500, paid by crypto (USDT on TRC20, USDC on Base). Bonuses add 5% from $50, 10% from $100 and 15% from $200. Full details are on the pricing page.

Put it on the web without leaking your key

A browser page must never hold your API key. Put a thin server between the page and the API. It adds the key, forwards the story and streams the answer back. This sketch uses Node and Express.

import express from "express";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.unfilteredstory.cc/v1",
  apiKey: process.env.STORY_KEY,
});
const app = express();
app.use(express.json({ limit: "1mb" }));

app.post("/turn", async (req, res) => {
  res.setHeader("Content-Type", "text/event-stream");
  const stream = await client.chat.completions.create({
    model: "uncensored",
    stream: true,
    temperature: 0.9,
    messages: req.body.messages,
  });
  for await (const chunk of stream) {
    const piece = chunk.choices[0]?.delta?.content ?? "";
    res.write("data: " + JSON.stringify(piece) + "\n\n");
  }
  res.end();
});
app.listen(3000);

Two habits keep this safe. Limit how many requests one visitor can send per minute, since your single key shares the 8 concurrent slots among all visitors. And cap the size of the message list the page may send, so nobody can push huge prompts through your credit. If you serve more than a handful of players at once, queue requests and show a short waiting message when the API answers 429 with a Retry-After: 5 header.

Limits and what this setup cannot do

Be clear about the limits before you commit.

  • Text only. No images, audio or video generation, no embeddings.
  • One model. An open-weight model run by an independent provider. It is not the same model as any particular game and not an official product of any model maker.
  • Rate limits. A full key allows 8 concurrent requests and 300 per minute. A trial key allows 2 and 60. A streamed request holds its slot until the stream ends. Over a limit you get HTTP 429 with the code rate_limited or concurrency.
  • No built-in game features. Memory, save files, worlds and community are yours to build.

If you only want to play, a finished game is simpler. If you want to build or customize, the client above is a good base. The documentation has the parameter list, including tools and JSON mode if you later want the narrator to return structured state like inventory or health.

Questions and answers

Is this a copy of AI Dungeon?

No. It is a text API, not a game. You build or choose the client; the API supplies the model that writes the story.

Can I try it before paying?

Yes. New users can claim $0.50 of trial credit with one click on the API key page, valid for 7 days, with no card needed.

How long can an adventure run?

The context window is 100,000 tokens for prompt plus reply. For longer stories, keep a running summary and the most recent turns.

Can the model write dark or mature fiction?

It is tuned to answer without content refusals for lawful adult use. Sexual content involving minors is never allowed.

Your key is one form away

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

Start with trial credit

Email and password, key on screen right away.