Transform Your Ideas into Stunning Images with BeyondSuperbia's Flux Cognitive Actions

24 Apr 2025
Transform Your Ideas into Stunning Images with BeyondSuperbia's Flux Cognitive Actions

In the ever-evolving landscape of artificial intelligence, image generation has become a pivotal aspect of many applications. The BeyondSuperbia/Flux API offers a robust set of Cognitive Actions designed to facilitate high-quality image creation through advanced techniques, such as inpainting and the utilization of LoRA weights. By leveraging this API, developers can transform simple prompts into visually stunning outputs, making it an invaluable tool for artists, content creators, and developers alike.

Prerequisites

Before integrating BeyondSuperbia's Flux Cognitive Actions into your application, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON data.
  • An understanding of how to authenticate your requests by passing the API key in the headers.

Cognitive Actions Overview

Generate Image With LoRA Weights

The Generate Image With LoRA Weights action allows developers to create high-quality images from textual prompts. This action supports a range of customizable parameters, including the ability to adjust image dimensions, output count, and prompt strength. By utilizing efficient models like 'dev' and 'schnell', users can generate images quickly and accurately.

Input

The input for this action requires a prompt and offers various optional fields. Here’s the schema for the input:

{
  "prompt": "string", // Required
  "model": "string", // Optional, default: "dev"
  "goFast": "boolean", // Optional, default: false
  "loraScale": "number", // Optional, default: 1
  "megapixels": "string", // Optional, default: "1"
  "numOutputs": "integer", // Optional, default: 1
  "aspectRatio": "string", // Optional, default: "1:1"
  "outputFormat": "string", // Optional, default: "webp"
  "guidanceScale": "number", // Optional, default: 3
  "outputQuality": "integer", // Optional, default: 80
  "promptStrength": "number", // Optional, default: 0.8
  "numInferenceSteps": "integer", // Optional, default: 28
  "additionalLoraScale": "number" // Optional, default: 1
}

Example Input:

{
  "model": "dev",
  "goFast": false,
  "prompt": "Ultra-detailed close-up of a rugged Ford Ranger Wildtrak tyre rolling on a pristine tar road, highlighting the deep treads and suspension components, cinematic lighting, realistic textures, motion blur on the wheel, high realism",
  "loraScale": 1,
  "megapixels": "1",
  "numOutputs": 1,
  "aspectRatio": "16:9",
  "outputFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 80,
  "promptStrength": 0.8,
  "numInferenceSteps": 28,
  "additionalLoraScale": 1
}

Output

The action typically returns an array of URLs pointing to the generated images. Here’s an example of what the output looks like:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/261193d4-0790-4dc1-af11-b7edcc14e5cf/a6ffbaf1-b0f6-43c1-b14b-47d71b1c26ea.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call this 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 = "6535d708-aa08-4148-bdeb-8201b4a541ed" # Action ID for Generate Image With LoRA Weights

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "Ultra-detailed close-up of a rugged Ford Ranger Wildtrak tyre rolling on a pristine tar road, highlighting the deep treads and suspension components, cinematic lighting, realistic textures, motion blur on the wheel, high realism",
    "loraScale": 1,
    "megapixels": "1",
    "numOutputs": 1,
    "aspectRatio": "16:9",
    "outputFormat": "webp",
    "guidanceScale": 3,
    "outputQuality": 80,
    "promptStrength": 0.8,
    "numInferenceSteps": 28,
    "additionalLoraScale": 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 and input payload must be structured as shown to successfully invoke the image generation process.

Conclusion

The BeyondSuperbia/Flux Cognitive Actions offer a powerful way to generate images from text prompts, making it easier than ever for developers to integrate advanced image generation capabilities into their applications. With customizable parameters and support for different models, you can tailor the image generation process to fit your specific needs. Start experimenting with these actions today to unlock new creative possibilities in your projects!