197 lines
5.7 KiB
Markdown
197 lines
5.7 KiB
Markdown
# ComfyUI Pruna API
|
||
|
||
ComfyUI custom nodes for running [Pruna API](https://docs.api.pruna.ai) models directly inside ComfyUI workflows.
|
||
|
||
## Nodes
|
||
|
||
### Pruna Text to Image
|
||
|
||
Generate images from text prompts using the Pruna API.
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `prompt` | string | Text description of the image to generate |
|
||
| `model` | dropdown | Pruna API model to use |
|
||
| `aspect_ratio` | dropdown | Output image aspect ratio |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
|
||
**Output:** `IMAGE` — compatible with any ComfyUI node that accepts an image.
|
||
|
||
**Supported models:** `p-image`
|
||
|
||
**Supported aspect ratios:** `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`
|
||
|
||
---
|
||
|
||
### Pruna Text to Image LoRA
|
||
|
||
Generate images from text prompts with a custom LoRA using the Pruna API.
|
||
|
||
> LoRA weights must be a HuggingFace URL in the format `huggingface.co/<username>/<repo>[/<filename>]`. LoRAs must be trained with `p-image-trainer`.
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `prompt` | string | Text description of the image to generate |
|
||
| `model` | dropdown | Pruna API model to use |
|
||
| `lora_weights` | string | HuggingFace path to LoRA weights |
|
||
| `lora_scale` | float | LoRA influence scale (−1.0 – 3.0, default 0.5) |
|
||
| `aspect_ratio` | dropdown | Output image aspect ratio |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
| `hf_api_token` | string *(optional)* | HuggingFace token for private repos |
|
||
|
||
**Output:** `IMAGE`
|
||
|
||
**Supported models:** `p-image-lora`
|
||
|
||
**Supported aspect ratios:** `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`
|
||
|
||
---
|
||
|
||
### Pruna Image Edit
|
||
|
||
Edit an image with a text instruction using the Pruna API.
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `image` | IMAGE | Input image to edit |
|
||
| `prompt` | string | Edit instruction |
|
||
| `model` | dropdown | Pruna API model to use |
|
||
| `aspect_ratio` | dropdown | Output aspect ratio (`match_input_image` preserves the original) |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
|
||
**Output:** `IMAGE`
|
||
|
||
**Supported models:** `p-image-edit`
|
||
|
||
**Supported aspect ratios:** `match_input_image`, `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`
|
||
|
||
---
|
||
|
||
### Pruna Image Edit LoRA
|
||
|
||
Edit an image with a text instruction and a custom LoRA using the Pruna API.
|
||
|
||
> LoRA weights must be a HuggingFace URL in the format `huggingface.co/<username>/<repo>[/<filename>]`. LoRAs must be trained with `p-image-edit-trainer`.
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `image` | IMAGE | Input image to edit |
|
||
| `prompt` | string | Edit instruction |
|
||
| `model` | dropdown | Pruna API model to use |
|
||
| `lora_weights` | string | HuggingFace path to LoRA weights |
|
||
| `lora_scale` | float | LoRA influence scale (−1.0 – 3.0, default 0.5) |
|
||
| `aspect_ratio` | dropdown | Output aspect ratio |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
| `hf_api_token` | string *(optional)* | HuggingFace token for private repos |
|
||
|
||
**Output:** `IMAGE`
|
||
|
||
**Supported models:** `p-image-edit-lora`
|
||
|
||
**Supported aspect ratios:** `match_input_image`, `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`
|
||
|
||
---
|
||
|
||
### Pruna Image Upscale
|
||
|
||
AI-upscale an image to a target megapixel size using the Pruna API.
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `image` | IMAGE | Input image to upscale |
|
||
| `target_mp` | int | Target size in megapixels (1–8, default 4) |
|
||
| `enhance_details` | boolean | Apply detail enhancement pass |
|
||
| `enhance_realism` | boolean | Apply realism enhancement pass |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
|
||
**Output:** `IMAGE`
|
||
|
||
**Model:** `p-image-upscale` (fixed)
|
||
|
||
**Pricing:** $0.005/image for 1–4 MP target · $0.01/image for 5–8 MP target
|
||
|
||
---
|
||
|
||
### Pruna Video
|
||
|
||
Generate a video from a text prompt using the Pruna API. Optionally connect an image to animate it instead of generating from scratch (image-to-video mode).
|
||
|
||
**Inputs**
|
||
|
||
| Input | Type | Description |
|
||
|---|---|---|
|
||
| `prompt` | string | Text description of the video |
|
||
| `duration` | int | Video length in seconds (1–20, default 5) |
|
||
| `resolution` | dropdown | Output resolution (`720p` or `1080p`) |
|
||
| `aspect_ratio` | dropdown | Output aspect ratio |
|
||
| `draft` | boolean | Use draft mode (faster, lower cost) |
|
||
| `api_key` | string | Your Pruna API key (or set `PRUNA_API_KEY` env var) |
|
||
| `image` | IMAGE *(optional)* | Source image to animate (image-to-video mode) |
|
||
|
||
**Output:** `STRING` (video URL) — pass to a video preview or download node.
|
||
|
||
**Model:** `p-video` (fixed)
|
||
|
||
**Supported aspect ratios:** `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`, `1:1`
|
||
|
||
**Pricing:**
|
||
|
||
| Resolution | Draft OFF | Draft ON |
|
||
|---|---|---|
|
||
| 720p | $0.02/sec | $0.005/sec |
|
||
| 1080p | $0.04/sec | $0.01/sec |
|
||
|
||
---
|
||
|
||
## Installation
|
||
|
||
### Via ComfyUI Manager (recommended)
|
||
|
||
Search for **ComfyUI Pruna API** in the ComfyUI Manager and click Install.
|
||
|
||
### Manual installation
|
||
|
||
```bash
|
||
cd ComfyUI/custom_nodes
|
||
git clone https://github.com/PrunaAI/ComfyUI_pruna_api
|
||
pip install -r ComfyUI_pruna_api/requirements.txt
|
||
```
|
||
|
||
Restart ComfyUI. The nodes appear under the **pruna ai** category in the node browser.
|
||
|
||
## Authentication
|
||
|
||
Get your API key from the [Pruna developer portal](https://docs.api.pruna.ai).
|
||
|
||
You can provide your key in two ways:
|
||
|
||
**Option 1 — Node field:** Type your key directly into the `api_key` input on the node.
|
||
|
||
**Option 2 — Environment variable (recommended):** Set `PRUNA_API_KEY` before launching ComfyUI:
|
||
|
||
```bash
|
||
# macOS / Linux
|
||
export PRUNA_API_KEY="your-key-here"
|
||
python main.py
|
||
|
||
# Windows
|
||
set PRUNA_API_KEY="your-key-here"
|
||
python main.py
|
||
```
|
||
|
||
If both are provided, the node field takes priority.
|
||
|
||
## License
|
||
|
||
MIT
|