Skip to content
All docs

Use case

An API for interactive fiction and text adventures

Point any OpenAI SDK at nokeep and use DeepSeek V4.1 Flash Uncensored as your narrator. It streams prose as it is written, takes the samplers fiction needs, holds a million tokens of a campaign, and follows a dark plot without a refusal. A 60-turn session costs about $0.041.

Checked 29 October 2026

What a text game needs, and what you get

A text game needsOn nokeep
The first words fastStreaming on every model. DeepSeek answers at once unless you ask it to think, so the narration starts as soon as the call does.
A long memoryDeepSeek holds 1,000,000 tokens: a whole campaign fits. The repeated start of each call is billed at the cached price, $0.011 per million instead of $0.45.
Prose that doesn’t loopDeepSeek takes temperature, min_p, top_k and three penalties. Starting values.
Room for dark storiesRefusals are removed from the weights, and nothing is added to your prompt. The one exception is a short list of hard limits: a call that crosses one gets a 422 with a code and costs nothing.
A known costPrepaid credits, from $5, that never expire. Each response says what the call cost.

What a session costs

ModelOne conversation, nothing cachedOne conversation, repeated start cached
DeepSeek V4.1 Flash Uncensored$0.30$0.041
GLM 5.3 Flash Uncensored$0.13$0.037

Worked out from today’s prices: a 1,500-token start, 60 turns of 40 tokens in and 250 out, the longest call 18,650 tokens. GLM’s brief think before each reply adds output tokens this leaves out.

The whole history is sent with each turn, so the 60th call is far longer than the first. Caching is why that stays cheap: the part a call repeats from the call before it is read from cache. Without a single cache hit, the same session is $0.30 on DeepSeek. How caching works.

A narrator in twenty lines

The world and the rules go in the system message. Keep it the same from turn to turn, so the start of every call repeats and is read from cache. Stream the reply and print it as it arrives.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://nokeep.ai/v1",
    api_key=os.environ["NOKEEP_API_KEY"],
)

history = [{"role": "system", "content": "You are the narrator of a dark fantasy text adventure. The player is a smuggler in the drowned city of Vell. Describe what they see, hear and smell in second person, in under 150 words. Never act or speak for the player. End each turn with the scene open, not with a list of options."}]

def turn(move):
    history.append({"role": "user", "content": move})
    stream = client.chat.completions.create(
        model="deepseek-v4.1-flash-uncensored",
        messages=history,
        stream=True,
        max_tokens=400,
        temperature=0.9,
        extra_body={"min_p": 0.05, "repetition_penalty": 1.05, "prompt_cache_key": "campaign-42"},
    )
    text = ""
    for chunk in stream:
        if chunk.choices:
            piece = chunk.choices[0].delta.content or ""
            print(piece, end="", flush=True)
            text += piece
    history.append({"role": "assistant", "content": text})

turn("I row the stolen skiff under the old customs bridge.")

prompt_cache_key is any string you keep the same for one campaign. It sends the campaign’s calls where its start is already cached. Streaming covers usage in the last chunk and stopping a reply early.

Keep the game in your code

  • State outside the prose. Keep inventory, health and flags in your own data, and put a short summary of them in the system message. A model remembers a story well and a number badly.
  • Ask for JSON when you need facts back. A second, short call with response_format can return what changed this turn, for your code to apply. JSON output.
  • Long campaigns. A million tokens is a lot of turns, but each one is billed. Past a few hundred turns, replace the oldest with a summary you write once, and keep the summary in the same place so the start still repeats.
  • Branching and undo. The API keeps nothing between calls, so a save point is just the message list at that turn. Resend an earlier list to rewind.

Which model

DeepSeek V4.1 Flash UncensoredGLM 5.3 Flash Uncensored
Use it forThe narrator. Most text games.Short, cheap side calls, such as summaries.
SamplersAll of themNone; its own settings
ThinkingOff unless asked, so replies start at onceAlways a brief think first
Context1,000,000 tokens128,000 tokens
Pictures inYes, up to 10 a requestNo

Ids: deepseek-v4.1-flash-uncensored and glm-5.3-flash-uncensored. Compare them in full.

What happens to your players’ stories

We keep one row per call: the time, the key, the model, token counts, credits and the status, for 30 days. Never the messages, never the reply. DeepSeek runs on a private tier that stores no prompts or replies. Players’ stories live wherever your game keeps them, and nowhere of ours. What we keep.

Questions

Can I run a text adventure for mature themes?

Yes, for adults. Violence, horror, crime and adult relationships are fiction the models write without a jailbreak prompt. Only the short list of hard limits in the terms is refused, with a 422 that costs nothing. Every key’s maker confirms they are 18 or older.

How many turns fit before the model forgets?

DeepSeek reads 1,000,000 tokens per call. At about 300 tokens a turn, that is over 3,000 turns of history. Most games summarise long before that, to keep each call cheap.

Can players call the API straight from my web page?

The API allows browser calls, but a key in a public page can be copied. Call it from your server, or give each player their own key with a daily cap.

Can I try it before paying?

Yes. The free test key sk-nokeep-test answers one fixed line on any request, so you can wire up your game first. The test key.