Generate Stunning Visuals with New Reality XL Pro Cognitive Actions

22 Apr 2025
Generate Stunning Visuals with New Reality XL Pro Cognitive Actions

In the evolving landscape of artificial intelligence, the "aisha-ai-official/new-reality-xl-pro" API offers developers a powerful tool for image generation. This API provides a robust set of Cognitive Actions, specifically designed to generate high-quality images based on customizable parameters. By leveraging these pre-built actions, developers can create rich visual content tailored to their specific needs, enhancing user engagement in their applications.

Prerequisites

Before diving into the integration of Cognitive Actions, ensure you have the following prerequisites in place:

  • An API key for accessing the Cognitive Actions platform is required for authentication. Typically, this is done by passing the API key in the request headers.
  • Familiarity with JSON payload structures will be beneficial for crafting requests to the API.

Cognitive Actions Overview

Generate Image with New Reality XL Pro

Purpose:
This action enables developers to generate high-quality images using the New Reality XL Pro model. It allows for a variety of customizable parameters, such as image dimensions, generation steps, and more, giving developers control over the output.

Category: Image Generation

Input:

The input schema for this action is as follows:

{
  "seed": -1,
  "model": "New-Reality-XL-Pro",
  "steps": 30,
  "width": 1024,
  "height": 1024,
  "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
  "pagScale": 0,
  "batchSize": 1,
  "scheduler": "Euler a",
  "configScale": 4,
  "clipLayerSkip": 1,
  "negativePrompt": "nsfw, naked",
  "guidanceRescale": 1,
  "prependPreprompt": true,
  "variationalAutoEncoder": "default"
}
  • Required Fields:
    • model: The model to be used, which defaults to "New-Reality-XL-Pro".
    • prompt: The description guiding the image generation.
  • Optional Fields:
    • seed: Used for random generation; set to -1 for randomness.
    • steps: Defines how many steps to generate the image (1 to 100).
    • width: The width of the generated image in pixels (1 to 4096).
    • height: The height of the generated image in pixels (1 to 4096).
    • pagScale: Affects the quality of the generated images.
    • batchSize: Number of images to generate in one call (1 to 4).
    • scheduler: Selects the algorithm used for generation.
    • configScale, guidanceRescale, clipLayerSkip, negativePrompt, and prependPreprompt allow further customization.

Output:

The action typically returns a URL of the generated image. Here’s an example of a successful output:

[
  "https://assets.cognitiveactions.com/invocations/3b4191ad-249c-4fa1-9b31-00e808bc0c80/5e6efe2b-9ec4-4b3f-a519-9ffaf147b8a0.png"
]

Conceptual Usage Example (Python): Below is a conceptual Python code snippet that illustrates how a developer might invoke this action:

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 = "df7f65c6-5f99-4835-88cd-82cabdbf0926"  # Action ID for Generate Image with New Reality XL Pro

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "model": "New-Reality-XL-Pro",
    "steps": 30,
    "width": 1024,
    "height": 1024,
    "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
    "pagScale": 0,
    "batchSize": 1,
    "scheduler": "Euler a",
    "configScale": 4,
    "clipLayerSkip": 1,
    "negativePrompt": "nsfw, naked",
    "guidanceRescale": 1,
    "prependPreprompt": True,
    "variationalAutoEncoder": "default"
}

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}
    )
    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 snippet, the action_id corresponds to the "Generate Image with New Reality XL Pro" action, and the payload is structured according to the action's requirements. The example demonstrates how to set the headers and handle the response from the API.

Conclusion

The "aisha-ai-official/new-reality-xl-pro" Cognitive Actions provide developers with an exciting opportunity to generate stunning visuals through highly customizable image generation. By integrating these actions into your applications, you can enhance user experiences with tailored visual content. Consider experimenting with various parameters to unlock the full potential of this powerful API!