Technical Overview

NGT — Next-Generation
Text Rendering Model

A two-tier Claude-based architecture that generates professional documents by rendering each section as raw SVG inside exact pixel bounding boxes. Structured intelligence at generation, visual intelligence at render time.

Anthropic Claude Sonnet 4.6 Anthropic Claude Haiku 4.5 SVG-native output API-first
The problem

AI can write. It cannot place.

Existing AI writing tools generate text content. They do not know how wide a column is. They do not know what font is being used, or how tall a heading will render at a given font size. The result is content that is placed into design tools by hand — the AI is a copywriter, not a designer.

Layout engines solve this partially — they know the space and they can place text with precision. But they cannot generate creative visuals. A stat row, a custom chart, a decorative background — these require a human or a specialised tool.

The gap: no single system combines a layout engine's knowledge of pixel-precise bounds with a language model's ability to generate visual content. NGT closes that gap.

Architecture

Two models, two responsibilities

NGT uses a two-tier model architecture. The responsibilities are separated by capability and by cost efficiency.

Tier 1
Sonnet
Document structure & content generation. Given a user prompt, Claude Sonnet produces a complete JSON document specification — section order, palette (8 semantic colour roles), typography (6 roles with families and sizes), layout margins, and full written content for every section. This call happens once per document.
Tier 2
Haiku
Per-element SVG generation. The local layout engine computes exact pixel bounding rectangles for every section. Each rectangle is sent to Claude Haiku with the palette, typography config, section content, and a one-line summary of all other sections. Haiku returns raw SVG elements clipped to that exact space. Three sections are generated in parallel.
Layout Engine
Measurement & assembly. A local JavaScript engine handles all text measurement (canvas-measured cap heights, ascender ratios), page flow (orphan/widow protection, keep-with-next), and final SVG assembly. No AI involved — instant, deterministic, reproducible.
Clip Contract
The bounding box guarantee. Every Haiku-generated SVG fragment is wrapped in a clipPath set to the computed section rectangle. Anything outside the bounds is invisible. This means the model can design confidently to the edges without risking overflow into adjacent sections.
The innovation

The bounding box as a generation contract

The key insight in NGT's architecture is using the layout engine's computed bounding rectangles as a generation contract passed to the AI model.

When Haiku receives a section to render, it knows exactly what it is working with:

// What Haiku receives for each section { "viewport": { "width": 1072, "height": 110 }, "sectionType": "stat_row", "content": { "items": [ { "value": "$12.4M", "label": "Revenue" }, { "value": "18%", "label": "Growth" } ]}, "palette": { "accent": "#c8633a", "text": "#1a1a18" }, "typography": { "display": "Playfair Display 72px w700" }, "docContext": "[0]hero | [1]body | [2]stat_row | [3]timeline" }

The model generates SVG elements with full creative freedom — gradients, custom shapes, decorative geometry, data visualisations — but is constrained by the pixel boundary enforced by the clip path. This produces results that neither a pure layout engine nor a pure language model could achieve alone.

Iteration

Per-element regeneration

Because each section is independently rendered, any section can be regenerated without touching the rest of the document. The user hovers a section in the preview, clicks Regenerate, optionally types an instruction ("add a gradient background", "increase whitespace", "make the numbers larger"), and only that element is redrawn.

The regeneration call sends the same context as the initial generation, plus the instruction. The model receives the current element's bounding box, full document palette and typography, and one-line summaries of all neighbouring sections so it can maintain visual consistency.

~2s
Typical per-element regeneration time via Haiku
25
Undo stack levels — every spec change is reversible
0
Other sections affected when one element is regenerated
API Product

Four endpoints. Complete document pipeline.

The NGT API exposes the full pipeline as REST endpoints authenticated by API key. Each endpoint maps to one stage of the architecture.

Generate
POST /api/ngt/generate — prompt → complete document spec (JSON). Uses Claude Sonnet.
Edit
POST /api/ngt/edit — spec + instruction → mutation array. Apply changes without regenerating the whole document.
Element
POST /api/ngt/element — section + bounds + palette → SVG fragment. Uses Claude Haiku. The per-element renderer exposed as a primitive.
Validate
POST /api/ngt/validate — spec → warnings array. Font size, overflow risk, colour contrast, table structure. Local computation, no AI.
Partnership

Built on Claude. Open to collaboration.

NGT's two-tier architecture demonstrates a production-quality pattern for combining Claude Sonnet's reasoning with Claude Haiku's speed inside a hard technical constraint — the pixel bounding box. It is a concrete, novel use of both models working at different capability tiers for cost efficiency.

The document spec is model-agnostic. The AI layer in ai.js is a thin adapter — swapping the underlying model is a one-line change. The architecture is equally compatible with Gemini, GPT-4, or any instruction-following model with a sufficient context window.

What we are looking for: API credits partnership, co-marketing opportunity, early access to upcoming model releases, and potential integration as a design generation layer in existing document or productivity tools.

Contact: zlatans1987@gmail.com · nextgentext.online

Try NGT Studio

7-day free trial. No credit card required.

Start free trial →