Create Stunning Images with the AuraFlow Cognitive Actions

24 Apr 2025
Create Stunning Images with the AuraFlow Cognitive Actions

The AuraFlow model, part of the jyoung105/auraflow-v3 specification, offers developers a powerful way to generate images from textual descriptions. These pre-built Cognitive Actions simplify the integration of advanced image generation techniques into your applications, allowing for customization and control over various parameters to enhance the output quality. In this article, we'll explore how to utilize the Generate Image with AuraFlow action effectively.

Prerequisites

Before you can start using the Cognitive Actions, ensure you have:

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests in your programming language of choice.

Authentication typically involves passing your API key in the headers of your requests, ensuring that your application can securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Image with AuraFlow

The Generate Image with AuraFlow action leverages the AuraFlow model to create images based on text descriptions. This open-sourced, flow-based text-to-image generation model provides flexibility in customizing parameters such as image dimensions, denoising steps, and guidance scaling to produce high-quality images.

Input

The input for this action consists of several parameters, which you can customize to achieve the desired image output:

{
  "seed": 12345, // Optional
  "steps": 50, // Required, range: 1-50
  "width": 1024, // Required, range: 1-2048
  "height": 1024, // Required, range: 1-2048
  "prompt": "A man with hoodie on, illustration", // Required
  "guidanceScale": 3.5, // Optional, range: 0-20
  "numberOfImages": 1 // Required, range: 1-4
}

Example Input:

{
  "steps": 50,
  "width": 1024,
  "height": 1024,
  "prompt": "A man with hoodie on, illustration",
  "guidanceScale": 3.5,
  "numberOfImages": 1
}

Output

When the action is executed successfully, it returns the URL(s) of the generated image(s). Here’s an example of what the output might look like:

[
  "https://assets.cognitiveactions.com/invocations/3117f406-23ed-4fa4-86df-539bf911fe10/fcf2ca76-c75a-4e46-8363-2a7f82848967.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet showing how to call the Generate Image with AuraFlow action. This example highlights structuring the input JSON payload correctly:

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 = "c7b3cd25-f7c6-4c80-9bf0-35926063ea36" # Action ID for Generate Image with AuraFlow

# Construct the input payload based on the action's requirements
payload = {
    "steps": 50,
    "width": 1024,
    "height": 1024,
    "prompt": "A man with hoodie on, illustration",
    "guidanceScale": 3.5,
    "numberOfImages": 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}")

In this code snippet:

  • Replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action_id is set to the ID for generating images with AuraFlow.
  • The payload is structured according to the required input schema.

Conclusion

By leveraging the Generate Image with AuraFlow action, developers can easily create customized images from textual prompts. This powerful capability opens up numerous possibilities for enhancing applications, from creative artwork generation to practical visual content creation. Explore the AuraFlow Cognitive Actions today and start integrating advanced image generation into your projects!