Create Stunning Custom Images with jborgesdb/my-otp-tok Cognitive Actions

23 Apr 2025
Create Stunning Custom Images with jborgesdb/my-otp-tok Cognitive Actions

In the realm of image generation, the jborgesdb/my-otp-tok Cognitive Actions offer powerful capabilities for developers to create stylish, custom visuals tailored to their needs. By leveraging these pre-built actions, you can streamline your application development while enhancing the creative output with minimal effort. Whether it's for fashion, art, or marketing, these actions provide the tools necessary to produce high-quality images based on specific prompts and parameters.

Prerequisites

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

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON and HTTP requests.
  • A development environment set up for making API calls, ideally using Python or another programming language of your choice.

Authentication typically involves passing your API key in the headers of your requests, allowing you to gain access to the Cognitive Actions and their features.

Cognitive Actions Overview

Generate Styled Image

The Generate Styled Image action allows you to create custom images based on specified prompts. It offers a range of parameters, including image dimensions, quality, aspect ratio, and LoRA intensities, making it perfect for generating fashion-forward visuals inspired by desert aesthetics.

  • Category: Image Generation

Input

The input for this action requires a JSON object that includes the following fields:

  • prompt (required): A descriptive string that guides the image generation.
  • mask (optional): An image mask for inpainting mode (URI).
  • seed (optional): An integer for reproducible generation.
  • image (optional): An input image for image-to-image or inpainting mode (URI).
  • model (optional): Model version for inference (dev or schnell).
  • width (optional): Width of the image (256–1440 pixels).
  • height (optional): Height of the image (256–1440 pixels).
  • imageAspectRatio (optional): Aspect ratio of the image (e.g., 1:1, 16:9, etc.).
  • outputCount (optional): Number of outputs to generate (1-4).
  • imageQuality (optional): Quality of the output image (0-100).
  • imageFormat (optional): Format of the output image (webp, jpg, png).

Here’s an example input JSON payload for generating a styled image:

{
  "model": "dev",
  "prompt": "Minimalistic flat lay shot of a modern OTPTOK white full shirt. Scene is styled on rippled golden sand with strong shadows to enhance depth. The sunlight is soft yet contrasts light and dark sides of the frame. Achieve a clean fashion-forward vibe inspired by desert aesthetics",
  "fastMode": false,
  "imageFormat": "webp",
  "outputCount": 1,
  "imageQuality": 80,
  "mainLoraScale": 1,
  "imageResolution": "1",
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 2.5,
  "inferenceStepCount": 38,
  "additionalLoraScale": 1
}

Output

Upon execution, the action typically returns a JSON array containing URLs to the generated images. Here's an example output:

[
  "https://assets.cognitiveactions.com/invocations/15e8acd5-5cbf-4b14-aa67-34200c9727d9/7ba405b8-926a-45a9-8f35-4362508c6378.webp"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet that demonstrates how to call the Generate Styled 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 = "e2732c9b-36d5-40af-986f-77406e0d26a1" # Action ID for Generate Styled Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "Minimalistic flat lay shot of a modern OTPTOK white full shirt. Scene is styled on rippled golden sand with strong shadows to enhance depth. The sunlight is soft yet contrasts light and dark sides of the frame. Achieve a clean fashion-forward vibe inspired by desert aesthetics",
    "fastMode": False,
    "imageFormat": "webp",
    "outputCount": 1,
    "imageQuality": 80,
    "mainLoraScale": 1,
    "imageResolution": "1",
    "promptIntensity": 0.8,
    "imageAspectRatio": "1:1",
    "guidanceIntensity": 2.5,
    "inferenceStepCount": 38,
    "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 action ID is specific to the Generate Styled Image action. The input payload is structured according to the required parameters, ensuring you can generate stunning custom images effectively.

Conclusion

By utilizing the jborgesdb/my-otp-tok Cognitive Actions, you can unlock a world of creativity and efficiency in image generation. From fashion to art, the ability to create tailored visuals based on your specifications opens up numerous possibilities for application development. Consider integrating these actions into your projects, and explore the unique output they can provide. Happy coding!