Create Stunning Azuki Style Images with batmanscode/azuki-style-flux Cognitive Actions

21 Apr 2025
Create Stunning Azuki Style Images with batmanscode/azuki-style-flux Cognitive Actions

In the world of digital art and NFTs, the ability to generate unique images quickly can be a game-changer for developers and artists alike. The batmanscode/azuki-style-flux API provides a powerful Cognitive Action that allows you to create images stylized with Azuki NFTs using a specialized Flux model. By leveraging this API, you can achieve impressive artistic styles with enhanced generation speed and quality, making it easier than ever to bring your creative visions to life.

Prerequisites

Before diving into the integration of Cognitive Actions, here are a few requirements you need to get started:

  • API Key: You will need a valid API key for the Cognitive Actions platform to authenticate your requests. This key should be included in the headers of your API calls.
  • Basic Understanding of JSON: Familiarity with JSON formatting will help you structure your requests effectively.

Authentication typically involves passing your API key in the request headers as shown in the conceptual code snippets.

Cognitive Actions Overview

Generate Azuki Style Image

The Generate Azuki Style Image action is designed to create images styled after Azuki NFTs, utilizing the Flux model for optimal performance. This action empowers developers to generate unique art pieces by simply providing a textual prompt and a few configuration options.

  • Category: Image Generation

Input

The input to this action requires a JSON object with various properties. Below is the schema and an example input:

{
  "prompt": "portrait of batman in the style of AZUKI",
  "seed": 69,
  "model": "dev",
  "goFast": true,
  "aspectRatio": "1:1",
  "outputCount": 1,
  "outputFormat": "jpg",
  "guidanceScale": 3,
  "outputQuality": 80,
  "promptStrength": 0.8,
  "imageMegapixels": "1",
  "loraWeightScale": 1,
  "inferenceStepCount": 28,
  "additionalLoraScale": 1
}

Required Fields:

  • prompt: Textual description for the image (e.g., "portrait of batman in the style of AZUKI").

Optional Fields:

  • seed: An integer for reproducible image generation.
  • model: Choose between "dev" for optimal performance or "schnell" for faster output.
  • goFast: Boolean to enable faster prediction using optimized models.
  • aspectRatio: Sets the image aspect ratio; defaults to "1:1".
  • outputCount: Specifies the number of images to generate (1-4).
  • outputFormat: The desired format for output images (e.g., "jpg", "png").
  • Additional fields for controlling quality, scaling, and more.

Output

The output will typically be a JSON array containing URLs to the generated images. Here’s an example output:

[
  "https://assets.cognitiveactions.com/invocations/1feb1d7f-ed88-48d4-95b6-6e262b33bff1/0be72299-fd61-4651-ae20-9f36f9bc5aa8.jpg"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to invoke the Generate Azuki Style Image 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 = "5ead09de-b881-4f83-84e8-95169abeab88"  # Action ID for Generate Azuki Style Image

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "portrait of batman in the style of AZUKI",
    "seed": 69,
    "model": "dev",
    "goFast": True,
    "aspectRatio": "1:1",
    "outputCount": 1,
    "outputFormat": "jpg",
    "guidanceScale": 3,
    "outputQuality": 80,
    "promptStrength": 0.8,
    "imageMegapixels": "1",
    "loraWeightScale": 1,
    "inferenceStepCount": 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 payload is constructed to meet the action's requirements.
  • The response is processed to print the resulting image URLs.

Conclusion

The Generate Azuki Style Image action from the batmanscode/azuki-style-flux API enables developers to create stunning, stylized images quickly and effectively. With a variety of customization options, you can easily tailor the output to fit your artistic vision.

Now that you’ve learned how to integrate this powerful tool, consider experimenting with different prompts, styles, and configurations to see what unique creations you can generate! Happy coding!