Generate Stunning Images with the siamakf/campfire-steve-sdxl Cognitive Actions

22 Apr 2025
Generate Stunning Images with the siamakf/campfire-steve-sdxl Cognitive Actions

In the world of digital creativity, generating customized images has become a key feature for many applications. The siamakf/campfire-steve-sdxl Cognitive Actions provide developers with the ability to create personalized images using detailed text prompts and various customization options. This powerful API allows for image generation in different modes including img2img and inpainting, giving you the flexibility to refine visuals in ways that suit your project's needs.

Prerequisites

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

  • An API key for the Cognitive Actions platform, which will be used for authentication.
  • Basic understanding of JSON format for constructing requests.

To authenticate your requests, you will typically pass your API key in the headers of your HTTP requests.

Cognitive Actions Overview

Generate Customized Images

The Generate Customized Images action allows you to create unique images based on text prompts. You can specify various parameters, including the dimensions of the image, the strength of the prompt, and the style of refinement to apply.

Input

The input for this action is defined by the following schema:

FieldTypeDescription
promptstringA descriptive input prompt for guiding the image generation.
widthintegerWidth of the output image in pixels (default: 1024).
heightintegerHeight of the output image in pixels (default: 1024).
loraScalenumberScale factor for LoRA additive transformations (default: 0.6).
numOutputsintegerNumber of images to generate (default: 1, max: 4).
refineStylestringRefinement style to apply; options include 'no_refiner', 'expert_ensemble_refiner', and 'base_image_refiner'.
guidanceScalenumberMultiplier for classifier-free guidance (default: 7.5).
highNoiseFracnumberFraction of noise to be utilized by the refinement (default: 0.8).
applyWatermarkbooleanEnable or disable watermark application (default: true).
negativePromptstringA negative input prompt to discourage certain elements (default: "").
promptStrengthnumberIntensity of prompt influence (default: 0.8).
numInferenceStepsintegerNumber of denoising steps (default: 50).
schedulingAlgorithmstringAlgorithm to schedule image generation (default: "K_EULER").

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "cute cartoon lion expressing joy, chef's hat, animal crossing",
  "loraScale": 0.6,
  "numOutputs": 4,
  "refineStyle": "expert_ensemble_refiner",
  "guidanceScale": 7.5,
  "highNoiseFrac": 0.8,
  "applyWatermark": true,
  "negativePrompt": "realistic",
  "promptStrength": 0.8,
  "numInferenceSteps": 75,
  "schedulingAlgorithm": "K_EULER"
}

Output

When you invoke this action, it typically returns an array of URLs pointing to the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/ccbccefb-04d4-4b25-a575-1cfda3f76c39/4e627a93-2e2f-4c8e-bb7e-531d8b5d5f9b.png",
  "https://assets.cognitiveactions.com/invocations/ccbccefb-04d4-4b25-a575-1cfda3f76c39/30d80fa4-bb8f-4283-aa90-39817c8be874.png",
  "https://assets.cognitiveactions.com/invocations/ccbccefb-04d4-4b25-a575-1cfda3f76c39/092ce670-0de6-478c-bb25-c3b0701af9cd.png",
  "https://assets.cognitiveactions.com/invocations/ccbccefb-04d4-4b25-a575-1cfda3f76c39/bc915926-5d34-4270-9ad4-d893929b21f6.png"
]

Conceptual Usage Example (Python)

Here’s an example of how you might call the Generate Customized Images 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 = "f5ef4710-5e26-45aa-baaa-f423b9d78fd0" # Action ID for Generate Customized Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "cute cartoon lion expressing joy, chef's hat, animal crossing",
    "loraScale": 0.6,
    "numOutputs": 4,
    "refineStyle": "expert_ensemble_refiner",
    "guidanceScale": 7.5,
    "highNoiseFrac": 0.8,
    "applyWatermark": true,
    "negativePrompt": "realistic",
    "promptStrength": 0.8,
    "numInferenceSteps": 75,
    "schedulingAlgorithm": "K_EULER"
}

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 snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action ID is specified for the Generate Customized Images action, and the input payload is structured according to the required schema.

Conclusion

The siamakf/campfire-steve-sdxl Cognitive Actions provide an exceptional way for developers to integrate image generation capabilities into their applications. With customizable options and various modes of operation, these actions can significantly enhance the user experience by allowing for unique and engaging visuals. As you explore these capabilities, consider experimenting with different prompts and parameters to see the broad range of creative possibilities!