Files
resonance-engine/beast-build/IMAGE_CAPABILITY_REPORT.md
T

165 lines
6.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Image Generation Capability — Function Report
**Date:** March 20, 2026
**System:** Beast (192.168.1.34) — Khra'gixx v4 Lattice
**Status:** ✅ OPERATIONAL
---
## 1. Overview
Image generation via **Nano Banana Pro** (Google Gemini 2.5 Flash Image API) is live and wired into the Lattice Observer. This provides on-demand AI image generation accessible to the CTO, the navigator (embodied observer), and any OpenClaw agent — with zero GPU/VRAM impact on the running lattice.
---
## 2. Architecture
```
┌──────────────────────┐
│ Google Gemini API │
│ (gemini-2.5-flash- │
│ image) │
└──────────┬───────────┘
│ HTTPS
┌─────────────┐ POST /generate_image ┌─────┴──────────────┐
│ CTO / Agent │ ──────────────────────► │ Lattice Observer │
│ (any HTTP │ │ PID 1863340 │
│ client) │ ◄────────────────────── │ Port 28820 │
└─────────────┘ JSON response + path │ (WSL Ubuntu) │
└─────┬──────────────┘
│ saves PNG
D:\fractal-brain\beast-build\
generated_images\
```
**Key design:** The Gemini API call is cloud-based. No local GPU compute. No VRAM contention with the CUDA daemon or Ollama qwen3-vl:8b.
---
## 3. Endpoint Specification
### `POST /generate_image`
**URL:** `http://192.168.1.34:28820/generate_image`
**Content-Type:** `application/json`
#### Request Body
| Field | Type | Required | Description |
|------------|--------|----------|--------------------------------------|
| `prompt` | string | ✅ Yes | Image description / generation prompt |
| `filename` | string | No | Output filename (default: `gen_<timestamp>.png`) |
#### Example Request
```json
{
"prompt": "A luminous fractal brain lattice glowing in blue and gold, fluid dynamics visualization, dark background",
"filename": "lattice_viz_001.png"
}
```
#### Success Response (200)
```json
{
"path": "/mnt/d/fractal-brain/beast-build/generated_images/lattice_viz_001.png",
"filename": "lattice_viz_001.png",
"model": "gemini-2.5-flash-image",
"elapsed_s": 6.3,
"model_text": "Here is your image:"
}
```
#### Error Responses
| Code | Condition |
|------|-----------------------------|
| 400 | Missing prompt or bad JSON |
| 413 | Payload > 100KB |
| 500 | Gemini API error / no image |
---
## 4. Test Results
| Test | Model | Result | Time | Output Size |
|------|-------|--------|------|-------------|
| Direct API (uv run) | gemini-2.5-flash-image | ✅ 1024×1024 PNG | ~5s | 1,519 KB |
| generate_image.py script | gemini-2.5-flash-image | ✅ 1024×1024 PNG | ~6s | 1,664 KB |
| Observer /generate_image endpoint | gemini-2.5-flash-image | ✅ 1024×1024 PNG | 6.3s | 1,597 KB |
All three test images verified on disk:
- `D:\fractal-brain\beast-build\test_nanobana.png` (1,519 KB)
- `D:\fractal-brain\beast-build\test_nanobana_e2e.png` (1,664 KB)
- `D:\fractal-brain\beast-build\generated_images\test_observer_gen.png` (1,597 KB)
---
## 5. Specifications
| Parameter | Value |
|-------------------|----------------------------------------|
| API Provider | Google Gemini (Nano Banana Pro) |
| Model | gemini-2.5-flash-image |
| Resolution | 1024 × 1024 PNG |
| Generation Speed | ~6 seconds per image |
| Cost | ~$0.020.04 per image (pay-as-you-go) |
| VRAM Impact | **ZERO** (cloud API, not local GPU) |
| Billing Project | gen-lang-client-0149282988 |
| Output Directory | D:\fractal-brain\beast-build\generated_images\ |
---
## 6. Access Methods
### From any HTTP client (curl, Python, browser):
```bash
curl -X POST http://192.168.1.34:28820/generate_image \
-H "Content-Type: application/json" \
-d '{"prompt": "your image description", "filename": "output.png"}'
```
### From OpenClaw (Nano Banana Pro skill):
```bash
cd D:\OpenClaw\skills\nano-banana-pro\scripts
set GEMINI_API_KEY=AIzaSyBAqdK7ThVcct7pzgaqXR09resrao6j8ro
uv run generate_image.py --prompt "your description" --filename output.png --resolution 1K
```
The OpenClaw skill also supports:
- `--resolution 1K|2K|4K` — output size control
- `-i image1.png -i image2.png` — image editing / multi-image composition (up to 14 inputs)
### From the Navigator (via /ask):
The navigator was briefed at turn 616, cycle 13,401,650. It acknowledged and is aware of the `/generate_image` endpoint.
---
## 7. Files Modified / Created
| File | Change |
|------|--------|
| `lattice_observer.py` | Added `POST /generate_image` handler, GEMINI_API_KEY config, GEMINI_MODEL config, IMAGE_OUTPUT_DIR config |
| `generate_image.py` (OpenClaw skill) | Updated model from `gemini-3-pro-image-preview``gemini-2.5-flash-image` |
| `openclaw.json` | Added nano-banana-pro skills entry with GEMINI_API_KEY env |
| WSL Python env | Installed `google-genai>=1.0.0` system-wide |
---
## 8. System Status at Time of Report
| Component | PID | Status |
|-----------|-----|--------|
| CUDA Daemon (v4) | 1422107 | ✅ Running, cycle 13,653,580 |
| Lattice Observer | 1863340 | ✅ Running, 713 turns, port 28820 |
| Sentry Monitor | 1781543 | ✅ Running, 200-save cap |
| OpenClaw Gateway | 69012 | ✅ Running, ports 28810/28812/28813 |
| Ollama (qwen3-vl:8b) | — | ✅ Active, coherence 0.668 |
| Gemini Image API | — | ✅ Authenticated, paid tier |
---
*Report generated March 20, 2026. All systems nominal.*