├── input.png ├── resources ├── tileset.png ├── wordmark.png ├── single_tile.png └── walk_idle_format.png ├── img2img.py └── README.md /input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Retro-Diffusion/api-examples/HEAD/input.png -------------------------------------------------------------------------------- /resources/tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Retro-Diffusion/api-examples/HEAD/resources/tileset.png -------------------------------------------------------------------------------- /resources/wordmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Retro-Diffusion/api-examples/HEAD/resources/wordmark.png -------------------------------------------------------------------------------- /resources/single_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Retro-Diffusion/api-examples/HEAD/resources/single_tile.png -------------------------------------------------------------------------------- /resources/walk_idle_format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Retro-Diffusion/api-examples/HEAD/resources/walk_idle_format.png -------------------------------------------------------------------------------- /img2img.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import base64 3 | 4 | from PIL import Image 5 | from io import BytesIO 6 | 7 | 8 | def generate_image_with_input_image( 9 | api_key: str, 10 | input_image_path: str, 11 | output_image_path: str, 12 | prompt: str, 13 | style: str = "default", 14 | width: int = 256, 15 | height: int = 256, 16 | strength: float = 0.5, 17 | seed: int = 0 18 | ): 19 | # 1. Convert local image to Base64 and convert to RGB 20 | with Image.open(input_image_path) as img: 21 | rgb_img = img.convert('RGB') 22 | buffer = BytesIO() 23 | rgb_img.save(buffer, format='PNG') 24 | base64_input_image = base64.b64encode(buffer.getvalue()).decode('utf-8') 25 | 26 | # 2. Prepare the request 27 | url = "https://api.retrodiffusion.ai/v1/inferences" 28 | method = "POST" 29 | headers = { 30 | "X-RD-Token": api_key, 31 | } 32 | 33 | payload = { 34 | "prompt": prompt, 35 | "prompt_style": style, 36 | "model": model, 37 | "width": width, 38 | "height": height, 39 | "input_image": base64_input_image, 40 | "strength": strength, 41 | "num_images": 1, 42 | "seed": seed 43 | } 44 | 45 | # 3. Send the request 46 | response = requests.request(method, url, headers=headers, json=payload) 47 | 48 | # 4. Handle response 49 | if response.status_code == 200: 50 | data = response.json() 51 | # data['base64_images'] is a list of base64-encoded image strings 52 | base64_images = data.get("base64_images", []) 53 | if base64_images: 54 | # Take the first image 55 | img_data = base64_images[0] 56 | # Decode and save 57 | with open(output_image_path, "wb") as out_file: 58 | out_file.write(base64.b64decode(img_data)) 59 | print(f"Image generated and saved to {output_image_path}") 60 | else: 61 | print("No images returned by the API.") 62 | else: 63 | print(f"Request failed with status code {response.status_code}: {response.text}") 64 | 65 | 66 | if __name__ == "__main__": 67 | # Example usage 68 | YOUR_API_KEY = "rdpk-xxxxxxxxxxxx" # Replace with your actual API key 69 | INPUT_IMAGE_PATH = "input.png" # Replace with your local input image path 70 | OUTPUT_IMAGE_PATH = "generated_image.png" # Where you want to save the result 71 | 72 | generate_image_with_input_image( 73 | api_key=YOUR_API_KEY, 74 | input_image_path=INPUT_IMAGE_PATH, 75 | output_image_path=OUTPUT_IMAGE_PATH, 76 | prompt="an orange sports car", 77 | width=256, 78 | height=256, 79 | strength=0.75, 80 | seed = 1 81 | ) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | > **ℹ️ Info:** 6 | > We just migrated to a new server infrastructure! 7 | > All current workflows should continue to work with the existing endpoint and no changes are needed from you. 8 | > If you experience any issues, you can temporarily use our legacy endpoint at `https://api.retrodiffusion.ai/v1/inferences/legacy`. 9 | 10 | 11 | ## How to generate images 12 | 13 | 1. First you need to generate an API Key directly from your [RetroDiffusion account](https://www.retrodiffusion.ai/app/devtools) 14 | 2. Make sure you have available credits in your account 15 | Take in mind that each model supports different styles. 16 | 3. Prepare your request, in this example we will use Python and make simple request to generate one image with RD_FAST model and no styles: 17 | 18 | ```python 19 | import requests 20 | 21 | url = "https://api.retrodiffusion.ai/v1/inferences" 22 | method = "POST" 23 | 24 | headers = { 25 | "X-RD-Token": "YOUR_API_KEY", 26 | } 27 | 28 | payload = { 29 | "width": 256, 30 | "height": 256, 31 | "prompt": "A really cool corgi", 32 | "num_images": 1 33 | } 34 | 35 | response = requests.request(method, url, headers=headers, json=payload) 36 | print(response.text) 37 | ``` 38 | 39 | 5. The response should look like this: 40 | 41 | ```json 42 | { 43 | "created_at": 1733425519, 44 | "credit_cost": 1, 45 | "base64_images": ["..."], 46 | "type": "txt2img", 47 | "remaining_credits": 999 48 | } 49 | ``` 50 | 51 | ## Check credit cost before generating 52 | 53 | You can check how much a request will cost before actually generating images by adding the `check_cost` parameter set to `true`: 54 | 55 | ```python 56 | import requests 57 | 58 | url = "https://api.retrodiffusion.ai/v1/inferences" 59 | method = "POST" 60 | 61 | headers = { 62 | "X-RD-Token": "YOUR_API_KEY", 63 | } 64 | 65 | payload = { 66 | "width": 256, 67 | "height": 256, 68 | "prompt": "A really cool corgi", 69 | "num_images": 1, 70 | "check_cost": true 71 | } 72 | 73 | response = requests.request(method, url, headers=headers, json=payload) 74 | print(response.text) 75 | ``` 76 | 77 | The response will show the credit cost without generating any images: 78 | 79 | ```json 80 | { 81 | "created_at": 1761299395, 82 | "credit_cost": 1, 83 | "output_images": [], 84 | "base64_images": [], 85 | "output_urls": [], 86 | "model": "check_cost", 87 | "remaining_credits": 0 88 | } 89 | ``` 90 | 91 | Note: When using `check_cost`, the `remaining_credits` will always be `0` and no images will be generated. 92 | 93 | ## Using styles 94 | 95 | ### RD_PRO 96 | - `RD_PRO` is our newest and most advanced model, it supports several styles, and it's passed as a parameter named `prompt_style`. 97 | 98 | #### Available styles: 99 | - rd_pro__default `Clean modern pixel art style model that allows multiple reference images and extremely detailed prompting.` 100 | - rd_pro__painterly `Almost brush-like style with minimal outlines or anti-aliasing. Clean vibrant color palettes and beautiful details` 101 | - rd_pro__fantasy `Bright colors, soft transitions, detailed textures, light dithering, and outlines.` 102 | - rd_pro__horror `Dark, gritty style with chaotic details and harsh shapes and shading.` 103 | - rd_pro__scifi `High contrast with glowing details, clean outlines, and beautiful lighting.` 104 | - rd_pro__simple `Simple pixel art with minimal shading or texturing, but strong outlines and shapes.` 105 | - rd_pro__isometric `Pixel art rotated at a 45 degree angle. Clean lines and shapes.` 106 | - rd_pro__topdown `Pixel art viewed from a 2/3 downwards angle, with simple shapes and shading.` 107 | - rd_pro__platformer `Side-scroller style platformer perspective, with modern styling and outlines.` 108 | - rd_pro__dungeon_map `Dungeon-crawler style game levels with connected rooms filled with objects and enemies.` 109 | - rd_pro__spritesheet `Collections of assets on a simple background with the same style.` 110 | - rd_pro__pixelate `Convert input images into pixel art.` 111 | 112 | #### Using reference images with RD_PRO 113 | - You can use up to 9 reference images with RD_PRO by passing base64 encoded images in the `reference_images` parameter. 114 | 115 | ```json 116 | { 117 | "width": 256, 118 | "height": 256, 119 | "prompt": "corgi", 120 | "num_images": 1, 121 | "prompt_style": "rd_pro__default", 122 | "check_cost": false, 123 | "reference_images": [ 124 | "iVBORw0KGgoAAA..." 125 | ] 126 | } 127 | ``` 128 | 129 | ### RD_FAST 130 | 131 | - `RD_FAST` only support one style at a time, and it's passed as a parameter named `prompt_style`: 132 | 133 | ```python 134 | payload = { 135 | "width": 256, 136 | "height": 256, 137 | "prompt": "A really cool corgi wearing sunglasses and a party hat", 138 | "num_images": 1, 139 | "prompt_style": "rd_fast__simple" 140 | } 141 | ``` 142 | 143 | **Default size range is 64x64 <-> 384x384 unless otherwise specified.** 144 | #### Available styles: 145 | 146 | - rd_fast__default `Simple clean pixel art, with Anime illustration influences` 147 | - rd_fast__retro `A classic arcade game aesthetic inspired by early PC games` 148 | - rd_fast__simple `Simple shading with minimalist shapes and designs` 149 | - rd_fast__detailed `Pixel art with lots of shading and details` 150 | - rd_fast__anime `Simple clean pixel art, with Anime illustration influences` 151 | - rd_fast__game_asset `Distinct assets set on a simple background` 152 | - rd_fast__portrait `Character portrait focused images with high detail` 153 | - rd_fast__texture `Flat game textures like stones, bricks, or wood` 154 | - rd_fast__ui `User interface boxes and buttons` 155 | - rd_fast__item_sheet `Sheets of objects placed on a simple background` 156 | - rd_fast__character_turnaround `Character sprites viewed from different angles` 157 | - rd_fast__1_bit `Two color black and white only images` 158 | - rd_fast__low_res `(16x16 <-> 128x128) General low resolution pixel art images` 159 | - rd_fast__mc_item `(16x16 <-> 128x128) Minecraft-styled items with automatic transparency` 160 | - rd_fast__mc_texture `(16x16 <-> 128x128) Minecraft-styled flat textures, like grass, stones, or wood` 161 | - rd_fast__no_style `Pixel art with no style influence applied` 162 | 163 | ### RD_PLUS 164 | - `RD_PLUS` supports several styles, and it's passed as a parameter named `prompt_style`: 165 | - `RD_PLUS` is more expensive than `RD_FAST`, please confirm the cost in our [web app](https://www.retrodiffusion.ai) selecting the model and style and settings you want to use. 166 | 167 | #### Available styles: 168 | - rd_plus__default `Clean pixel art style with bold colors and outlines` 169 | - rd_plus__retro `Classic pixel art style inspired by PC98 games` 170 | - rd_plus__watercolor `Pixel art mixed with a watercolor painting aesthetic` 171 | - rd_plus__textured `Semi-realistic pixel art style with lots of shading and texture` 172 | - rd_plus__cartoon `Simple shapes and shading, with bold outlines` 173 | - rd_plus__ui_element `User interface boxes and buttons` 174 | - rd_plus__item_sheet `Sheets of objects placed on a simple background` 175 | - rd_plus__character_turnaround `Character sprites viewed from different angles` 176 | - rd_plus__environment `One-point perspective scenes with outlines and strong shapes` 177 | - rd_plus__topdown_map `Video game map style pixel art with a 3/4 top down perspective` 178 | - rd_plus__topdown_asset `3/4 top down perspective game assets on a simple background` 179 | - rd_plus__isometric `45 degree isometric perspective, with consistent outlines` 180 | - rd_plus__isometric_asset `45 degree isometric objects or assets, on a neutral background` 181 | - rd_plus__classic `(32x32 <-> 192x192) Strongly outlined medium-resolution pixel art with a focus on simple shading and clear design` 182 | - rd_plus__low_res `(16x16 <-> 128x128) High quality, low resolution pixel art assets and backgrounds` 183 | - rd_plus__mc_item `(16x16 <-> 128x128) High quality Minecraft-styled items and game assets` 184 | - rd_plus__mc_texture `(16x16 <-> 128x128) Detailed Minecraft-style flat block textures, with enhanced prompt following` 185 | - rd_plus__topdown_item `(16x16 <-> 128x128) Top-down view of items and objects, with a simple background` 186 | - rd_plus__skill_icon `(16x16 <-> 128x128) Icons for skills, abilities, or spells` 187 | 188 | ## Animations 189 | 190 | We support the following animation styles: 191 | - animation__any_animation `(64x64 only) Describe an animation and bring pixel art to life` 192 | - animation__8_dir_rotation `(80x80 only) Create 8 direction rotations of anything` 193 | - animation__four_angle_walking `(48x48 only) Consistent 4 direction, 4 frame long walking animations of humanoid characters` 194 | - animation__walking_and_idle `(48x48 only) Consistent 4 direction walking and idle animations of humanoid characters` 195 | - animation__small_sprites `(32x32 only) Consistent 4 direction walking, arm movement, looking, surprised, and laying down animations` 196 | - animation__vfx `(24x24 <-> 96x96, 1:1 aspect ratio) Eye-catching animations for fire, explosions, lightning, or other simple effects` 197 | - animation__any_animation `(64x64 only) General purpose custom animation sheets with optional first frame input` 198 | 199 | Some important notes: 200 | 201 | - `animation__four_angle_walking` and `animation__walking_and_idle` currently only support 48x48 resolution. (Bigger or smaller resolutions will be ignored and default to 48x48) 202 | - `animation__small_sprites` only supports 32x32 resolution. 203 | - `animation__vfx` supports sizes between 24x24 and 96x96, square aspect ratios only. 204 | - Animations only support generating one image at a time. 205 | - Outputs are transparent GIF images encoded in base64. 206 | bypass_prompt_expansion 207 | Example payload: 208 | 209 | > This payload will generate a 48x48 transparent GIF, if you want the spritesheet, look below 210 | 211 | ```python 212 | { 213 | "prompt": "corgi wearing a party hat", 214 | "width": 48, 215 | "height": 48, 216 | "num_images": 1, 217 | "seed": 123, 218 | "prompt_style": "animation__four_angle_walking" 219 | } 220 | ``` 221 | 222 | Spritesheet output payload: 223 | 224 | > Just add the **return_spritesheet** property set to `true`, this will output a transparent PNG with the spritesheet 225 | 226 | ```python 227 | { 228 | "prompt": "corgi wearing a party hat", 229 | "width": 48, 230 | "height": 48, 231 | "num_images": 1, 232 | "seed": 123, 233 | "prompt_style": "animation__four_angle_walking", 234 | "return_spritesheet": true 235 | } 236 | ``` 237 | 238 | ### Walking and Idle format 239 | 240 | The walking and idle animation format is similar to the four angle walking format, but has some changes. Below is an example: 241 | 242 | Idle_example 243 | 244 | ### Small sprites format 245 | 246 | The small sprites animation sheets are broken down like the example below: 247 | 248 | Small_example 249 | 250 | ### Image reference for animations 251 | 252 | You can use the parameter `input_image` in your payload to let the model know what image to use as a reference. 253 | The `input_image` should be a base64 encoded RGB image with no transparency. 254 | In your prompt you can include a brief description of your reference image. 255 | 256 | **Don't** include the `data:image/png;base64,` in the base64 image. 257 | 258 | ```python 259 | { 260 | "prompt": "robot", 261 | "width": 48, 262 | "height": 48, 263 | "num_images": 1, 264 | "seed": 1234, 265 | "prompt_style": "animation__four_angle_walking", 266 | "return_spritesheet": true, 267 | "input_image": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ..." 268 | } 269 | ``` 270 | 271 | ### Tips for using any_animation 272 | 273 | Due to `animation__any_animation`'s open-ended nature, its a good idea to include a detailed prompt about the content and action in the sequence. 274 | It can also be used for more general sprite sheet objectives, like creating variations of character portraits, sprite sheets of items, and many more creative uses. 275 | 276 | Use a 64x64 input image to get near perfect subject adherence. 277 | 278 | ## Tilesets 279 | 280 | 281 | ### All tileset styles 282 | - rd_tile__tileset `(16x16 <-> 32x32) Create full tilesets from a simple prompt describing the textures or environment, using a simple set of "wang" style combinations` 283 | - rd_tile__tileset_advanced `(16x16 <-> 32x32) Full tilesets from two prompts and/or textures, using a simple set of "wang" style combinations` 284 | - rd_tile__single_tile `(16x16 <-> 64x64) Detailed single tile texture for creating full tilesets or surfaces` 285 | - rd_tile__tile_variation `(16x16 <-> 128x128) Texture variations of the provided tile image` 286 | - rd_tile__tile_object `(16x16 <-> 96x96) Small assets for placing on sections of tiles` 287 | - rd_tile__scene_object `(64x64 <-> 384x384) Large assets for placing on tileset maps` 288 | 289 | ### Full tilesets 290 | - You can generate full tilesets using the following styles: 291 | - rd_tile__tileset 292 | - rd_tile__tileset_advanced 293 | 294 | - `rd_tile__tileset` supports an inspiration image via the `input_image` parameter 295 | - `rd_tile__tileset_advanced` supports inside and outside textures via the `input_image` and `extra_input_image` parameters. Advanced tilesets require the inside texture description in the `prompt` parameter and the outside texture description in the `extra_prompt` parameter. 296 | - The `width` and `height` parameters specify the size of each tile in the tileset. Values can range between 16 and 32. 297 | 298 | Advanced tileset example payload: 299 | 300 | ```python 301 | { 302 | "width": 32, 303 | "height": 32, 304 | "prompt": "grey stones with gravel and dirt", 305 | "extra_prompt": "lush green grass", 306 | "num_images": 1, 307 | "prompt_style": "rd_tile__tileset_advanced", 308 | "seed": 123, 309 | "input_image": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ...", 310 | "extra_input_image": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ..." 311 | } 312 | ``` 313 | ### Tileset format: 314 | 315 | 316 | ### Single tiles 317 | 318 | 319 | - You can generate single tiles using the `rd_tile__single_tile` style. 320 | - The `width` and `height` parameters specify the size of the tile and can range between 16 and 64. 321 | 322 | Example: 323 | 324 | ```python 325 | { 326 | "width": 32, 327 | "height": 32, 328 | "prompt": "volcanic rock with cracks", 329 | "num_images": 1, 330 | "prompt_style": "rd_tile__single_tile" 331 | } 332 | ``` 333 | 334 | ### Tile variation 335 | - You can generate variations of a tile using the `rd_tile__tile_variation` style. 336 | - The `input_image` parameter is **required** and should be a base64 encoded image of the tile you want to create variations from. 337 | - Use the `prompt` parameter to describe the changes you want to see in the variations. 338 | 339 | Example: 340 | 341 | ```python 342 | { 343 | "width": 32, 344 | "height": 32, 345 | "prompt": "add moss and cracks", 346 | "num_images": 1, 347 | "prompt_style": "rd_tile__tile_variation", 348 | "input_image": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ..." 349 | } 350 | ``` 351 | 352 | ## Using img2img 353 | 354 | - Just send a **base64** image in the `input_image` parameter and adjust `strength` to your likinng. Strength is a value between 0 and 1 and represents how much the image should be modified. 355 | - No need to include `data:image/png;base64,` in the base64 image. 356 | - Send your image as a base64 string, it should be a RGB image with no transparency. 357 | 358 | ```python 359 | with Image.open(input_image_path) as img: 360 | rgb_img = img.convert('RGB') 361 | buffer = BytesIO() 362 | rgb_img.save(buffer, format='PNG') 363 | base64_input_image = base64.b64encode(buffer.getvalue()).decode('utf-8') 364 | 365 | payload = { 366 | "prompt": "A really cool corgi wearing sunglasses and a party hat", 367 | "width": 256, 368 | "height": 256, 369 | "input_image": base64_input_image, 370 | "strength": 0.8 371 | } 372 | ``` 373 | 374 | ## Using a palette for reference 375 | 376 | - You can use the `input_palette` parameter to let the model know what palette to use as a reference. 377 | - Just send a **base64** image in the `input_palette` parameter. 378 | - The `input_palette` should be a base64 encoded image with no transparency. 379 | - Keep your palette image small, below 1mb is recommended 200k characters or less. 380 | - No need to include `data:image/png;base64,` in the base64 image. 381 | 382 | ```python 383 | { 384 | "prompt": "a raven with a glowing green eye", 385 | "width": 256, 386 | "height": 256, 387 | "num_images": 1, 388 | "seed": 1234, 389 | "input_palette": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ..." 390 | } 391 | ``` 392 | 393 | - Optionally, you can also receive the original image before palette is applied by setting `return_pre_palette` to `true`: 394 | 395 | ```python 396 | { 397 | "prompt": "a raven with a glowing green eye", 398 | "width": 256, 399 | "height": 256, 400 | "num_images": 1, 401 | "seed": 1234, 402 | "input_palette": "iVBORw0KGgoAAAANSUhEUgAAAUA... ... ...", 403 | "return_pre_palette": true 404 | } 405 | ``` 406 | 407 | When `return_pre_palette` is enabled, the response will include an additional string in the `base64_images` array, which is the original image before the palette is applied. 408 | 409 | ## Using background removal for transparent images 410 | 411 | - Simply `remove_bg` as a boolean 412 | 413 | ```python 414 | payload = { 415 | "prompt": "a raven with a glowing green eye", 416 | "width": 128, 417 | "height": 128, 418 | "remove_bg": True 419 | } 420 | ``` 421 | 422 | - Optionally, you can also receive the original image before background removal by setting `return_non_bg_removed` to `true`: 423 | 424 | ```python 425 | payload = { 426 | "prompt": "a raven with a glowing green eye", 427 | "width": 128, 428 | "height": 128, 429 | "remove_bg": True, 430 | "return_non_bg_removed": True 431 | } 432 | ``` 433 | 434 | When `return_non_bg_removed` is enabled, the response will include an additional string in the `base64_images` array, which is the original image before background removal. 435 | 436 | ## Using seamless tiling 437 | 438 | - Simply add `tile_x` and `tile_y` both as booleans 439 | 440 | ```python 441 | payload = { 442 | "prompt": "Stone bricks", 443 | "width": 128, 444 | "height": 128, 445 | "tile_x": true, 446 | "tile_y": true 447 | } 448 | ``` 449 | 450 | ## Ignoring prompt expansion 451 | - You can use the `bypass_prompt_expansion` parameter to disable prompt expansion for your request. 452 | ```python 453 | payload = { 454 | "prompt": "a raven with a glowing green eye", 455 | "width": 128, 456 | "height": 128, 457 | "bypass_prompt_expansion": True 458 | } 459 | ``` 460 | 461 | ## Image editing 462 | ![Progressive editing](https://github.com/user-attachments/assets/c787cd05-b464-4a66-a3e8-423aadf1ee1f) 463 | 464 | - You can use the `https://api.retrodiffusion.ai/v1/edit` endpoint to edit images. 465 | - The request should be a POST request with the following parameters: 466 | 467 | ```json 468 | { 469 | "prompt": "add a hat", 470 | "inputImageBase64": "iVBORw0KGgoAAAANSUhEUgAAAUA...", 471 | } 472 | ``` 473 | 474 | - We support sizes between 16x16 and 256x256 475 | - You can send any image within the size limits to be edited 476 | - Progressive editing is possible by sending the response you get from one task as the input for a new task 477 | - The cost is 5 credits per image edit 478 | - We have the following response format: 479 | 480 | ```json 481 | { 482 | "outputImageBase64": "iVBORw0KGgoAAAANSUhEUgAAAUA...", 483 | "remaining_credits": 999 484 | } 485 | ``` 486 | 487 | ## FAQ 488 | 489 | - **How much does it cost?** 490 | - Cost is calculated based on the model and resolution you choose. You can check the cost of each request in our [web app](https://www.retrodiffusion.ai/) 491 | These formulas can be used as a guide for automated cost calculations: 492 | **Standard image model pricing** 493 | All costs are rounded to three decimal places. 494 | `rd_fast` styles: 495 | 496 | Balance cost = `max(0.015, ((width * height) + 100000) / 6000000) * number of images` 497 | 498 | `rd_plus` styles: 499 | 500 | Balance cost = `max(0.025, ((width * height) + 50000) / 2000000) * number of images` 501 | 502 | **Low resolution model pricing** 503 | `rd_plus__mc_texture`, `rd_plus__mc_item`, `rd_plus__low_res`, `rd_plus__classic`, `rd_plus__topdown_item`, `rd_plus__skill_icon`, `rd_tile__tile_variation`, `rd_tile__single_tile`, `rd_tile__tile_object`: 504 | 505 | Balance cost = `max(0.02, ((width * height) + 13700) / 600000) * number of images` 506 | 507 | `rd_pro` styles: 508 | 509 | Balance cost = `0.22 * number of images` 510 | 511 | **Editing class styles** 512 | `rd_pro__pixelate` 513 | 514 | Balance cost = `0.25 * number of images` 515 | 516 | **Unique model pricing:** 517 | `animation__four_angle_walking`, `animation__walking_and_idle`, `animation__small_sprites`, `animation__vfx`: 518 | 519 | Balance cost = `0.07` 520 | 521 | `rd_tile__tileset`, `rd_tile__tileset_advanced`: 522 | 523 | Balance cost = `0.10` 524 | 525 | `animation__any_animation`, `animation__8_dir_rotation`: 526 | 527 | Balance cost = `0.25` 528 | 529 | 530 | 531 | 532 | - **How can I check my remaining credits?** 533 | - You can make a GET request to the `https://api.retrodiffusion.ai/v1/inferences/credits` endpoint, with the header `X-RD-Token` set to your API key. The response will include the remaining credits in the following format: 534 | 535 | ```json 536 | { 537 | "credits": 999 538 | } 539 | ``` 540 | 541 | - **Can I buy credits from the API?** 542 | - No, but to ensure you always have enough credits for your requests, you can set up **auto refills** in the [Payment Methods section](https://www.retrodiffusion.ai/app/payment-methods) 543 | - **What happened to RD_CLASSIC?** 544 | - We just dropped support for RD_CLASSIC 545 | - **What happened to RD_FLUX?** 546 | - We just renamed RD_FLUX to RD_FAST, so you can use it as before. 547 | - **What happened to the model parameter** 548 | - `model` is no longer required, as the model is determined by the `prompt_style` parameter. 549 | - **How to get images at native resolution?** 550 | - You can use the `upscale_output_factor` parameter to get images at native resolution. Set it to 1 for native resolution, or `null` for regular size. 551 | --------------------------------------------------------------------------------