Generate Stunning Images with CyberPrime-XL-v1 Cognitive Actions

23 Apr 2025
Generate Stunning Images with CyberPrime-XL-v1 Cognitive Actions

In today's digital landscape, the ability to generate high-quality images programmatically can significantly enhance the creative capabilities of your applications. The CyberPrime-XL-v1 from Aisha AI offers a robust set of Cognitive Actions that allow developers to leverage advanced image generation techniques. By using these pre-built actions, you can customize various parameters, ensuring that the generated images meet your specific needs while saving time on development.

Prerequisites

Before diving into the integration of CyberPrime-XL-v1 Cognitive Actions, ensure you have the following prerequisites:

  • API Key: You will need an API key to authenticate your requests to the Cognitive Actions platform.
  • HTTP Client: Familiarity with making HTTP requests is beneficial, as this guide will use Python's requests library to demonstrate usage.

Authentication is typically handled by including your API key in the request headers, allowing you to access the Cognitive Actions.

Cognitive Actions Overview

Generate Image Using CyberPrime-XL-v1

The Generate Image Using CyberPrime-XL-v1 action produces images based on a specified prompt and various customizable parameters. This action falls under the image-generation category and allows developers to fine-tune aspects like image size, generation steps, and the model used.

Input

The input for this action is structured as follows:

{
  "seed": -1,
  "model": "CyberPrime-XL-v1",
  "steps": 30,
  "width": 1024,
  "height": 1024,
  "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
  "cfgScale": 5,
  "pagScale": 0,
  "scheduler": "Euler a",
  "vaeFormat": "default",
  "clipLayerSkip": 1,
  "imageBatchSize": 1,
  "negativePrompt": "nsfw, naked",
  "prependInitialPrompt": true,
  "guidanceRescaleFactor": 1
}
  • seed (integer, default: -1): Determines the randomness of the generation.
  • model (string): Specifies the model to use; here, it is fixed to CyberPrime-XL-v1.
  • steps (integer, default: 30): The number of steps for image generation (1-100).
  • width (integer, default: 1024): Specifies the image width (1-4096).
  • height (integer, default: 1024): Specifies the image height (1-4096).
  • prompt (string): A text description of the desired image.
  • cfgScale (number, default: 5): Controls the attention to the prompt (1-50).
  • pagScale (number, default: 0): Enhances result quality (0-50).
  • scheduler (string): The scheduling algorithm for generation.
  • vaeFormat (string, default: "default"): Specifies the VAE format.
  • clipLayerSkip (integer, default: 1): Number of CLIP layers to skip.
  • imageBatchSize (integer, default: 1): Number of images to generate (1-4).
  • negativePrompt (string): Undesired elements in the generation.
  • prependInitialPrompt (boolean, default: true): Prepend detailed prompts for quality.
  • guidanceRescaleFactor (number, default: 1): Adjusts rescaling of CFG noise.

Output

Upon successful execution, the action returns a list of URLs to the generated images. For example:

[
  "https://assets.cognitiveactions.com/invocations/bc23cc3a-c2be-4b0b-bc37-b924a4aa267a/8c943cdd-a2e4-4846-9911-f7dfb979f3f2.png"
]

This output consists of accessible links to the generated images, which can be used directly in your applications.

Conceptual Usage Example (Python)

Here is a conceptual Python snippet demonstrating how to call the Generate Image Using CyberPrime-XL-v1 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 = "24ac5fff-4ccb-4b91-9208-61ca2c0d4a7d"  # Action ID for Generate Image Using CyberPrime-XL-v1

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "model": "CyberPrime-XL-v1",
    "steps": 30,
    "width": 1024,
    "height": 1024,
    "prompt": "street, 1girl, dark-purple short hair, purple eyes, medium breasts, cleavage, casual clothes, smile, V",
    "cfgScale": 5,
    "pagScale": 0,
    "scheduler": "Euler a",
    "vaeFormat": "default",
    "clipLayerSkip": 1,
    "imageBatchSize": 1,
    "negativePrompt": "nsfw, naked",
    "prependInitialPrompt": true,
    "guidanceRescaleFactor": 1
}

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}")

This code snippet highlights how to format the input payload and send it to the Cognitive Actions endpoint. Replace the placeholder API key and endpoint URL with your actual values to execute the action.

Conclusion

The CyberPrime-XL-v1 Cognitive Actions provide a powerful way to integrate image generation capabilities into your applications. By leveraging the customizable parameters of the Generate Image Using CyberPrime-XL-v1 action, developers can create stunning visuals tailored to their specific needs. Consider experimenting with various prompts and parameters to see the diverse outputs possible through this innovative model. Happy coding!