Generate Stunning High-Resolution Images with FLUX1.1 Pro Cognitive Actions

23 Apr 2025
Generate Stunning High-Resolution Images with FLUX1.1 Pro Cognitive Actions

In the ever-evolving world of digital content creation, visual appeal plays a crucial role. The FLUX1.1 Pro Cognitive Actions offer powerful capabilities for generating high-resolution images, enabling developers to enhance their applications with stunning visual content. Whether you need images for marketing, storytelling, or creative projects, these pre-built actions simplify the process, allowing you to focus on your application's core functionality rather than the intricacies of image generation.

Prerequisites

Before you can start using the FLUX1.1 Pro Cognitive Actions, ensure you have the following:

  • API Key: You will need a valid API key to authenticate your requests to the Cognitive Actions platform. This key should be passed as a Bearer token in the headers of your API requests.
  • Basic Understanding of JSON: Familiarity with JSON format is essential, as the input and output of the actions will be structured in this format.

Cognitive Actions Overview

Generate High-Resolution Images with FLUX1.1 Pro

Description:
This action allows you to generate high-resolution images up to 4 megapixels using FLUX1.1 in both ultra and raw modes. Ultra mode provides images with 4x higher resolution without compromising speed, while raw mode enhances realism and diversity, making it ideal for photography enthusiasts.

Category: Image Generation

Input

The input for this action must adhere to the following schema:

  • Required Fields:
    • prompt: A text string that describes the image you want to generate. (Example: "a majestic snow-capped mountain peak bathed in a warm glow of the setting sun")
  • Optional Fields:
    • raw: Specifies whether to generate images with minimal processing for a more natural appearance. (Default: false)
    • seed: An integer used as the random seed for deterministic generations.
    • aspectRatio: The aspect ratio for the generated image. (Default: "1:1")
    • imagePrompt: A URI pointing to an image used as a visual guide alongside the text prompt.
    • outputFormat: The file format of the output images. (Options: "jpg", "png"; Default: "jpg")
    • safetyTolerance: Sets the level of safety filtering, where 1 is the most strict and 6 the most relaxed. (Default: 2)
    • imagePromptStrength: Determines how much influence the image prompt has on the generation process, ranging from 0 to 1. (Default: 0.1)

Example Input:

{
  "raw": false,
  "prompt": "a majestic snow-capped mountain peak bathed in a warm glow of the setting sun",
  "aspectRatio": "3:2",
  "outputFormat": "jpg",
  "safetyTolerance": 2,
  "imagePromptStrength": 0.1
}

Output

The action typically returns a URL pointing to the generated image. For instance:

"https://assets.cognitiveactions.com/invocations/6b5f3dee-3715-495e-b116-59d662d7722e/c3206d2b-cc77-4ec6-9d79-90f342e6ccff.jpg"

Conceptual Usage Example (Python): Here’s how you might use the FLUX1.1 Pro action in a Python application:

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 = "100447d4-af00-444e-92bf-413486382cc6"  # Action ID for Generate High-Resolution Images with FLUX1.1 Pro

# Construct the input payload based on the action's requirements
payload = {
    "raw": False,
    "prompt": "a majestic snow-capped mountain peak bathed in a warm glow of the setting sun",
    "aspectRatio": "3:2",
    "outputFormat": "jpg",
    "safetyTolerance": 2,
    "imagePromptStrength": 0.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 example, you replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key and specify the endpoint URL. The action_id is set to the corresponding ID for generating high-resolution images. The input payload is structured according to the action's requirements, ready to be sent in the API request.

Conclusion

The FLUX1.1 Pro Cognitive Actions provide a powerful way to integrate high-quality image generation into your applications. With customizable inputs and flexible output formats, these actions can significantly enhance user experiences and streamline creative workflows. Explore potential use cases, such as dynamic content creation, personalized marketing materials, or even artistic projects, and start integrating these capabilities into your applications today!