Create Stunning Images with SDXL Beksinski Cognitive Actions

26 Apr 2025
Create Stunning Images with SDXL Beksinski Cognitive Actions

The SDXL Beksinski Cognitive Actions empower developers to harness advanced image generation capabilities, enabling the creation of visually striking images with ease. This powerful API not only simplifies the image generation process but also offers a myriad of customizable options, allowing for tailored outputs that meet specific artistic or project needs. With features such as inpaint mode, adjustable dimensions, and multiple refinement styles, developers can push the boundaries of creativity and innovation in their applications.

Common use cases for the SDXL Beksinski actions include game development, digital art creation, marketing materials, and any scenario where unique, high-quality images are required. Whether you're looking to generate concept art, enhance existing images, or create entirely new visuals based on prompts, these actions provide a streamlined and efficient solution.

Prerequisites

To get started, you'll need an API key for the Cognitive Actions service and a basic understanding of making API calls.

Generate Image with SDXL Beksinski

The Generate Image with SDXL Beksinski action allows you to create images using the SDXL Beksinski model. This action addresses the need for high-quality, unique image generation by providing various configurable properties, including prompt guidance, watermarking, noise control, and scheduler options.

Input Requirements

To utilize this action, you'll need to provide the following parameters:

  • prompt: A textual description that guides the image generation process (e.g., "a depressing landscape, bare, in the style of TOK").
  • width: The desired width of the output image in pixels (default is 1024).
  • height: The desired height of the output image in pixels (default is 1024).
  • numOutputs: The number of images to generate (between 1 and 4).
  • guidanceScale: A value that controls the strength of the prompt's influence (default is 7.5).
  • Additional optional parameters include seed, refinement options, noise levels, and watermark settings.

Expected Output

The output will be a URL link to the generated image. For example:

https://assets.cognitiveactions.com/invocations/960c3d5a-4aff-4d45-ab35-a6b9e80ef61e/36d782f4-862d-4d08-be23-ac6604d6c56a.png

Use Cases for this specific action

This action is particularly useful for:

  • Game Developers: Generate concept art or assets that fit a specific theme or style.
  • Artists: Create unique pieces based on specific prompts or styles, helping to inspire further artistic endeavors.
  • Marketing Teams: Produce visually appealing images for promotional content or social media.
  • Content Creators: Enhance blog posts, articles, or videos with custom-generated visuals that align with the narrative.
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "feb3c658-1fb9-4659-9954-1455f23765ea" # Action ID for: Generate Image with SDXL Beksinski

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 1024,
  "height": 768,
  "prompt": "a depressing landscape, bare, in the style of TOK",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "numOutputs": 1,
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "highNoiseFraction": 0.8,
  "numInferenceSteps": 50
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    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 (non-JSON): {e.response.text}")
    print("------------------------------------------------")

Conclusion

The SDXL Beksinski Cognitive Actions offer a robust solution for developers looking to incorporate advanced image generation into their projects. With its flexible input options and powerful output capabilities, this action can significantly enhance the visual quality of applications across various domains. By leveraging these capabilities, developers can unlock new creative potentials and streamline their workflows. To explore further, consider integrating these actions into your projects or experimenting with different input parameters to see the range of images you can create.