Create Stunning Images with the asiryan/meina-mix-v11 Cognitive Actions

23 Apr 2025
Create Stunning Images with the asiryan/meina-mix-v11 Cognitive Actions

In today's digital landscape, the ability to generate high-quality images programmatically can greatly enhance applications across various domains, from gaming to marketing. The asiryan/meina-mix-v11 API offers powerful Cognitive Actions that facilitate this image generation through functionalities like Text2Img, Img2Img, and Inpainting. With customizable parameters, developers can harness these pre-built actions to create unique images tailored to their needs.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of how to make HTTP requests in your programming language of choice.

Authentication generally involves passing the API key in the headers of your requests, ensuring that you have the necessary permissions to execute the actions.

Cognitive Actions Overview

Generate Image with Meina Mix V11

The Generate Image with Meina Mix V11 action allows users to create images using the Meina Mix V11 Model. This action supports three main functionalities: Text2Img, Img2Img, and Inpainting, giving developers the flexibility to generate images based on text prompts, modify existing images, or fill in areas of images.

Input

The input for this action consists of several parameters that can be customized:

{
  "mask": "string (optional, URI for inpainting)",
  "seed": "integer (optional, for randomization)",
  "image": "string (optional, URI for img2img and inpainting)",
  "width": "integer (default: 512, min: 0, max: 1920)",
  "height": "integer (default: 728, min: 0, max: 1920)",
  "prompt": "string (required, guides the generation)",
  "strength": "number (default: 1, range: 0 to 1)",
  "scheduler": "string (default: 'K_EULER_ANCESTRAL')",
  "guidanceScale": "number (default: 7.5, range: 0 to 10)",
  "negativePrompt": "string (optional, what to avoid in generation)",
  "useKarrasSigmas": "boolean (default: false)",
  "numInferenceSteps": "integer (default: 20, range: 0 to 100)"
}

Here’s an example of a JSON payload for the input:

{
  "width": 512,
  "height": 728,
  "prompt": "(masterpiece, sidelighting, finely detailed beautiful eyes: 1.2), masterpiece*portrait, realistic, 3d face, glowing eyes, shiny hair, lustrous skin, solo, embarassed, (midriff)",
  "strength": 1,
  "scheduler": "K_EULER_ANCESTRAL",
  "guidanceScale": 7.5,
  "negativePrompt": "(worst quality:1.6, low quality:1.6), (zombie, sketch, interlocked fingers, comic)",
  "useKarrasSigmas": false,
  "numInferenceSteps": 20
}

Output

The output of this action will typically return a URL linking to the generated image. Here’s an example of a successful output response:

https://assets.cognitiveactions.com/invocations/b69e70b9-c342-41b0-a20f-c6cd2f6109b5/8000bcd5-44f5-4fd4-890f-04068d7919cc.png

Conceptual Usage Example (Python)

Here's how you might call this 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 = "7f72c30e-3121-4181-aaca-8a5b42b97783"  # Action ID for Generate Image with Meina Mix V11

# Construct the input payload based on the action's requirements
payload = {
    "width": 512,
    "height": 728,
    "prompt": "(masterpiece, sidelighting, finely detailed beautiful eyes: 1.2), masterpiece*portrait, realistic, 3d face, glowing eyes, shiny hair, lustrous skin, solo, embarassed, (midriff)",
    "strength": 1,
    "scheduler": "K_EULER_ANCESTRAL",
    "guidanceScale": 7.5,
    "negativePrompt": "(worst quality:1.6, low quality:1.6), (zombie, sketch, interlocked fingers, comic)",
    "useKarrasSigmas": False,
    "numInferenceSteps": 20
}

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 the placeholder API key and endpoint with your actual credentials. The action ID and input payload are structured according to the specifications, allowing you to generate images efficiently.

Conclusion

The asiryan/meina-mix-v11 Cognitive Actions provide a powerful way to generate stunning images tailored to your application's needs. By integrating the Generate Image with Meina Mix V11 action, developers can leverage advanced image generation capabilities without needing deep expertise in machine learning. Explore the possibilities and consider how these actions can enhance your projects, whether in creative arts, marketing materials, or app development.