Skip to main content

WNTranslate

Simple yet comprehensive AI-assisted webnovel translation tool. Keeps track of the plot properly to ensure smooth translation.

Models and testing Tested with local llama.cpp self-hosted Qwen3.6 35B A3B model, Deepseek V4.1 Flash, and Claude Haiku 5.5. I recommend using this library with a provider that supports json_schema (which Deepseek does not support) although Deepseek worked decently well with our no json schema mode.

A high parameter model is recommended to understand the prompt and properly apply translations. This library uses a four-pass system (analyze, translate, review, apply glossary) every single translation, and thinking mode is recommended to be OFF (ReasoningEffort.NONE) or LOW (ReasoningEffort.LOW), otherwise each chapter will take a lot of time.

Testing chapter length averages ~2000 Japanese characters, on official APIs.

  • Deepseek V4.1 Flash: Under 60s on average per chapter, costing under $0.03 per chapter.
  • Claude Haiku 5.5: Under 60s on average per chapter, costing under $0.075 per chapter

For cheaper translations, Deepseek V4.1 Flash (deepseek-flash) is recommended, however if you're willing to spend a bit more (1.85-3.7x more expensive), Claude Haiku 5.5 (claude-haiku-5-5) is better for quality and speed.

With reasoning, it can take 5 minutes or more, and is not recommended. Local or open weight models without an official API will not be listed here as the speed will differ based on device and/or provider.

Features

  • Glossary for consistent naming across chapters:
    • typed entries (person, item, organization, creative work, or a custom type)
    • aliases with an optional per-alias context, so one source term resolves differently by situation (e.g. a name cut off mid-speech, or depending on who speaks)
    • terms are referenced by ID instead of copied as text, so editing a translation updates every chapter at once
  • Context tracking to keep long stories coherent:
    • rolling summary plus freeform notes
    • optional per-chapter summaries that the AI can reference
  • Settings-driven prompt and response schema to regenerate from your options: source/target language, creativity, footnotes, context mode, chapter summaries, and glossary/reorder permissions and limits.
  • Structured model protocol - glossary add/edit/delete, chapter reordering, and context changes apply straight back into the project, and the model can request data it still needs (the chapter list, another chapter's text, …), which is fulfilled automatically:
    • new chapters translate in two passes within one conversation: first the glossary, notes, and running summary are settled, then the translation is produced against the finalized names
  • HTML output for a full reader (table of contents, prev/next arrows, keyboard navigation) or a single standalone chapter, with Markdown and jump-to/jump-back footnotes rendered.
  • Versioned project files - the whole project can save and load as JSON.

Install

pip install wntranslate # [async] for async usage

Usage

Set up a project with a model provider. base_url can point at any OpenAI-compatible endpoint:

from wntranslate import WebNovel, TranslationSettings, Creativity, OpenAIProvider

wn = WebNovel(
    "小説のタイトル",       # original (source-language) title, required
    "元のあらすじ",         # original synopsis, required ("" if none)
    settings=TranslationSettings(source_language="Japanese", target_language="English", creativity=Creativity.LOW),
    provider=OpenAIProvider(model="gpt-4o-mini", api_key="sk-...", base_url="https://api.openai.com/v1"),
)

# Fill the translated title/synopsis (optional; left as None otherwise):
wn.translate_metadata()

The model is always given the glossary and your project notes, and it can request the synopsis, titles, or other chapters' text when it needs them. Notes hold project-wide facts that must stay perfectly consistent across every chapter (and that aren't glossary terms or story summary); the model keeps them updated, or you can steer them with request_change.

Translate a new chapter. This runs in two passes within one conversation: first the model updates the glossary, notes, and running summary and classifies the chapter; then, with the finalized glossary, it produces the translation. Every response is validated against the generated schema, and any data the model requests (another chapter's text, the synopsis, …) is auto-fulfilled. The newly added chapter is returned:

chapter = wn.translate_new_chapter(original_title="第1話", original_content="<source text>")
print(chapter.title)

Ask for a specific change in plain language; it is applied and returned:

wn.request_change("Rename the glossary entry 'Ayami' to 'Ayame'.")
wn.request_change("In chapter 3 only, render Ayami as 'Aya'.") # Creates a new alias in the glossary and applies it to chapter 3 only.

Read it. Export Markdown, a full HTML reader, or one standalone chapter:

print(wn.export())                       # markdown
with open("book.html", "w", encoding="utf-8") as fp:
    fp.write(wn.to_html())               # full reader: TOC + prev/next + footnotes
one = wn.chapter_to_html(wn.chapters[0]) # standalone chapter document

Save and load the whole project (versioned JSON):

data = wn.dumps()  # compact; pass indent=2 for pretty output
restored = WebNovel.loads(data)

Building by hand

You can also populate the glossary and chapters directly instead of via the model. Every entry and alias gets a stable, auto-generated id:

from wntranslate import PersonEntry, Alias

ayami = PersonEntry(
    name="Ayami",
    original_name="彩美",
    pronouns="she/her",
    aliases=[Alias(original="彩-", translation="Aya-", context="name cut off in speech")],
)
wn.glossary.add(ayami)

wn.glossary.get(ayami.id)      # by id
wn.glossary.lookup("彩美")      # by name, original name, or alias

Chapter content references glossary IDs instead of raw text, so editing a term updates every chapter; IDs resolve when rendering:

from wntranslate import Chapter, Content, TextNode, TermNode, FootnoteNode

wn.chapters.append(Chapter(
    original_title="第1話",
    original_content="<source text>",
    title="Chapter 1",
    content=Content(nodes=[
        TextNode(text="Hello, "),
        TermNode(term_id=ayami.id),                               # -> "Ayami"
        TextNode(text="! Or should I say "),
        TermNode(term_id=ayami.id, alias_id=ayami.aliases[0].id), # -> "Aya-"
        FootnoteNode(content="A play on her name."),
    ]),
    summary="They meet for the first time.",
))

Metadata

Release files for wntranslate 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wntranslate 1.2.0
File Size Uploaded Provenance Actions
wntranslate-1.2.0.tar.gz 67.9 kB With provenance Details for wntranslate-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wntranslate 1.2.0
File Interpreter ABI Platform Actions
wntranslate-1.2.0-py3-none-any.whl Python 3 none any Details for wntranslate-1.2.0-py3-none-any.whl

Total release size: 128.5 kB

Release files / wntranslate-1.2.0.tar.gz

Download URL wntranslate-1.2.0.tar.gz
Size 67.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3abd7c2cd4e5ee34b6077beec1021833a216775b090c05d4e854ea2d8ec736c9
BLAKE2b-256 checksum
How to use checksums
ecdbbb3d8a0ace1c6f78eba726231dce0fcc65b3a78a54d81fe35fd69c36d329
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / wntranslate-1.2.0-py3-none-any.whl

Download URL wntranslate-1.2.0-py3-none-any.whl
Size 60.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
772bd9b56f72c5e7aaf5d5d2cb77191b19c3d087a2694c65af5b5fb7cd38e652
BLAKE2b-256 checksum
How to use checksums
c4c356b21b4d81a675d8ba90ed5acc1f354f56ad48b8395fd5137377b9c2f6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for wntranslate 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wntranslate-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page