Create Custom Images with Hot Dog Writing Actions

26 Apr 2025
Create Custom Images with Hot Dog Writing Actions

Hot Dog Writing is an innovative service that enables developers to generate custom images using advanced AI models. With its unique Cognitive Actions, developers can create visually appealing images tailored to their specific needs, all while benefiting from speed and customization options. This service is particularly useful for applications in marketing, social media, content creation, and any scenario where eye-catching visuals are crucial. By leveraging Hot Dog Writing, you can streamline your creative process and enhance user engagement with high-quality images.

Before diving into the specifics of the actions, ensure that you have a Cognitive Actions API key and a fundamental understanding of making API calls to get started.

Generate Custom Images

The "Generate Custom Images" action allows you to create images using either the 'dev' or 'schnell' models. The 'dev' model is designed for optimal results, executing around 28 inference steps for detailed imagery, while the 'schnell' model is optimized for speed, requiring only 4 steps. This action enables you to customize various image settings, including width, height, aspect ratio, and output formats, providing a versatile tool for image generation.

Input Requirements

To utilize this action, you need to provide a prompt that describes the image you wish to generate. The input schema includes several optional parameters that allow for further customization:

  • Prompt: A descriptive text that guides the image generation process.
  • Model: Choose between 'dev' for quality or 'schnell' for speed.
  • Width and Height: Specify dimensions (only applicable for custom aspect ratios).
  • Aspect Ratio: Select from standard ratios or define a custom ratio.
  • Output Format: Choose the format for the generated image, such as webp, jpg, or png.
  • Guidance Scale: Adjusts the realism of generated images.
  • Number of Outputs: Define how many images to generate in one request.

Expected Output

The output will be a generated image based on the prompt and specified parameters. For example, a successful request might return a URL to the generated image, which can be used directly in your application.

Use Cases for this specific action:

  • Marketing Materials: Create unique visuals for campaigns or advertisements.
  • Social Media Content: Generate engaging images that stand out on platforms like Instagram or Twitter.
  • Product Mockups: Visualize product concepts or designs quickly and effectively.
  • Creative Projects: For artists and designers, this action can serve as a source of inspiration or a tool for rapid prototyping.
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 = "c46fa628-7b64-479e-ae3c-7eb04ff50efd" # Action ID for: Generate Custom Images

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "prompt": "HOTDOGART send a hot dog written in mustard on a hot dog",
  "loraScale": 1,
  "aspectRatio": "1:1",
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "numInferenceSteps": 28,
  "disableSafetyChecker": false
}

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 Hot Dog Writing service, particularly its "Generate Custom Images" action, offers a powerful solution for developers looking to enhance their applications with custom visuals. By utilizing the flexibility and speed of this action, you can create compelling images tailored to various needs, from marketing to creative projects. As you explore the capabilities of Hot Dog Writing, consider how these tools can streamline your workflow and elevate your user experience. Start integrating the Cognitive Actions today and unlock the potential of custom image generation!