Kandinsky 2 Image Generation

kandinsky-2.2

Kandinsky 2 is multilingual text2image latent diffusion model

A100 80GB
Fast Inference
REST API

Model Information

Response Time~6 sec
StatusActive
Version
0.0.1
Updated25 days ago

Prerequisites

  • Create an API Key from the Eachlabs Console
  • Install the required dependencies for your chosen language (e.g., requests for Python)

API Integration Steps

1. Create a Prediction

Send a POST request to create a new prediction. This will return a prediction ID that you'll use to check the result. The request should include your model inputs and API key.

import requests
import time
API_KEY = "YOUR_API_KEY" # Replace with your API key
HEADERS = {
"X-API-Key": API_KEY,
"Content-Type": "application/json"
}
def create_prediction():
response = requests.post(
"https://api.eachlabs.ai/v1/prediction/",
headers=HEADERS,
json={
"model": "kandinsky-2.2",
"version": "0.0.1",
"input": {
"seed": null,
"width": "512",
"height": "512",
"prompt": "A moss covered astronaut with a black background",
"num_outputs": "1",
"output_format": "webp",
"negative_prompt": "your negative prompt here",
"num_inference_steps": "75",
"num_inference_steps_prior": "25"
}
}
)
prediction = response.json()
if prediction["status"] != "success":
raise Exception(f"Prediction failed: {prediction}")
return prediction["predictionID"]

2. Get Prediction Result

Poll the prediction endpoint with the prediction ID until the result is ready. The API uses long-polling, so you'll need to repeatedly check until you receive a success status.

def get_prediction(prediction_id):
while True:
result = requests.get(
f"https://api.eachlabs.ai/v1/prediction/{prediction_id}",
headers=HEADERS
).json()
if result["status"] == "success":
return result
elif result["status"] == "error":
raise Exception(f"Prediction failed: {result}")
time.sleep(1) # Wait before polling again

3. Complete Example

Here's a complete example that puts it all together, including error handling and result processing. This shows how to create a prediction and wait for the result in a production environment.

try:
# Create prediction
prediction_id = create_prediction()
print(f"Prediction created: {prediction_id}")
# Get result
result = get_prediction(prediction_id)
print(f"Output URL: {result['output']}")
print(f"Processing time: {result['metrics']['predict_time']}s")
except Exception as e:
print(f"Error: {e}")

Additional Information

  • The API uses a two-step process: create prediction and poll for results
  • Response time: ~6 seconds
  • Rate limit: 60 requests/minute
  • Concurrent requests: 10 maximum
  • Use long-polling to check prediction status until completion

Overview

Kandinsky 2 Image Generation is a cutting-edge text-to-image model designed to generate high-quality, aesthetically pleasing visuals from text prompts. It combines powerful diffusion algorithms with a user-friendly interface, offering flexibility and precision for diverse creative and professional needs. The model supports advanced features like negative prompts, multi-resolution outputs, and customizable inference settings to cater to specific artistic goals.

Technical Specifications

Model Type: Text-to-image diffusion-based.

Resolution Support: From 384x384 to 2048x2048 pixels.

Key Features:

  • Customizable inference steps for enhanced detail or speed.
  • Negative prompt support to refine results.
  • Seed control for reproducibility.

Key Considerations

Resolution Impact: Higher resolutions result in better detail but increase computational time.

Inference Steps: A higher number of steps produces more detailed images but may slow down generation.

Prompt Sensitivity: Kandinsky 2 Image Generation performs best with clear and descriptive prompts. Avoid overly abstract or vague inputs.

Tips & Tricks

Input Configuration for Best Results for Kandinsky 2 Image Generation:

  1. Prompt:
    • Use descriptive, vivid language to achieve the desired output.
    • Combine artistic styles or references to guide the model.
    • Example: "An oil painting of a futuristic city at sunset"
  2. Negative Prompt:
    • Exclude elements that may disrupt the visual focus or theme.
    • Ideal for removing artifacts or unwanted styles.
  3. Width & Height:
    • Select a resolution based on your use case.
      • Low resolution (e.g., 384x384): Fast results for drafts or previews.
      • Medium resolution (e.g., 512x512): Balance between quality and speed.
      • High resolution (e.g., 1024x1024+): Detailed outputs for professional use.
    • Ensure the aspect ratio matches the intended composition.
  4. Num Inference Steps:
    • Adjust between 50-150 for most scenarios.
    • Higher values (e.g., 300-500) for intricate details or abstract art.
  5. Num Inference Steps Prior:
    • Typically set between 20-100 for a balanced refinement process.
    • Higher values improve detail but may lead to overprocessing.
  6. Seed:
    • Use fixed values for repeatable results.
    • Random values encourage creativity and diverse outputs.

Fine-Tuning Tips for Kandinsky 2 Image Generation:

  • Experiment with combinations of guidance_scale and condition_scale to control the strength of prompt adherence.
  • For complex scenes, break prompts into smaller, sequential descriptions.
  • Use seeds to iterate variations of the same concept efficiently.

Capabilities

Generate artistic visuals across a wide range of themes and styles.

Support for high-resolution outputs up to 2048x2048.

Flexibility to fine-tune the creative process using advanced settings.

What can I use for?

Concept art and design.

Marketing and branding visuals.

Educational and research material.

Personal and professional creative projects.

Things to be aware of

Experiment with Art Styles:

  • Example: "A watercolor painting of a mountain landscape"

Combine Themes:

  • Example: "A futuristic city inspired by 18th-century architecture"

High-Resolution Outputs:

  • Use 1024x1024 or higher for gallery-quality visuals.

Seed Variations:

  • Fix a seed and adjust other parameters to explore variations.

Limitations

Semantic Understanding: The model may misinterpret abstract or ambiguous prompts.

Artifact Presence: High-resolution settings or extreme parameter values may introduce minor artifacts.

Fine Detail Control: While highly capable, the model may not capture every nuance of extremely specific instructions.

Output Format: WEBP,JPEG,PNG

Related AI Models

flux-1.1-pro

Flux 1.1 Pro

flux-1-1-pro

Text to Image
stable-diffusion-3.5-medium

Stable Diffusion 3.5 Medium

stable-diffusion-3-5-medium

Text to Image
imagen-3-fast

Imagen 3 Fast

imagen-3-fast

Text to Image
photon

Photon

photon

Text to Image