|
|
||
|---|---|---|
| .. | ||
| src/imajin_app | ||
| tests | ||
| pyproject.toml | ||
| README.md | ||
| SERVICE_CONTRACTS.md | ||
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.