generate_mannequin
Generate realistic AI mannequin photos for clothing and accessories using a product image. Describe the desired model and background to create e-commerce product listings.
Instructions
Generate an AI mannequin / model photo for products.
Upload a product image (clothing, accessory) and the AI will generate a realistic mannequin/model wearing or displaying it. Great for e-commerce product listings. Cost: ~6 credits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the desired mannequin/model (e.g., "young woman, studio lighting", "male model, outdoor setting") | |
| image_url | Yes | URL of the product image |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/yaparai/tools/ecommerce.py:47-83 (handler)The core handler function for the generate_mannequin tool. It accepts prompt and image_url parameters, calls the YaparAIClient.generate() with mode='manken_uret' (Turkish for 'mannequin generate'), polls for the result via wait_for_result(), and returns a dict with image_url, job_id, credits_used, and balance_remaining.
async def generate_mannequin( prompt: str, image_url: str, ) -> dict: """ Generate an AI mannequin / model photo for products. Upload a product image (clothing, accessory) and the AI will generate a realistic mannequin/model wearing or displaying it. Great for e-commerce product listings. Cost: ~6 credits. Args: prompt: Description of the desired mannequin/model (e.g., "young woman, studio lighting", "male model, outdoor setting") image_url: URL of the product image Returns: Dict with image_url (mannequin image), job_id, credits_used, and balance_remaining. """ client = YaparAIClient() job = await client.generate({ "type": "image", "mode": "manken_uret", "prompt": prompt, "image_url": image_url, }) result = await client.wait_for_result(job["job_id"], timeout=90) return { "status": "success", "image_url": result.get("result_url"), "job_id": result.get("job_id"), "credits_used": job.get("credits_used"), "balance_remaining": job.get("balance_remaining"), } - src/yaparai/tools/ecommerce.py:51-66 (schema)The docstring for generate_mannequin serves as the input/output schema definition. It documents prompt (description of mannequin/model) and image_url (product image URL) as inputs, and the returned dict fields.
""" Generate an AI mannequin / model photo for products. Upload a product image (clothing, accessory) and the AI will generate a realistic mannequin/model wearing or displaying it. Great for e-commerce product listings. Cost: ~6 credits. Args: prompt: Description of the desired mannequin/model (e.g., "young woman, studio lighting", "male model, outdoor setting") image_url: URL of the product image Returns: Dict with image_url (mannequin image), job_id, credits_used, and balance_remaining. - src/yaparai/server.py:135-135 (registration)Registration of generate_mannequin as an MCP tool on the FastMCP server instance via mcp.tool(generate_mannequin).
mcp.tool(generate_mannequin) - src/yaparai/server.py:41-41 (registration)Import of generate_mannequin from the ecommerce module into the server, enabling it to be registered as an MCP tool.
generate_mannequin, - src/yaparai/client.py:126-163 (helper)The YaparAIClient.generate() and YaparAIClient.wait_for_result() helper methods used by generate_mannequin to make the API call and poll for results.
async def generate(self, request: dict) -> dict: """Start a generation job.""" return await self._request("POST", "/v1/public/generate", json=request) async def get_job(self, job_id: str) -> dict: """Get job status and result.""" return await self._request("GET", f"/v1/public/jobs/{job_id}") async def get_balance(self) -> dict: """Get credit balance.""" return await self._request("GET", "/v1/public/balance") async def get_models(self) -> dict: """List available models and their credit costs.""" return await self._request("GET", "/v1/public/models") async def wait_for_result( self, job_id: str, timeout: int = 120, poll_interval: int = 3, ) -> dict: """Poll job status until completed or timeout.""" elapsed = 0 while elapsed < timeout: job = await self.get_job(job_id) status = job.get("status", "") if status == "succeeded": return job if status == "failed": error = job.get("error_message") or job.get("error") or "Unknown error" raise RuntimeError(f"Generation failed: {error}") await asyncio.sleep(poll_interval) elapsed += poll_interval raise TimeoutError( f"Job {job_id} is still processing after {timeout}s. " f"Use get_job_status('{job_id}') to check later." )