How to Write a Book with AI: A Step-by-Step Guide
Published 12 October 2026. 4 min read.
An AI tool can turn a short idea into a full first draft of a book in an afternoon. What it can't do is decide what the book is about, who it is for, or whether the result is any good. That part is still yours, and it's what separates a useful book from a forgettable one.
This guide walks through the whole process, from idea to finished file, using Codex AI Book Writer as the example. The same principles apply to any AI writing tool.
What kind of book works best
AI drafting works best for non-fiction with a clear structure: how-to guides, phrasebooks and language guides, course workbooks, lead magnets for coaches and consultants, and long-form explainers on a topic.
It works less well for memoirs and personal stories, because the AI doesn't know your life. You can still use it to build the structure, but write the stories yourself.
Step 1: Write a brief, not a title
The single biggest factor in the quality of an AI-written book is the brief. "A book about gardening" gives the AI almost nothing to work with, so you get a generic book.
A good brief has three parts:
- A narrow topic. "Growing vegetables on a small city balcony" instead of "gardening".
- A specific reader. "Beginners who rent a flat and have never grown anything" instead of "everyone".
- A tone. "Friendly and practical. Short chapters. No jargon."
Put together, that's two sentences. In Codex Leo you type it on the first step, or start from one of the ready-made templates.
Step 2: Fix the outline before anything is written
Codex Leo returns a chapter-by-chapter outline in seconds, with a word count for each chapter. Nothing is written until you approve it, and this is where you should spend real time.
- Cut chapters you would skip as a reader.
- Reorder so the most useful chapter comes early.
- Rebalance word counts: give the key chapters more room and trim the filler.
- Rename chapters so they promise something concrete.
If you already know the structure, use "New Book with Script" and paste your own chapter breakdown instead.
Ten minutes on the outline saves hours of editing later.
Step 3: Generate the draft
Once the outline is right, Codex Leo writes every chapter. A full draft usually takes a few minutes, depending on how many chapters and words you asked for.
You see the estimated token cost before generation starts. A token is roughly one word, so a 20,000-word guide costs about 20,000 tokens. If your balance runs out mid-book, generation pauses instead of failing, and it continues from the same place when you top up.
Step 4: Edit like an editor, not a proofreader
Treat the draft as a first draft. Read it end to end before changing anything, then work in this order:
- Facts. Check every name, date, number and instruction. AI tools can state wrong things confidently.
- Structure. Does each chapter deliver what its title promises? Move or cut paragraphs that wander.
- Voice. Add your own examples, opinions and stories. This is what makes the book yours.
- Line edits last.
In Codex Leo you can edit any passage by hand, or regenerate a chapter with a new instruction ("shorter, with a checklist at the end"). Every revision is saved, so you can always switch back.
Step 5: Add a cover and images
Upload your own cover for the PDF and EPUB versions, and drop images into individual chapters where they help. A simple, readable cover beats a busy one, especially as a small thumbnail in an online store.
Step 6: Export
Codex Leo exports the same book in four formats:
- PDF for print or a downloadable lead magnet
- DOCX for further editing in Word or Google Docs
- EPUB for e-readers and most e-book stores
- HTML for publishing on the web
Your cover, author name and publisher are included in the files.
Writing in other languages
You can write in English, Spanish, French, German, Italian, Russian or Norwegian. Write the brief in the language you want the book in, and check the draft with a native speaker if you plan to sell it.
If you plan to publish on Amazon
Amazon KDP asks you to disclose AI-generated text, images and translations when you publish. We cover the rules in Publishing an AI-Written Book on Amazon KDP.
Try it with your own idea
Every new Codex Leo account starts with 10,000 free tokens, enough for a short book, with no credit card and no subscription. Start writing free.