> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modelslab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Inpainting

> Inpaint some part in a given image using Pony models.

<img src="https://mintcdn.com/mod/i8dYICFkuz1vpdrI/images/image-generation/community-models/assets/images/inpainting-8bb5f9bb4dc5d5307f0fd83248dfc296.jpg?fit=max&auto=format&n=i8dYICFkuz1vpdrI&q=85&s=59c688dbd56bb8b7c868c77beca5202c" alt="Inpainting endpoint result" width="691" height="518" data-path="images/image-generation/community-models/assets/images/inpainting-8bb5f9bb4dc5d5307f0fd83248dfc296.jpg" />

<Check>
  You can find a list of the public models available and their IDs [here](https://modelslab.com/models?base_model%5B0%5D=sdxl-10\&base_model%5B1%5D=sd-15\&base_model%5B2%5D=flux-1-d\&base_model%5B3%5D=pony\&feature=imagen\&model_type%5B0%5D=checkpoint\&sort=recommended)
</Check>

<Note>
  See available [schedulers](/image-generation/pony-models/scheduler) for Pony models.
</Note>

## Request

Make a `POST` request to below endpoint and pass the required parameters as a request body.

```curl curl theme={null}
--request POST 'https://modelslab.com/api/v6/images/inpaint' \
```

## Body

```json json theme={null}
{
    "key": "your_api_key",
    "model_id": "pony-realism",
    "prompt": "a cat sitting on a bench",
    "negative_prompt": null,
    "init_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",
    "mask_image": "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",
    "width": "512",
    "height": "512",
    "samples": "1",
    "steps": "21",
    "safety_checker": "no",
    "guidance_scale": 7.5,
    "strength": 0.7,
    "scheduler": "DPMSolverMultistepScheduler",
    "use_karras_sigmas": "yes",
    "algorithm_type": "sde-dpmsolver++",
    "clip_skip": "2",
    "seed": null,
    "webhook": null,
    "track_id": null
}
```


## OpenAPI

````yaml image-generation/pony-models/openapi.json POST /inpaint
openapi: 3.1.0
info:
  title: ModelsLab Pony Models Image Generation API
  description: >-
    API for AI-driven image generation using Pony models, including
    text-to-image, image-to-image, and inpainting capabilities.
  license:
    name: MIT
  version: 6.0.0
servers:
  - url: https://modelslab.com/api/v6/images
    description: Pony Models Image Generation API v6 server
security: []
paths:
  /inpaint:
    post:
      summary: Inpainting
      description: >-
        Changes (inpaints) a specific part of an image based on provided image,
        mask, and text prompts using Pony models.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InpaintingRequest'
      responses:
        '200':
          description: Inpainting generation response
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ImageGenerationSuccessResponse'
                  - $ref: '#/components/schemas/ImageGenerationProcessingResponse'
                  - $ref: '#/components/schemas/ImageGenerationErrorResponse'
        '400':
          $ref: '#/components/responses/StandardErrorResponse'
        '401':
          $ref: '#/components/responses/StandardErrorResponse'
        '500':
          $ref: '#/components/responses/StandardErrorResponse'
components:
  schemas:
    InpaintingRequest:
      type: object
      required:
        - key
        - model_id
        - init_image
        - mask_image
      properties:
        key:
          type: string
          description: Your API Key used for request authorization.
        model_id:
          type: string
          description: >-
            The ID of the Pony model to be used. Use `pony_realism` for the Pony
            Realism model.
        prompt:
          type: string
          description: A text description of what you want in the generated image.
        negative_prompt:
          type: string
          description: Items you don't want in the image.
        init_image:
          type: string
          format: uri
          description: URL of the initial image.
        mask_image:
          type: string
          format: uri
          description: URL of the mask image for inpainting.
        width:
          type: integer
          default: 512
          minimum: 512
          maximum: 1024
          description: >-
            The width of the image in pixels. Must be between 512-1024 and
            divisible by 8.
        height:
          type: integer
          default: 512
          minimum: 512
          maximum: 1024
          description: >-
            The height of the image in pixels. Must be between 512-1024 and
            divisible by 8.
        samples:
          type: integer
          default: 1
          maximum: 4
          description: The number of images to be returned in response. Maximum is 4.
        steps:
          type: integer
          default: 21
          description: Number of inference steps for inpainting.
        guidance_scale:
          type: number
          default: 7.5
          minimum: 1
          maximum: 20
          description: >-
            How closely to follow the prompt. Higher values = more literal
            interpretation.
        strength:
          type: number
          default: 0.7
          minimum: 0
          maximum: 1
          description: Prompt strength when using the initial image. Range from 0 to 1.
        scheduler:
          type: string
          default: DPMSolverMultistepScheduler
          description: Scheduler to use for denoising.
        use_karras_sigmas:
          type: string
          default: 'yes'
          enum:
            - 'yes'
            - 'no'
          description: Apply Karras sigmas to the scheduler.
        algorithm_type:
          type: string
          default: sde-dpmsolver++
          description: Algorithm type for the scheduler.
        clip_skip:
          type: integer
          default: 2
          minimum: 1
          maximum: 4
          description: Number of CLIP layers to skip. Affects style interpretation.
        safety_checker:
          type: string
          default: 'yes'
          enum:
            - 'yes'
            - 'no'
          description: Enable NSFW content filter.
        seed:
          oneOf:
            - type: integer
            - type: 'null'
          description: Random seed for reproducible results. Pass null for a random number.
        webhook:
          type: string
          format: uri
          description: URL to receive a POST API call once image generation is complete.
        track_id:
          type: string
          description: Unique ID used in webhook response to identify the request.
    ImageGenerationSuccessResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
          description: Status of the image generation.
        generationTime:
          type: number
          description: Time taken to generate the image in seconds.
        id:
          type: integer
          description: Unique identifier for the image generation request.
        output:
          type: array
          items:
            type: string
            format: uri
          description: Array of generated image URLs.
        proxy_links:
          type: array
          items:
            type: string
            format: uri
          description: Array of proxy image URLs.
        meta:
          type: object
          description: Metadata about the image generation including all parameters used.
          additionalProperties: true
        nsfw_content_detected:
          type: boolean
          description: Indicates if NSFW content was detected in the generated image.
        webhook_status:
          type: string
          description: Status of the webhook notification.
        tip:
          type: string
          description: Additional information or tips for the user.
    ImageGenerationProcessingResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - processing
          description: Status of the image generation.
        tip:
          type: string
          description: Information about faster processing options.
        tip_1:
          type: string
          description: Additional tip, usually pointing to the fetch API.
        eta:
          type: number
          description: Estimated time for completion in seconds.
        message:
          type: string
          description: Processing status message.
        webhook_status:
          type: string
          description: Status of the webhook notification.
        fetch_result:
          type: string
          format: uri
          description: URL to fetch the result when processing.
        id:
          type: integer
          description: Unique identifier for the image generation request.
        output:
          type: array
          items:
            type: string
          description: Empty array during processing.
        meta:
          type: object
          description: Metadata about the image generation including all parameters used.
          additionalProperties: true
        future_links:
          type: array
          items:
            type: string
            format: uri
          description: Array of future image URLs for queued requests.
    ImageGenerationErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: Error message description.
  responses:
    StandardErrorResponse:
      description: >-
        Bad request (invalid parameters), unauthorized (invalid API key), or
        internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ImageGenerationErrorResponse'

````