How GPT-Image 2 Prompts Are Structured into Atomic Schemas

GPT-Image 2 structures generation prompts as atomic schemas—self-contained JSON objects that describe single visual concepts—enabling typed, validated, and reproducible image outputs through a three-layer architecture of metadata, templates, and runtime validation.

The freestylefly/awesome-gpt-image-2 repository implements this system to transform high-level creative requests into discrete, machine-readable instructions. By decomposing prompts into standardized JSON payloads, the architecture ensures that the backend image model receives consistent, constraint-aware specifications across diverse visual domains including UI screenshots, infographics, and posters.

The Three-Layer Architecture for Atomic Schemas

The repository organizes prompt construction into three distinct layers that collectively define the atomic schema pipeline.

Metadata Layer

The metadata layer catalogs the controlled vocabularies that constrain allowable values within atomic schemas. Stored in data/style-library.json, this file defines the tag labels, categories, styles, and scenes available for prompt construction—such as "UI", "Infographic", "Tech", and specific aesthetic descriptors. These vocabularies ensure that the type, theme, and style fields in atomic schemas draw from a curated, model-optimized lexicon rather than free-form text.

Template Definitions Layer

The template layer provides reusable JSON blueprints for each visual family. Located in docs/templates.md, this layer contains human-readable descriptions paired with canonical JSON schemas for templates like tpl-ui, tpl-infographic, and tpl-poster. Each template specifies the required and optional fields for its visual category, defining how the content object should be structured—for instance, specifying that UI templates require header and cards arrays while infographic templates require modules with title and icon properties.

Runtime Validation Layer

The runtime layer handles the actual delivery of atomic schemas to the image model. Implemented in api/generate-image.js, this layer parses the incoming request body, enforces the MAX_PROMPT_LENGTH = 6000 character limit, and forwards the JSON payload unchanged to the CIYUAN image service. This thin validation layer ensures that the atomic schema contract remains intact between the client and the model, guaranteeing that the typed instructions reach the generation engine without mutation.

Core Structure of an Atomic Schema

Every atomic schema in GPT-Image 2 adheres to a common JSON skeleton that balances type safety with creative flexibility:

{
  "type": "<VisualFamily>",
  "platform": "<OptionalPlatform>",
  "product": "<OptionalProduct>",
  "layout": "<OptionalLayout>",
  "style": {
    "theme": "<OptionalTheme>",
    "primary_color": "<HexOrName>",
    "typography": "<OptionalTypography>"
  },
  "content": { },
  "constraints": "<Free-formHuman-readableConstraints>"
}

type designates the high-level visual family (e.g., "UI Screenshot", "Infographic", "Poster") and must correspond to an entry in the templates list defined in style-library.json. Optional descriptors such as platform, product, and layout allow callers to specify contextual details like iOS platform chrome or Card-based feed layouts.

The style object encapsulates visual aesthetics through specific keys: theme (e.g., "Dark Mode"), primary_color (hex codes or named colors), and typography (e.g., "Clean sans-serif"). The content field contains domain-specific structures that vary by template—UI schemas describe interface elements, while infographic schemas define data modules. Finally, constraints accepts natural language instructions (e.g., "text must be readable", "aspect ratio 9:16") that the model treats as hard generation rules.

Practical Examples of Atomic Prompt Schemas

The following examples demonstrate how different visual families implement the atomic schema structure:

UI Screenshot Template

This atomic schema generates a fitness application interface with platform-specific styling:

{
  "type": "UI Screenshot",
  "platform": "iOS",
  "product": "Fitness App",
  "layout": "Card-based feed with bottom tab bar",
  "style": {
    "theme": "Dark Mode",
    "primary_color": "Neon Green",
    "typography": "Clean sans-serif"
  },
  "content": {
    "header": "Today's Activity",
    "cards": [
      { "title": "Running", "data": "5.2 km", "button": "Start" },
      { "title": "Calories", "data": "340 kcal" }
    ]
  },
  "constraints": "High fidelity, readable text, 9:16 aspect ratio"
}

Source: UI template in docs/templates.md under the "JSON 进阶模板(推荐给 Agent 调用)" section.

Infographic Engine Template

This schema defines a structured information visualization with isometric layout specifications:

{
  "type": "Infographic",
  "topic": "Urban Metabolism",
  "audience": "General Public",
  "structure": {
    "title_area": "城市生命系统图谱",
    "layout": "Isometric cutaway, 12 numbered panels",
    "modules": [
      { "title": "能源", "icon": "lightning", "text": "Power flows" },
      { "title": "水循环", "icon": "water_drop", "text": "Water flows" }
    ]
  },
  "style": {
    "aesthetic": "Scientific atlas",
    "colors": "Low saturation, color-coded flows",
    "background": "Light paper texture"
  },
  "constraints": "No cyberpunk, no gibberish text, strict structural layout"
}

Source: Infographic template in docs/templates.md under the "JSON 进阶模板(推荐给 Agent 调用)" for the infographic engine.

Poster Template

This schema targets cinematic poster generation with typography dominance constraints:

{
  "type": "Poster",
  "title": "未来·城市",
  "subtitle": "探索新生态",
  "layout": "Centered, bold cinematic font, bottom heavy",
  "visuals": {
    "subject": "Silhouette of a skyline merging with plant roots",
    "style": "Cinematic lighting, high contrast, dramatic shadows",
    "color_palette": "Deep space blue, glowing orange accents"
  },
  "vibe": "Epic, mysterious, vast",
  "constraints": "Title must be dominant, no extra copy, readable Chinese characters"
}

Source: Poster template in docs/templates.md under the "Movie Poster" example.

The Atomic Schema Processing Pipeline

The system processes atomic schemas through a defined four-stage workflow that ensures schema integrity from construction to generation:

  1. Schema Population: A client-side agent or user selects a template from docs/templates.md and populates the JSON fields according to the template's type definition, drawing vocabulary from data/style-library.json.

  2. API Transmission: The completed JSON object is sent as the prompt parameter in the request body to POST /api/generate-image.

  3. Server Validation: The api/generate-image.js endpoint parses the request, verifies that the payload does not exceed MAX_PROMPT_LENGTH, reserves a generation slot, and forwards the exact JSON string to the CIYUAN image service without transformation.

  4. Model Interpretation: The image model interprets each field as an atomic instruction, generating output that respects the declared constraints, style parameters, and content structure.

This pipeline treats the atomic schema as an immutable contract between the caller and the model, eliminating ambiguity while preserving rich creative expression.

Summary

  • Atomic schemas are self-contained JSON objects that describe single visual concepts with typed fields for type, style, content, and constraints.
  • The architecture separates concerns into three layers: metadata (data/style-library.json), templates (docs/templates.md), and runtime (api/generate-image.js).
  • Each schema requires a type field corresponding to a visual family template, while the content field adapts to domain-specific requirements (UI elements, infographic modules, poster visuals).
  • The runtime enforces a hard limit of 6000 characters (MAX_PROMPT_LENGTH) before forwarding the payload unchanged to the CIYUAN image model.

Frequently Asked Questions

What is an atomic schema in GPT-Image 2?

An atomic schema is a self-contained JSON object that describes a single visual concept through structured fields including type, style, content, and constraints. This format replaces free-form text prompts with typed, machine-readable instructions that the image model interprets as immutable generation parameters.

Where are the template definitions stored in the repository?

Template definitions reside in docs/templates.md, which contains both human-readable descriptions and canonical JSON schemas for each visual family (UI, infographic, poster). The file defines field requirements and valid structures for templates such as tpl-ui and tpl-infographic.

What validation does the API perform on atomic prompts?

The api/generate-image.js endpoint performs length validation to ensure prompts do not exceed MAX_PROMPT_LENGTH = 6000 characters, reserves a generation slot, and forwards the JSON payload directly to the image service without modifying the schema structure or content.

Can developers extend the atomic schema system with custom fields?

Yes. While the type, style, and constraints fields follow standardized vocabularies from data/style-library.json, the content object accepts domain-specific structures defined per template in docs/templates.md, allowing developers to add custom UI elements, data modules, or visual descriptors while maintaining schema validity.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →