Create Stunning TMNT Style Images with Cognitive Actions for SDXL-TNMT

22 Apr 2025
Create Stunning TMNT Style Images with Cognitive Actions for SDXL-TNMT

The copilot-us/sdxl-tnmt API provides developers with powerful Cognitive Actions designed to generate captivating images styled after the beloved Teenage Mutant Ninja Turtles: Mutant Mayhem. Leveraging the SDXL-TNMT model, these actions incorporate advanced features like inpainting, prompt refinement, and safety measures to enhance the image generation experience. By using these pre-built actions, developers can save time and effort, allowing them to focus on building innovative applications while delivering high-quality visual content.

Prerequisites

To get started with the Cognitive Actions for the SDXL-TNMT API, you will need:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON and HTTP requests.

Authentication typically involves passing your API key in the request headers to ensure secure access to the API.

Cognitive Actions Overview

Generate TMNT Mutant Mayhem Style Images

Description: This action enables the creation of images styled after the Teenage Mutant Ninja Turtles: Mutant Mayhem using the SDXL-TNMT model. It is optimized for quality and control, offering features like inpainting, prompt refinement, and safety measures.

Category: Image Generation

Input

The input for this action follows the CompositeRequest schema, with the following fields:

  • mask (string, optional): URI for an input mask used in inpaint mode. Black areas are preserved, and white areas are inpainted.
  • seed (integer, optional): A random seed for image generation. If left blank, a random seed will be used.
  • image (string, optional): URI of the input image for img2img or inpaint mode.
  • width (integer, optional): The width of the output image in pixels (default: 1024).
  • height (integer, optional): The height of the output image in pixels (default: 1024).
  • prompt (string, required): A textual description or concept for generating the image.
  • refine (string, optional): The refinement style to use. Options include "no_refiner", "expert_ensemble_refiner", and "base_image_refiner" (default: "no_refiner").
  • loraScale (number, optional): Scale for LoRA additive adjustments (default: 0.6).
  • scheduler (string, optional): The scheduler used in the image generation process (default: "K_EULER").
  • loraWeights (string, optional): Specify the LoRA weights to use.
  • guidanceScale (number, optional): Adjusts the scale for classifier-free guidance during image generation (default: 7.5).
  • applyWatermark (boolean, optional): Indicates whether a watermark should be applied (default: true).
  • inferenceSteps (integer, optional): Number of steps for denoising during image generation (default: 50).
  • negativePrompt (string, optional): Concepts to avoid during image generation.
  • numberOfImages (integer, optional): Number of image outputs to generate (default: 1, max: 4).
  • promptStrength (number, optional): Influence of the prompt in img2img/inpaint mode (default: 0.8).
  • refinementSteps (integer, optional): Step count for refinement, applicable for 'base_image_refiner'.
  • highNoiseFraction (number, optional): Noise proportion to use during image generation for 'expert_ensemble_refiner' (default: 0.8).
  • disableSafetyChecker (boolean, optional): Option to disable the safety checker (default: false).

Example Input

{
  "width": 1024,
  "height": 1024,
  "prompt": "A big panda standing on two legs holding a katana in NY",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "inferenceSteps": 50,
  "negativePrompt": "",
  "numberOfImages": 1,
  "promptStrength": 0.8,
  "highNoiseFraction": 0.8
}

Output

The action typically returns a URL for the generated image, for example:

[
  "https://assets.cognitiveactions.com/invocations/e4720d86-0ca6-4410-8dee-027aeeae40e6/9cfbba4c-1ec6-4971-aebe-bd348c2d8225.png"
]

Conceptual Usage Example (Python)

Here’s how you might invoke the "Generate TMNT Mutant Mayhem Style Images" action using Python:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"  # Hypothetical endpoint

action_id = "ac85029c-6e18-48fb-b22d-083c3b4a9d36"  # Action ID for Generate TMNT Mutant Mayhem Style Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A big panda standing on two legs holding a katana in NY",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "inferenceSteps": 50,
    "negativePrompt": "",
    "numberOfImages": 1,
    "promptStrength": 0.8,
    "highNoiseFraction": 0.8
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this example, replace the YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and the JSON payload structure are provided as per the specifications.

Conclusion

The Cognitive Actions for the SDXL-TNMT API empower developers to create unique and stylized images effortlessly. With features like inpainting, customizable prompts, and various refinement options, you have the tools to enhance your applications with captivating visuals. Explore these actions further to unlock creative possibilities and elevate your projects to the next level!