Create Stunning Visuals with the sky-admin/ghost_mix_v2 Cognitive Actions

25 Apr 2025
Create Stunning Visuals with the sky-admin/ghost_mix_v2 Cognitive Actions

In today's world, the ability to generate high-quality images programmatically can enhance applications across various domains, from gaming to storytelling. The sky-admin/ghost_mix_v2 spec provides developers with powerful Cognitive Actions to create photorealistic images based on user-defined prompts. These pre-built actions streamline the process, allowing developers to focus on creativity rather than the complexities of image generation.

Prerequisites

To integrate the Cognitive Actions from the sky-admin/ghost_mix_v2 spec, you will need an API key for the Cognitive Actions platform. This key is typically passed in the headers of your requests for authentication purposes. Ensure you have access to the relevant endpoint and necessary permissions to use the actions.

Cognitive Actions Overview

Generate Photorealistic Image

The Generate Photorealistic Image action allows you to create a highly detailed photorealistic image by providing specific prompts for visual guidance. You can customize various parameters such as resolution, dimensions, and the sampling algorithm used.

Input

The input schema for this action includes several parameters that can be adjusted to tailor the image output:

  • seed (integer, optional): Seed value for random generation; default is -1 for a random seed.
  • steps (integer, optional): Number of steps to run the process; default is 20.
  • width (integer, optional): Width of the image in pixels; default is 512.
  • height (integer, optional): Height of the image in pixels; default is 768.
  • prompt (string, required): Text prompt for generating images; influences the visual outcome.
  • samplerName (string, optional): Name of the sampling algorithm to be used; default is "DPM++ 2M Karras".
  • negativePrompt (string, optional): Negative prompt to avoid certain features in the generated image.
  • configurationScale (integer, optional): Scale of configuration settings; default is 8.
  • enableHighResolution (boolean, optional): Option to generate a high-resolution version; default is false.

Example Input:

{
  "seed": -1,
  "steps": 20,
  "width": 512,
  "height": 768,
  "prompt": "(masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1 elf girl:1.3), extreme detailed,(heal magic,green color magic:1.2),colorful,highest detailed,illustrations, artistic fusion,fantastical scenes,striking visuals,",
  "samplerName": "DPM++ SDE Karras",
  "negativePrompt": "(worst quality, low quality:2), NSFW,monochrome, zombie,overexposure, watermark,text,bad anatomy,bad hand,extra hands,extra fingers,too many fingers,fused fingers,bad arm,distorted arm,extra arms,fused arms,extra legs,missing leg,disembodied leg,extra nipples, detached arm, liquid hand,inverted hand,disembodied limb, oversized head,extra body,extra navel,easynegative,(hair between eyes),sketch, duplicate, ugly, huge eyes, text, logo, worst face, (bad and mutated hands:1.3),  (blurry:2.0), horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, (interlocked fingers:1.2), Ugly Fingers, (extra digit and hands and fingers and legs and arms:1.4), (deformed fingers:1.2), (long fingers:1.2),(bad-artist-anime), bad-artist, bad hand, extra legs ,(ng_deepnegative_v1_75t)",
  "configurationScale": 8,
  "enableHighResolution": true
}

Output

Upon successful execution, the action typically returns a URL pointing to the generated image.

Example Output:

https://assets.cognitiveactions.com/invocations/edfad642-0dc6-49de-aba6-8467295f2b53/8b7ddae7-2bb9-47b4-9d4e-8728bb500c75.png

Conceptual Usage Example (Python)

Here's a conceptual Python snippet that demonstrates how to invoke the Generate Photorealistic Image action using the Cognitive Actions endpoint:

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 = "03e60c4c-96e2-481a-bfb1-c998ccbf72cc" # Action ID for Generate Photorealistic Image

# Construct the input payload based on the action's requirements
payload = {
    "seed": -1,
    "steps": 20,
    "width": 512,
    "height": 768,
    "prompt": "(masterpiece, top quality, best quality, official art, beautiful and aesthetic:1.2), (1 elf girl:1.3), extreme detailed,(heal magic,green color magic:1.2),colorful,highest detailed,illustrations, artistic fusion,fantastical scenes,striking visuals,",
    "samplerName": "DPM++ SDE Karras",
    "negativePrompt": "(worst quality, low quality:2), NSFW,monochrome, zombie,overexposure, watermark,text,bad anatomy,bad hand,extra hands,extra fingers,too many fingers,fused fingers,bad arm,distorted arm,extra arms,fused arms,extra legs,missing leg,disembodied leg,extra nipples, detached arm, liquid hand,inverted hand,disembodied limb, oversized head,extra body,extra navel,easynegative,(hair between eyes),sketch, duplicate, ugly, huge eyes, text, logo, worst face, (bad and mutated hands:1.3),  (blurry:2.0), horror, geometry, bad_prompt, (bad hands), (missing fingers), multiple limbs, bad anatomy, (interlocked fingers:1.2), Ugly Fingers, (extra digit and hands and fingers and legs and arms:1.4), (deformed fingers:1.2), (long fingers:1.2),(bad-artist-anime), bad-artist, bad hand, extra legs ,(ng_deepnegative_v1_75t)",
    "configurationScale": 8,
    "enableHighResolution": true
}

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 variable should be set to the ID of the action you want to execute. The payload structure follows the input schema defined earlier, ensuring the action is called correctly.

Conclusion

The sky-admin/ghost_mix_v2 Cognitive Actions provide developers with an exciting opportunity to generate stunning, photorealistic images easily. By leveraging the flexibility of the input parameters, you can create visuals that cater to your specific application needs. Explore these actions further to unlock new creative possibilities in your projects!