Effortlessly Generate Images with ACS Tokens Using alekseycalvin/acsoonr_flux Actions

24 Apr 2025
Effortlessly Generate Images with ACS Tokens Using alekseycalvin/acsoonr_flux Actions

In the world of AI-driven creativity, the ability to generate images based on descriptive prompts can unlock endless possibilities for developers. The alekseycalvin/acsoonr_flux API offers a powerful Cognitive Action specifically designed for image generation. By utilizing an ACS token, this action allows for the customization of various parameters such as image size, format, quality, and more. This article will guide you through the capabilities of this action and provide conceptual examples of how you can integrate it into your applications.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Familiarity with making API calls and handling JSON payloads.

Authentication typically involves passing your API key in the header of your requests, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Image with ACS Token

The Generate Image with ACS Token action leverages an ACS token to create customized images based on a detailed prompt. This action gives you the flexibility to specify various parameters, including model selection and output quality, making it suitable for a wide range of creative applications.

Input

The input for this action is defined by the CompositeRequest schema, which includes several required and optional fields. Here’s a breakdown of the necessary fields:

  • prompt (required): A detailed description of the image you want to generate.
  • loraScale (optional): Defines the influence strength of the main LoRA, with typical values between 0 and 1.
  • numOutputs (optional): Specifies the number of images to generate (default is 1).
  • outputFormat (optional): The format for the output images, such as webp, jpg, or png.
  • guidanceScale (optional): A scale for the diffusion process to influence image realism.
  • outputQuality (optional): Quality level for saving images, ranging from 0 to 100.
  • generationModel (optional): Choose between 'dev' and 'schnell' models for performance optimization.
  • imageAspectRatio (optional): Sets the aspect ratio of the generated image.

Here’s an example of the JSON payload needed to invoke this action:

{
  "prompt": "photo of acs person with green eyes and brown hair, full height, realistic hands, strolling alone through Revolutionary Soviet Petrograd in 1920 during the winter, photorealistic analog film photography, lifelike ACS person features, photorealistic textured skin and clothing details, best quality dslr mirrorless camera professional photography, extremely detailed intricate historically-accurate background, indistinguishable from life, accurate anatomy, accurate fingers",
  "loraScale": 1,
  "numOutputs": 1,
  "outputFormat": "webp",
  "guidanceScale": 4.5,
  "outputQuality": 100,
  "generationModel": "dev",
  "imageAspectRatio": "16:9",
  "numInferenceSteps": 28
}

Output

Upon successful execution, the action returns a URL pointing to the generated image. Here's an example of the output you might receive:

[
  "https://assets.cognitiveactions.com/invocations/f056eaff-a53e-45d9-9f08-85d90cd05a2d/b32d9506-4c5a-4311-8dc7-693c8bb91560.webp"
]

This URL directs you to the generated image, which can be utilized directly in your application or displayed to users.

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call this Cognitive 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 = "d0a68934-6be2-4755-8657-4bb45a4f179d" # Action ID for Generate Image with ACS Token

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "photo of acs person with green eyes and brown hair, full height, realistic hands, strolling alone through Revolutionary Soviet Petrograd in 1920 during the winter, photorealistic analog film photography, lifelike ACS person features, photorealistic textured skin and clothing details, best quality dslr mirrorless camera professional photography, extremely detailed intricate historically-accurate background, indistinguishable from life, accurate anatomy, accurate fingers",
    "loraScale": 1,
    "numOutputs": 1,
    "outputFormat": "webp",
    "guidanceScale": 4.5,
    "outputQuality": 100,
    "generationModel": "dev",
    "imageAspectRatio": "16:9",
    "numInferenceSteps": 28
}

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, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID and input payload should align with the specifications outlined for the "Generate Image with ACS Token" action.

Conclusion

The ability to generate images dynamically using the alekseycalvin/acsoonr_flux Cognitive Actions opens up exciting new avenues for creativity and application development. Whether you're building an art generator, a game, or any application that benefits from custom imagery, this action provides a robust solution. Start experimenting with different prompts and parameters to see what unique creations you can bring to life!