---
title: "p-image-lora"
description: "Text-to-image generation with custom LoRA weights"
url: "https://docs.api.pruna.ai/guides/models/p-image-lora"
image: "https://docs.api.pruna.ai/_og/d/c_Ocean.takumi,title_p-image-lora,description_Text-to-image+generation+with+custom+LoRA+weights,props_eyJ0aGVtZSI6eyJtb2RlIjoibGlnaHQiLCJjb2xvcnMiOnsicHJpbWFyeSI6IiM3YzNhZWQifX19,p_Ii9ndWlkZXMvbW9kZWxzL3AtaW1hZ2UtbG9yYSI,s_Q1rNHEYqmAs_FqOz.png"
---

# p-image-lora

Text-to-image generation with custom LoRA weights from HuggingFace

## [Overview](#overview)

p-image-lora extends Pruna's p-image model with support for custom LoRA (Low-Rank Adaptation) weights from HuggingFace. Load your own trained LoRAs or community LoRAs to apply unique artistic styles, characters, or concepts to your generations.

**Rate Limit:** 250 requests per minute

**Category:** Text-to-Image Generation

**Price:** 0.005$ / image

**Note:** LoRAs used with this endpoint must be trained using `p-image-trainer`. LoRAs trained with other trainers (like `p-image-edit-trainer`) will not work.

## [Quickstart](#quickstart)

### [Basic Generation with LoRA (Asynchronous)](#basic-generation-with-lora-asynchronous)

```bash
curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: p-image-lora' \
  -d '{
    "input": {
      "prompt": "A portrait in my custom artistic style",
      "lora_weights": "huggingface.co/your-username/your-lora-repo",
      "lora_scale": 1.0,
      "aspect_ratio": "1:1"
    }
  }'
```

Response:

```text
{
  "id": "abc123xyz",
  "model": "p-image-lora",
  "input": { ... },
  "get_url": "https://api.pruna.ai/v1/predictions/status/abc123xyz"
}
```

Check status and get results:

```bash
curl -X GET 'https://api.pruna.ai/v1/predictions/status/abc123xyz' \
  -H 'apikey: YOUR_API_KEY'
```

### [Basic Generation with LoRA (Synchronous)](#basic-generation-with-lora-synchronous)

```bash
curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: p-image-lora' \
  -H 'Try-Sync: true' \
  -d '{
    "input": {
      "prompt": "A portrait in my custom artistic style",
      "lora_weights": "huggingface.co/your-username/your-lora-repo",
      "lora_scale": 1.0,
      "aspect_ratio": "1:1"
    }
  }'
```

### [Using a Private HuggingFace LoRA](#using-a-private-huggingface-lora)

For private LoRA repositories, include your HuggingFace API token:

```bash
curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: p-image-lora' \
  -d '{
    "input": {
      "prompt": "A landscape in my custom style",
      "lora_weights": "huggingface.co/your-username/private-lora",
      "hf_api_token": "hf_xxxxxxxxxxxxxxxxxxxx",
      "lora_scale": 1.2
    }
  }'
```

### [Parameters](#parameters)

#### [Required Parameters](#required-parameters)

| Parameter | Type   | Description                      |
| :-------- | :----- | :------------------------------- |
| prompt    | string | Text prompt for image generation |

#### [LoRA Parameters](#lora-parameters)

| Parameter    | Type   | Default | Description                                                                      |
| :----------- | :----- | :------ | :------------------------------------------------------------------------------- |
| lora_weights | string | -       | HuggingFace URL to LoRA weights. Format: huggingface.co/<owner>/<model-name>[/<lora-weights-file.safetensors>] |
| lora_scale   | number | 0.5     | How strongly to apply the LoRA. Range: -1 to 3. 0.5 usually works well for most LoRAs |
| hf_api_token | string | -       | HuggingFace API token for accessing private LoRAs. Get one at https://huggingface.co/settings/tokens |

#### [Generation Parameters](#generation-parameters)

| Parameter              | Type    | Default | Description                                                                      |
| :--------------------- | :------ | :------ | :------------------------------------------------------------------------------- |
| aspect_ratio           | string  | "16:9"  | Aspect ratio for the image. Options: "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "custom" |
| width                  | integer | -       | Custom width in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16 |
| height                 | integer | -       | Custom height in pixels (256-1440). Only used when aspect_ratio="custom". Must be multiple of 16 |
| seed                   | integer | random  | Random seed for reproducible generation                                          |
| prompt_upsampling      | boolean | false   | Upsample the prompt with an LLM for enhanced results                             |
| disable_safety_checker | boolean | false   | Disable safety checker for generated images                                      |