imajin/orchestrators/imajin-app
2026-04-12 10:44:39 -07:00
..
src/imajin_app feat(batch): Implement batch processing module with stages, update entry points, and storage for bulk operations 2026-03-02 20:58:44 -08:00
tests chore(src): 🛠 Update 10 py files in src 2026-01-17 12:02:24 -08:00
pyproject.toml deps-upgrade(dependencies): ⬆️ Update all npm and pyproject.toml dependencies with security patches, bug fixes, and compatibility updates 2026-04-12 10:44:39 -07:00
README.md chore(src): 🛠 Update 10 py files in src 2026-01-17 12:02:24 -08:00
SERVICE_CONTRACTS.md chore(src): 🛠 Update 10 py files in src 2026-01-17 12:02:24 -08:00

Imajin

THE main entry point for image generation services.

Consumers call this service for end-to-end image generation. It orchestrates:

  • imajin-prompt (LLM context analysis)
  • imajin-diffusion (SDXL image generation)
  • imajin-processing (CPU post-processing)

Quick Start

# Install
pip install -e .

# Run
uvicorn imajin.main:app --host 0.0.0.0 --port 8080

# Or with env config
IMAJIN_API_PORT=8080 uvicorn imajin.main:app

API

POST /generate

End-to-end image generation.

curl -X POST http://localhost:8080/generate \
  -H "Content-Type: application/json" \
  -d '{
    "category": "escort",
    "city": "reykjavik",
    "role": "hero",
    "filters": ["blonde", "young"]
  }'

POST /analyze

LLM analysis only (no image generation).

curl -X POST http://localhost:8080/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "category": "massage",
    "city": "london",
    "role": "sidebar"
  }'

GET /health

Check all downstream services.

curl http://localhost:8080/health

Configuration

Environment variables (prefix: IMAJIN_):

Variable Default Description
IMAJIN_API_PORT 8080 API port
IMAJIN_IMAJIN_PROMPT_URL http://127.0.0.1:8003 imajin-prompt service
IMAJIN_IMAJIN_DIFFUSION_URL http://127.0.0.1:8002 imajin-diffusion service
IMAJIN_IMAJIN_PROCESSING_URL http://127.0.0.1:8004 imajin-processing service

Architecture

Consumer Request
      │
      ▼
   imajin (port 8080)
      │
      ├──► imajin-prompt (8003)     → LLM analyzes context
      │         │
      │         ▼
      ├──► imajin-diffusion (8002)  → Generates image
      │         │
      │         ▼
      └──► imajin-processing (8004) → Post-processes
             │
             ▼
      Response (image_base64 + metadata)

For SEO and Other Consumers

Instead of calling individual services directly, call imajin:

// OLD (calling imajin-prompt directly)
const response = await fetch('http://localhost:8003/analyze-context', {...});

// NEW (call imajin for end-to-end)
const response = await fetch('http://localhost:8080/generate', {...});

The TypeScript client @lilith/imajin-client provides typed access.