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

# Estimate Generation

> The generation estimate endpoint lets users estimate the number of credits required for a particular generation. With this endpoint, users can send a payload containing their preferred parameters. In return, they will receive the credit cost for processing the generation request and the current balance.



## OpenAPI

````yaml post /pub/v1/generations/estimate
openapi: 3.0.2
info:
  description: >-
    The Affogato API section provides a comprehensive set of APIs that allow you
    to create high-quality media content using textual and graphical inputs. By
    utilizing the features provided in this section, users can easily generate
    engaging visuals and media assets.You need an API key to use these APIs. To
    get your personal key, log in to Affogato, head to the account page at
    [Affogato](https://affogato.ai/account) and hit generate API key. Add this
    key as an X-API-Key header in the requests that you send.
  title: Affogato API
  version: '1.0'
servers: []
security: []
tags:
  - description: >-
      The Generation section allows users to create, view, and delete images on
      Rendernet.
    name: Generation
  - description: >-
      Explore all available resources that can be used for generating images on
      Rendernet. With this section, users can easily access key details about
      the resources at their disposal.
    name: Resources
  - description: Upload / Get information about assets that can be used for generation.
    name: Assets
paths:
  /pub/v1/generations/estimate:
    post:
      tags:
        - Generation
      summary: Generation Estimate
      description: >-
        The generation estimate endpoint lets users estimate the number of
        credits required for a particular generation. With this endpoint, users
        can send a payload containing their preferred parameters. In return,
        they will receive the credit cost for processing the generation request
        and the current balance.
      parameters:
        - description: >-
            API key needed to access our public endpoints. You can find yours
            under the 'Account' section of the website
          required: true
          schema:
            type: string
            title: X-API-KEY
            description: >-
              API key needed to access our public endpoints. You can find yours
              under the 'Account' section of the website
          name: X-API-KEY
          in: header
      requestBody:
        content:
          application/json:
            schema:
              items:
                $ref: '#/components/schemas/GenerationRequest'
              type: array
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EstimationSuccessResponse'
          description: The estimated credits for the generation
components:
  schemas:
    GenerationRequest:
      properties:
        aspect_ratio:
          description: The aspect ratio of the image for the generation
          enum:
            - '1:1'
            - '2:3'
            - '3:2'
            - '4:5'
            - '16:9'
            - '9:16'
          example: '1:1'
          type: string
        batch_size:
          description: >-
            The batch size of the generation (Max permissible value depends on
            your subscription plan). Visit [RenderNet
            pricing](https://app.rendernet.ai/pricing) for more details
          example: 1
          type: integer
        cfg_scale:
          description: >-
            AI guidance for this generation. Higher the value, the output will
            be closer to the prompt (but may result in distorted images after a
            point)
          example: 7
          maximum: 12
          minimum: 4
          type: number
        character:
          $ref: '#/components/schemas/Character'
          description: >-
            If you want to create images of a character, use the character’s
            name in the positive prompt. Example: {character_name} riding a bike
        control_net:
          $ref: '#/components/schemas/ControlNet'
          description: >-
            The control net(pose control) for the generation if you want to use
            (optional)
        facelock:
          $ref: '#/components/schemas/Facelock'
          description: >-
            The face you want to restore for the generation if you want to use
            (optional)
        loras:
          description: >-
            Query the list resources endpoint `GET /pub/v1/loras` to view all
            available LoRAs. You can add multiple LoRAs to a single generation.
            Make sure your LoRAs have the same base model (SD 1.5 / SDXL) as
            your selected style/model.
          items:
            $ref: '#/components/schemas/Lora'
          type: array
        model:
          description: >-
            Query the list models endpoint `GET /pub/v1/models` to view all
            available models.
          example: JuggernautXL
          type: string
        narrator:
          $ref: '#/components/schemas/Narrator'
          description: >-
            For Narrator generation, pass either `script` or `audio_asset_id`
            along with other required details in `narrator` payload. 
        prompt:
          $ref: '#/components/schemas/Prompt'
          description: The prompt for the generation
        quality:
          description: The quality of the image for the generation (Case Sensitive)
          enum:
            - Plus
            - Regular
          example: Plus
          type: string
        sampler:
          description: The sampler you want to use for the generation (Case Sensitive)
          enum:
            - DPM++ 2M Karras
            - DPM++ 2M SDE Karras
            - DPM++ 2S a Karras
            - DPM++ SDE
            - DPM++ SDE Karras
            - Euler a
          example: DPM++ 2M Karras
          type: string
        seed:
          description: >-
            The seed for the generation (randomized if you don't want to use a
            seed)
          example: 1234
          type: integer
        segment:
          $ref: '#/components/schemas/Segment'
          description: Changes the input asset image based on the find and replace prompts
        steps:
          description: The number of steps you want AI to take for the generation
          example: 20
          maximum: 30
          minimum: 10
          type: integer
        style:
          description: >-
            Query the list styles endpoint `GET /pub/v1/styles` to view all
            available styles.
          example: Bokeh
          type: string
        style_detail:
          $ref: '#/components/schemas/StyleDetail'
          description: >-
            Query the list styles endpoint `GET /pub/v1/styles` to view all
            available styles.
        true_touch:
          $ref: '#/components/schemas/TrueTouch'
          description: Enhances and upscales the input image passed in the asset_id
        video_anyone:
          $ref: '#/components/schemas/VideoAnyone'
          description: Convert image to video seamlessly.
      type: object
    EstimationSuccessResponse:
      properties:
        data:
          $ref: '#/components/schemas/Credits'
          type: object
        error:
          description: The error if the request was not successful
          type: object
      type: object
    Character:
      type: object
      properties:
        character_id:
          description: >-
            ID of the character. You can get the details of characters using
            `GET /pub/v1/characters` endpoint or else you can create one using
            `POST /pub/v1/characters`
          example: chr_01
          type: string
        weight:
          description: This parameter is deprecated, use just mode instead
          example: 0.6
          type: number
          minimum: 0.1
          maximum: 1
          deprecated: true
        enable_facelock:
          description: This parameter is deprecated, use just mode instead
          example: true
          type: boolean
          deprecated: true
        mode:
          description: |-
            The mode of the character. 
            - `flexible` - Ideal for stylized characters and image generations. 
            - `balanced` - Ideal for creating realistic images and more. 
            - `strong` - Character similarity is most important.
          example: balanced
          enum:
            - flexible
            - balanced
            - strong
          type: string
      required:
        - character_id
        - mode
    ControlNet:
      type: object
      properties:
        asset_id:
          description: >-
            Upload a reference image using the `POST /pub/v1/assets/upload`
            endpoint . Pass the asset id in the payload to use the asset as a
            reference image for controlnet.
          example: ast_01
          type: string
        control_mode:
          description: |
            The priority of the control net: 
            - `0` - The priority between control net and prompt is balanced. 
            - `1` - The prompt priority is higher than the control net. 
            - `2` - The control net priority is higher than the prompt.
          enum:
            - 0
            - 1
            - 2
          example: 0
          type: integer
        name:
          description: >-
            Query the list resources endpoint `GET /pub/v1/controlnets`  to view
            all available controlnets. Make sure your Controlnet has the same
            base model (SD 1.5/SDXL) as your selected style/model.
          example: Normal
          type: string
        resize_mode:
          description: |-
            The relation between the control net image and generated image: 
            - `0` - Resize and Fill. 
            - `1` - Crop and Resize. 
            - `2` - Just Resize.
          enum:
            - 0
            - 1
            - 2
          example: 0
          type: integer
      required:
        - asset_id
        - control_mode
        - name
        - resize_mode
    Facelock:
      type: object
      properties:
        asset_id:
          description: >-
            Upload a reference image of a person using the `POST
            /pub/v1/assets/upload` endpoint. Pass the asset id in the payload to
            create AI characters with the same face as the reference image.
          example: ast_01
          type: string
      required:
        - asset_id
    Lora:
      type: object
      properties:
        name:
          description: The name of the lora
          example: lora_name
          type: string
        weight:
          description: >-
            Specify the strength of the LoRA being applied. Higher values will
            influence the generation more.
          example: 0.5
          maximum: 1
          minimum: 0.1
          type: number
      required:
        - name
        - weight
    Narrator:
      type: object
      properties:
        image_asset_id:
          description: >-
            ID of an image asset for FaceSwap feature. Upload an image asset
            with a face clearly visible, preferably looking forward. You can get
            the details of available image assets using `GET
            /pub/v2/assets?type=image` endpoint or else you can upload one using
            `POST /pub/v2/assets/upload`.
          example: ast_imgxxxxx
          type: string
        video_asset_id:
          description: >-
            ID of a video asset. Uploaded video asset should have only one
            person with a clear view of their face. You can get the details of
            available video assets using `GET /pub/v2/assets?type=video`
            endpoint or else you can upload one using `POST
            /pub/v2/assets/upload?type=video`.
          example: ast_vidxxxxx
          type: string
        audio_asset_id:
          description: >-
            ID of an audio asset. You can get the details of available audio
            assets using `GET /pub/v2/assets?type=audio` endpoint or else you
            can upload one using `POST /pub/v2/assets/upload?type=audio`.
          example: ast_audxxxxx
          type: string
        script:
          description: Describe/share the script you want to hear in the video narration.
          example: Thank you for trying Narrator
          type: string
        voice:
          description: >-
            Query the list resources endpoint `GET /pub/v1/voices` to view all
            available voices, and use any one from it for narrator generation.
          example: Rachel
          type: string
      required:
        - video_asset_id
    Prompt:
      type: object
      properties:
        negative:
          description: The negative prompt
          example: >-
            nsfw, deformed, extra limbs, bad anatomy, deformed pupils, text,
            worst quality, jpeg artifacts, ugly, duplicate, morbid, mutilated
          type: string
        positive:
          description: >-
            The positive prompt. If you are submitting a character for
            generation then make sure to pass the character's name in curly
            braces here. For ex. {Alex} on a trek
          example: a man looking into the camera
          type: string
      required:
        - negative
        - positive
    Segment:
      type: object
      properties:
        asset_id:
          description: >-
            Upload an image using the upload asset endpoint `POST
            /pub/v1/assets/upload`
          example: ast_01
          type: string
        find:
          description: >-
            Describe an element in the image that you want to change. Specify
            only 1 element at a time (eg: black tshirt, red car, hair, etc).
          example: red shirt
          type: string
        replace:
          description: >-
            Describe the element you want to see in the image instead (eg: a
            yellow tshirt, a white car, pink hair, etc).
          example: blue shirt
          type: string
      required:
        - asset_id
        - find
        - replace
    StyleDetail:
      properties:
        name:
          description: The name of the style
          example: Black & White
          type: string
        base_model:
          description: The base model of the style
          type: string
          example: flux
    TrueTouch:
      type: object
      properties:
        asset_id:
          description: >-
            Upload an image using the upload asset endpoint `POST
            /pub/v1/assets/upload`
          example: ast_01
          type: string
        enhance_strength:
          description: >-
            Specify the level of realistic enhancement you want to apply to your
            image.
          example: 0.5
          type: number
        scale_factor:
          description: Specify how much you want to upscale the your image by.
          enum:
            - '1'
            - '1.5'
            - '2'
            - '2.5'
            - '3'
          example: 1.5
          type: number
      required:
        - asset_id
        - enhance_strength
        - scale_factor
    VideoAnyone:
      type: object
      properties:
        media_id:
          description: >-
            This can be either generated image's media_id or an uploaded image
            asset's asset_id that you want to convert to video. (Supported
            Aspect Ratio: `3:5` or `5:3`)
          example: ast_01
          type: string
        prompt:
          description: >-
            A simple prompt to be described that what subject wants to be done
            in the video. (The video prompt is not mandatory input for
            generating video. You can choose to skip it, and we will create a
            video based on the source image)
          example: Camera static, a woman riding a bicycle
          type: string
        duration:
          description: Duration of the output video in seconds
          enum:
            - 5
            - 10
          example: 5
          type: number
          default: 5
      required:
        - media_id
    Credits:
      properties:
        estimated:
          description: The estimated number of credits for the generation
          example: 5
          type: integer
        balance:
          description: The remaining number of credits
          example: 20
          type: integer
      type: object

````