Input
Configure model parameters
Output
View generated results
Result
Preview, share or download your results with a single click.
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 requestsimport timeAPI_KEY = "YOUR_API_KEY" # Replace with your API keyHEADERS = {"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": "hailuo-image","version": "0.0.1","input": {"model": "image-01","prompt_optimizer": false,"n": 1,"aspect_ratio": "1:1","prompt": "your prompt here"},"webhook_url": ""})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 resultelif 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 predictionprediction_id = create_prediction()print(f"Prediction created: {prediction_id}")# Get resultresult = 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: -
- Rate limit: 60 requests/minute
- Concurrent requests: 10 maximum
- Use long-polling to check prediction status until completion
Overview
The Hailuo Image Model is an advanced image generation model that converts detailed textual descriptions into high-quality visual representations. Leveraging the latest developments in AI and machine learning, this model can generate highly accurate and contextually relevant images based on the prompts provided by the user. It's designed to be intuitive and flexible, making it ideal for a wide range of creative uses.
Technical Specifications
Image Generation Process: The model interprets the textual input and generates images by learning patterns and correlations from vast datasets of images and descriptions.
Output Quality: The model produces high-resolution images with fine details, lighting, and depth, ensuring visual realism or artistic interpretation, depending on the prompt.
Style & Flexibility: The model can adapt to different artistic styles, from photorealism to more abstract or surreal representations.
Key Considerations
- Prompt Length: Too short prompts may produce vague images, while overly complex ones may lead to inconsistencies.
- Aspect Ratio Impact: The model adjusts framing and composition based on the selected ratio.
- Generation Time: Higher resolution images or may take longer to process.
- Variability: The same prompt may yield slightly different results in each generation.
- Limitations: Extremely abstract or highly detailed requests may not always be perfectly rendered.
Tips & Tricks
Optimizing Inputs for Best Results
1. Prompt (Text-Based Input)
- Be Descriptive: Include details about subject, lighting, colors, mood, and background.
- Use Structured Prompts:
- Main Subject: "A futuristic city skyline"
- Setting: "during sunset, with neon lights reflecting on glass buildings"
- Style: "in a cyberpunk aesthetic"
- Additional Details: "flying cars in the distance, soft fog covering the streets"
- Avoid Conflicting Instructions: Do not overload with too many unrelated elements.
- Refine Using Prompt Optimizer: Enabling this can improve clarity and coherence.
2. Aspect Ratio Selection
- 1:1 (Square): Ideal for profile pictures, social media, and balanced compositions.
- 16:9 (Widescreen): Best for cinematic scenes, YouTube thumbnails, and wallpapers.
- 4:3 (Classic TV Format): Suitable for traditional presentations and printed media.
- 3:2 (DSLR Standard): Works well for general photography and prints.
- 2:3 & 3:4 (Portrait Mode): Best for character-focused images and book covers.
- 9:16 (Vertical Video Format): Optimized for Instagram Reels, TikTok, and mobile screens.
- 21:9 (Ultra-Wide Cinema): Great for panoramic landscapes and movie-like visuals.
3. Prompt Optimizer
- Enable for Clarity: Helps refine vague or ambiguous prompts.
- Disable for Full Control: Keeps the input exactly as written, useful for precise compositions.
Capabilities
- Generates images in different aspect ratios
- Supports varied artistic styles based on input prompts
- Produces single or multiple image outputs per request
- Optionally enhances prompts for improved results
What can I use for?
- Creative Content Generation: Concept art, digital paintings, and illustrations.
- Marketing & Branding: Custom graphics, product visualizations, and advertisements.
- Social Media & Blogging: Eye-catching images for posts, thumbnails, and cover art.
- Storytelling & World-Building: Visualizing characters, settings, and scenes.
- Educational & Research Purposes: Generating visual aids for presentations and studies.
Things to be aware of
- Experiment with different aspect ratios to see how compositions change.
- Use short and direct prompts for minimalistic images, and detailed descriptions for intricate results.
- Enable and disable the prompt optimizer to compare how refinement affects outputs.
- Generate multiple images with slight prompt variations to explore different styles.
Limitations
- Complexity Constraints: Highly intricate or ultra-realistic scenes may not be accurately depicted.
- Text Rendering: The model struggles with generating readable text within images.
- Fine Detail Accuracy: Small elements like facial features or objects in the background may sometimes appear distorted.
- Prompt Sensitivity: Minor wording changes can result in significantly different outputs.
- Subject Consistency: Generating the same character or object across multiple images can be inconsistent.
Output Format: JPEG
Related AI Models
You can seamlessly integrate advanced AI capabilities into your applications without the hassle of managing complex infrastructure.