AI Product Photo Generator Agent Skill - AI Pass API
AI Product Photo Generator Agent Skill - AI Pass API
Add AI-powered product photography to your agent using the AI Pass API. Generate professional e-commerce product images on demand.
Skill Overview
Generate:
- Professional product photos from descriptions
- Multiple product angles and views
- Products in various backgrounds and lighting
- High-resolution images suitable for print
Prerequisites
- Get your API Key: Visit AI Pass Developer Dashboard to get your
$AIPASS_API_KEY - Credits: Get $1 free credit on signup, pay as you go
Skill Implementation
import requests
import os
AIPASS_API_KEY = os.getenv("AIPASS_API_KEY")
AIPASS_BASE_URL = "https://aipass.one"
def generate_product_photo(product_description, background, lighting, angle="front"):
"""
Generate a professional product photo.
Args:
product_description (str): Detailed product description
background (str): Background style
lighting (str): Lighting style
angle (str): Camera angle (front, side, top, angled)
Returns:
str: URL of generated product photo
"""
angle_descriptions = {
'front': 'front view, facing directly at camera',
'side': 'side profile view, 90 degree angle',
'top': 'top-down overhead view',
'angled': 'three-quarter angle view, slightly elevated perspective'
}
prompt = f"Professional product photography: {product_description}. {angle_descriptions[angle]}. Background: {background}. Lighting: {lighting}. High-resolution, studio quality, sharp focus, commercial e-commerce photography."
headers = {"Authorization": f"Bearer {AIPASS_API_KEY}", "Content-Type": "application/json"}
payload = {"model": "flux-pro/v1.1", "prompt": prompt, "n": 1, "size": "1024x1024"}
response = requests.post(f"{AIPASS_BASE_URL}/api/v1/images/generations", headers=headers, json=payload)
if response.status_code == 200:
return response.json()["data"][0]["url"]
else:
raise Exception(f"API Error: {response.status_code} - {response.text}")
def generate_product_gallery(product_description, background, lighting, angles):
"""
Generate multiple product photos from different angles.
Args:
product_description (str): Product description
background (str): Background style
lighting (str): Lighting style
angles (list): List of angles to generate
Returns:
list: List of photo URLs with angle labels
"""
photos = []
for angle in angles:
url = generate_product_photo(product_description, background, lighting, angle)
photos.append({"angle": angle, "url": url})
return photos
def generate_lifestyle_product_photo(product_description, setting):
"""
Generate a product photo in a lifestyle setting.
Args:
product_description (str): Product description
setting (str): Lifestyle setting description
Returns:
str: URL of lifestyle product photo
"""
prompt = f"Professional lifestyle product photography: {product_description} in {setting} setting. Natural lighting, realistic environment, commercial photography style, high-resolution, editorial quality."
headers = {"Authorization": f"Bearer {AIPASS_API_KEY}", "Content-Type": "application/json"}
payload = {"model": "flux-pro/v1.1", "prompt": prompt, "n": 1, "size": "1024x1024"}
response = requests.post(f"{AIPASS_BASE_URL}/api/v1/images/generations", headers=headers, json=payload)
if response.status_code == 200:
return response.json()["data"][0]["url"]
else:
raise Exception(f"API Error: {response.status_code} - {response.text}")
Skill Configuration
skills:
product_photo_generator:
name: "AI Product Photo Generator"
description: "Generate professional product photography"
version: "1.0.0"
api_key_env: "AIPASS_API_KEY"
functions:
- generate_product_photo
- generate_product_gallery
- generate_lifestyle_product_photo
Usage Examples
Single Product Photo
photo = generate_product_photo(
product_description="sleek matte black wireless earbuds with blue LED indicator",
background="clean white studio background",
lighting="soft studio lighting from left side",
angle="front"
)
print(f"Product photo: {photo}")
Multiple Angles
gallery = generate_product_gallery(
product_description="premium leather wallet in dark brown",
background="light gray gradient background",
lighting="bright overhead lighting",
angles=["front", "side", "top", "angled"]
)
for photo in gallery:
print(f"{photo['angle']}: {photo['url']}")
Lifestyle Shot
lifestyle = generate_lifestyle_product_photo(
product_description="stainless steel water bottle",
setting="modern office desk with laptop and notebook"
)
print(f"Lifestyle photo: {lifestyle}")
API Reference
Endpoint: POST /api/v1/images/generations
{
"model": "flux-pro/v1.1",
"prompt": "product photography prompt",
"n": 1,
"size": "1024x1024"
}
Get Your API Key
Visit the AI Pass Developer Dashboard.
Live Demo
Try the AI Product Photo Generator.