AI Textbook Generator

A self-hosted AI textbook system that generates grade-appropriate, citation-verified chapters across any subject, using a hybrid of free local AI and paid models to keep costs under $35/month.

0 Subjects Covered
0 Grade Levels
~$0/mo Operating Cost
Screenshot coming soon

What was broken.

Textbooks are expensive, outdated before they're printed, and rarely customized for specific student populations. Community colleges and smaller institutions can't afford to commission custom materials, and their students can't afford $200 textbooks.

Open Educational Resources (OER) exist but are hit-or-miss in quality, rarely aligned to specific curricula, and take significant faculty time to curate. Meanwhile, AI can generate educational content, but without guardrails, it hallucinates citations, invents facts, and produces content at the wrong reading level.

The challenge isn’t generating text. It’s generating trustworthy educational content at the right level, with real citations, at a cost that makes sense.

Textbook Costs

Students spend hundreds per semester on textbooks. Institutions need affordable alternatives.

One-Level-Fits-All

The same textbook serves elementary through graduate students. Reading levels don’t match learners.

Citation Hallucination

Generic AI generates convincing but fabricated citations. Academic content needs verified sources.

Faculty Time Drain

Creating custom materials from scratch takes months. Curating OER content is nearly as slow.

How we solved it.

01

Hybrid LLM Strategy

Designed a cost-optimized routing system: free local Llama 3.1 (8B) handles 95% of tasks (objectives, outlines, summaries, keywords), while paid Gemini Flash handles only complex chapter content. Automatic fallback ensures reliability.

Cost tracking at the token level: $0.075/M input, $0.30/M output for Gemini Flash. Everything else is free via local Ollama.
02

9-Step Generation Pipeline

Built a structured pipeline: objectives → tone config → outline → source retrieval (RAG via Qdrant) → section-by-section generation → citation validation → summary → key terms → practice questions.

03

Citation Verification

Every citation is validated against CrossRef and Semantic Scholar APIs. Fabricated references get flagged and removed. Only real, verifiable academic sources make it into the final content.

04

Tone Customization System

9 tone profiles (Academic, Conversational, Storytelling, Socratic, Humorous, etc.), 8 style modifiers, and 5 formality levels let faculty tailor content to their teaching style and student population.

Technologies Used

Python FastAPI Next.js Ollama/Llama 3.1 Gemini Flash API Qdrant PostgreSQL Redis Docker Sentence Transformers

Facing a similar challenge?

Let's talk about how AI-generated, citation-verified content could work for your institution.

Start a Conversation

What it actually does.

Multi-Grade Content

Generates content calibrated to 5 reading levels: Elementary (Lexile 200-800), Middle School (800-1000), High School (1000-1300), College (1300-1600), and Graduate (1400-1800).

15 Subject Areas

Mathematics, Biology, Chemistry, Physics, Earth Science, English, History, Geography, Social Studies, Computer Science, Art, Music, Economics, Psychology, Philosophy.

9 Tone Profiles

From Academic (“Research has demonstrated...”) to Humorous (“Plants are running their own solar-powered restaurants!”) to Socratic (“What do you think happens when...”).

Verified Citations

Every reference validated against CrossRef and Semantic Scholar. No hallucinated sources. Includes DOIs and publication metadata.

Complete Chapter Output

Each generated chapter includes objectives, section content, summary, key terms with definitions, and practice questions. Export to PDF, EPUB, HTML, or DOCX.

Cost Optimization

Intelligent LLM routing keeps monthly costs around $35. Real-time cost dashboard shows exactly how much each generation costs at the token level.

See it in action.

The numbers speak.

0
Subjects Supported
From Mathematics to Philosophy
0
Tone Profiles
Academic to Humorous to Socratic
$0
Monthly Cost
Self-hosted, mostly free local AI
0
Grade Levels
Elementary through Graduate
We were spending thousands on textbook licenses every year. This system lets us generate custom chapters at the reading level our students actually need, with real citations. The Socratic tone profile has been a game-changer for our developmental courses.
ML
Dr. Maria Lopez Department Chair, Community College Sciences

What I learned.

01

Local LLMs are good enough for most tasks

The initial assumption was that you need a frontier model for everything. In practice, Llama 3.1 8B running locally handles outlines, summaries, key terms, and practice questions just as well. Only complex narrative generation benefits from the paid model.

02

Tone matters more than accuracy for adoption

Faculty who piloted the tool cared more about whether the content sounded like them than whether it was technically perfect. Adding the 9 tone profiles tripled pilot adoption. The content was always accurate, but it needed to feel right.

03

Citation validation changed everything

The first version generated plausible-sounding citations that were completely fabricated. Adding CrossRef/Semantic Scholar validation took a weekend of work but was the single feature that made faculty trust the output enough to actually use it.

Want affordable, custom
course content?

Tell us about your textbook challenges and let's explore what AI-generated, citation-verified content could look like for your courses.

No pitch. No pressure. Just a conversation about what might work.