Epub Conversion using API

Hey everyone,

Looking to get some valuable advice. I’m currently trying to convert an indesign file for a book to an epub3 file. Exporting as epub3 from indesign creates a messy and incorrect structured epub3 file, but my thought: Hey it’s only html code, let’s use gpt4o to restructure the code.

There are a few issuses I’ve come across.

  1. One chapter of the book (including the html tags, classes etc) is around 400 000 tokens. This means that I have to shrunk it to smaller pieces given the output capasity. How-ever only giving a small part of the chapter, might not create high outputs.
  2. How to prompt and get the gpt to return the correct format in terms of the html.
  3. Since html have css and i’ts handled separated, how should I get both the CSS and the html.

If anyone has any idea on an approach for either problem, I would highly appreciate it!

Happy building/Gustaf