File size: 2,161 Bytes
6d4c04b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# API Reference

## High-level flow

```mermaid

sequenceDiagram

    participant Client

    participant API as Texture API

    participant Engine as TextureEngine

    participant Model as Diffusion Model



    Client->>API: POST /v1/textures/generate

    API->>Engine: generate_batch(prompt, seed, steps)

    Engine->>Model: run inference

    Model-->>Engine: generated 256x256 image

    Engine-->>API: 16x16 tile + base64 payload

    API-->>Client: JSON response with image data

```

### Example gallery

![Texture collage](../examples/texture_collage.png)

## GET /health

Returns engine and GPU status.

```json

{

  "status": "ready",

  "device": "cuda",

  "cuda_available": true,

  "gpu_name": "NVIDIA RTX 4070",

  "vram_total_gb": 12.0,

  "vram_allocated_gb": 1.2,

  "model_path": "models/minecraft-item-16px"

}

```

## POST /v1/textures/generate

Generate one or more 16x16 transparent textures from a prompt.

The engine removes the model's magenta chroma-key and attempts to remove other flat or repeating backgrounds that connect to the image corners. Background removal is heuristic; complex backgrounds or items touching the corners may need manual cleanup.

Request body:

```json

{

  "prompt": "ruby broadsword with glowing runes",

  "negative_prompt": "blurry, low quality",

  "variants": 2,

  "seed": 42,

  "steps": 30,

  "guidance_scale": 9.0

}

```

Response:

```json

{

  "prompt": "ruby broadsword with glowing runes",

  "count": 2,

  "results": [

    {

      "variant_index": 1,

      "seed": 42,

      "latency_sec": 1.4,

      "base64_png": "...",

      "data_uri": "data:image/png;base64,..."

    }

  ]

}

```

## Example usage flow

```bash

curl -X POST http://127.0.0.1:8000/v1/textures/generate \

  -H "Content-Type: application/json" \

  -d '{

    "prompt": "frost potion with blue crystal glow",

    "variants": 3,

    "seed": 77,

    "steps": 30,

    "guidance_scale": 9.0

  }'

```

This is useful when you want to generate several candidate item textures for a UI mockup, a plugin idea, or an AI asset pipeline before choosing the best result.