AI Art
Get your marvelous image from a text prompt or using our style
Generate
To make your first request, send a request to the image endpoint. This will create an image process by Stable Diffusion from your photo.
version 2
POST
https://api-img-gen-wrapper.apero.vn/api/v2/image-ai
No support anymore
version 3.1
POST
https://api-img-gen-wrapper.apero.vn/api/v3/image-ai
No support anymore
version 3.2
POST
https://api-img-gen-wrapper.apero.vn/api/v3.1/image-ai
No support anymore
version 4
POST
https://api-img-gen-wrapper.apero.vn/api/v4/image-ai
Headers
Name | Type | Description |
---|---|---|
X-Api-Signature* | String | see API Signature for more detail |
X-Api-Timestamp* | String | see API Signature for more detail |
X-Api-KeyId* | String | see API Signature for more detail |
X-Api-BundleId* | String | see Enhanced security for more detail |
App-name* | String | We will provide the app name for your application when you send us your request |
X-Api-Token* | String | see Enhanced securityfor more detail |
Request Body
Name | Type | Description |
---|---|---|
file | File | PNG, JPG, JEPG accepted File data you want to process, if the field not exists, your type of request is text-to-image. |
style | String | Style name in list style. If this field is empty, no lora model will be used. |
styleId | String | Apply for project using Style CMS to manage style config. Use to get the configuration of the style in each project in Style CMS |
positivePrompt | String | Max length: 2000 A positive prompt when describing an object would encourage highlighting its positive attributes, such as its appealing features, functionality, or aesthetic qualities. If null, model will use the default value of the style. Be noted that the default value of each style have the trigger keyword for style, if you override this field without keeping the trigger keyword, the style quality will be worse. |
negativePrompt | String | Max length: 2000 A negative prompt when describing an object would encourage highlighting its negative aspects, such as flaws, limitations, or drawbacks. If null, model will use the default value of the style |
alpha | Float | Only apply when use style. Min: 0 Max 1 The alpha refers to the stability parameter, which influences the rate of diffusion in a system, the higher it is, the more affected by the style in the output |
strength | Float | Only apply for image-to-image Min: 0 Max:1 How much influence the file has on the diffusion process. Values close to 1 will yield images very similar to the file while values close to 0 will yield images wildly different than the file.guidanceScale If null, model will use the default value of the style |
guidanceScale | Integer | Min: 1 Max: 10 Guidance scale is a parameter that controls how much the image generation process follows the text prompt. The higher the value, the more image sticks to a given text input. If null, model will use the default value of the style |
numInferenceSteps | Integer | Min: 10 Max: 30 Inference step is a parameter that controls how many steps will be taken during the process of rendering new images from a given input. Based on different schedulers, the number of inference steps required to produce high-quality output might differ If null, model will use the default value of the style |
prompt | String | What will be added to the positive_prompt of the model. If user want to add prompt when using style, user need to input in this field since positive prompt always have default value that's used to trigger style |
width | Integer | Only apply for text-to-image Min: 128 Max: 1024 Value is multiple of 8 (px) |
height | Integer | Only apply for text-to-image Min: 128 Max: 1024 Value is multiple of 8 (px) |
seed | Integer | Min: 1 Will random if omit |
acceptNSFW | Boolean | Default: false If true, service will be allowed to generate 18+ image |
aiFamily | String | Default: sd-1.5 Model AI using Accept 2 values: |
mode | Integer | Default: 0 The mode of AI using. Accept 2 values: If 0 means using AI-Art, 1 means using AI Fashion mode, 2 means Super Art |
fixOpenpose | Boolean | Default: true Keep the person's shape unchanged |
baseModel | String | Default: origin Accept 2 values: origin, lcm If origin means LDM mode, lcm means LCM mode |
Usually:
As a simple request, you just need use two params is
file
andstyleId
Sizes of
width
andheight
cannot exceed 1024 pixels and it's only work withtext-to-image
mode
Good to know about ratio:
Image > 512kb: (w,h) => thumbnail(768,768) => new_image(w', h') => output Note: Thumbnail resizes the size of images to the largest size that: - Preserves the aspect ratio.
- Does not exceed the original image. - Does not exceed the size specified in the arguments of thumbnail. For example: - Input images(60x125) => upscale(120x250) => thumbnail(368,768) => output images is 368x768. So, image too small requires to upscale, the largest size of original images 250px, is resized to 768px. The remaining size is resized to 768 * (120/250) = 368px - Input images(1024x2346) => thumbnail(336x768) => output(336x768). So image does not require upscale. The largest size of original images is 2346 is resized to 768. The remaining size is resized to 768 * (1024/2345) = 336
Good to know:
We have some fine-tuned styles available, only for field
style
:
Important
Image < 512kb (kilobytes): Upscale(w, h) => (2*w, 2*h) => thumbnail(768,768) => new_image(w', h')
API v4 need to apply API Signature and Enhanced security when send API request.
Take a look at how you might call this method using our official libraries, or via curl
:
Last updated