Create Whimsical Images with the jayenkai/derek Cognitive Actions

24 Apr 2025
Create Whimsical Images with the jayenkai/derek Cognitive Actions

In the world of image generation, the jayenkai/derek spec provides a unique and engaging way to create whimsical images through its powerful Cognitive Actions. These actions enable developers to leverage pre-built functionalities that simplify the process of generating artistic visuals. By integrating these actions into your applications, you can quickly produce creative images with custom prompts, tailored models, and various output formats.

Prerequisites

To get started with the Cognitive Actions for jayenkai/derek, you will need:

  • An API key for accessing the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON payloads.

Authentication typically requires you to include your API key in the headers of your requests. This ensures secure and authorized access to the actions.

Cognitive Actions Overview

Generate Cartoon Derek Image

Description: This action creates images with a whimsical 'Cartoon Derek' theme using specific prompts and models. You can opt for the 'dev' model for detailed output or the 'schnell' model for faster results.

Category: Image Generation

Input

The input schema for this action requires the following fields:

  • prompt (required): A string describing the desired image, e.g., "Cartoon Derek sits in his office cubicle surrounded by paper aeroplanes."
  • model (optional): Choose between "dev" (detailed) or "schnell" (fast).
  • accelerate (optional): Boolean indicating whether to enable faster predictions.
  • megapixels (optional): Approximate number of megapixels for the generated image.
  • imageFormat (optional): Desired output format (webp, jpg, png).
  • outputCount (optional): Number of output images (default is 1).
  • imageQuality (optional): Quality of the output images, from 0 (lowest) to 100 (highest).
  • guidanceScale (optional): Guidance scale for the diffusion process.
  • mainLoraScale (optional): Scale for applying the main LoRA.
  • inferenceSteps (optional): Number of denoising steps (default is 28).
  • imageAspectRatio (optional): Aspect ratio for the generated image.
  • additionalLoraScale (optional): Intensity of applying additional LoRA.
  • imagePromptStrength (optional): Strength of the prompt in image-to-image mode.

Example Input:

{
  "model": "schnell",
  "prompt": "Cartoon Derek sits in his office cubicle surrounded by paper aeroplanes",
  "accelerate": false,
  "megapixels": "1",
  "imageFormat": "png",
  "outputCount": 4,
  "imageQuality": 90,
  "guidanceScale": 3.5,
  "mainLoraScale": 0.93,
  "inferenceSteps": 5,
  "imageAspectRatio": "3:2",
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8
}

Output

The action typically returns an array of URLs pointing to the generated images. Here’s an example of what you might receive:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/38b2ffcd-e17e-4c79-96c7-747e0b092b46/5df5dd6f-2c38-4f15-8673-74f6fd34768b.png",
  "https://assets.cognitiveactions.com/invocations/38b2ffcd-e17e-4c79-96c7-747e0b092b46/d7ac78ce-b49d-49f2-8add-2443b290ed4c.png",
  "https://assets.cognitiveactions.com/invocations/38b2ffcd-e17e-4c79-96c7-747e0b092b46/3b2d3675-a32e-490f-9872-ff39509e25d0.png",
  "https://assets.cognitiveactions.com/invocations/38b2ffcd-e17e-4c79-96c7-747e0b092b46/9c1c53ec-fb70-4ca9-8670-9c78f695a9f4.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Cartoon Derek Image 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 = "c801f461-8575-4498-a9bb-3f38bf4947b4"  # Action ID for Generate Cartoon Derek Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "schnell",
    "prompt": "Cartoon Derek sits in his office cubicle surrounded by paper aeroplanes",
    "accelerate": False,
    "megapixels": "1",
    "imageFormat": "png",
    "outputCount": 4,
    "imageQuality": 90,
    "guidanceScale": 3.5,
    "mainLoraScale": 0.93,
    "inferenceSteps": 5,
    "imageAspectRatio": "3:2",
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8
}

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, you'll see how to set up the request to invoke the Generate Cartoon Derek Image action. The action_id and payload are structured according to the example provided, and the endpoint URL is illustrative.

Conclusion

The jayenkai/derek Cognitive Actions provide developers with an easy way to create whimsical images tailored to specific prompts. By integrating the Generate Cartoon Derek Image action into your applications, you can enhance user experiences through unique visuals while saving time on development. Consider exploring different prompts and model configurations to see the creative possibilities unfold!