AI
Pass

AI Pet Portrait Generator Agent Skill — AI Pass API

AI Pet Portrait Generator Agent Skill — AI Pass API

Skill for: Generating artistic portraits of pets from descriptions or photos API: AI Pass Image Generation + Image Editing Endpoints: /apikey/v1/images/generations and /apikey/v1/chat/completions

Overview

This skill generates beautiful AI art portraits of pets in any artistic style. Supports both text-to-image generation (from description) and image editing (from uploaded photo).

Skill Definition

name: pet-portrait-generator
description: Generates artistic pet portraits from photos or descriptions. Supports oil painting, watercolor, anime, cartoon, Renaissance, and other artistic styles.
version: 1.0.0
auth:
  type: api_key
  env: AIPASS_API_KEY

Implementation

import os
import base64
import requests

AIPASS_API_KEY = os.environ["AIPASS_API_KEY"]
BASE_URL = "https://aipass.one/apikey/v1"

HEADERS = {
    "Authorization": f"Bearer {AIPASS_API_KEY}",
    "Content-Type": "application/json"
}

ART_STYLES = {
    "oil_painting": "oil painting",
    "watercolor": "watercolor painting",
    "anime": "anime art style, cute Japanese illustration",
    "renaissance": "Renaissance oil painting portrait, classical style",
    "cartoon": "cartoon illustration",
    "pencil_sketch": "detailed colored pencil sketch",
    "pixel_art": "pixel art, 16-bit retro game style"
}


def generate_pet_portrait_from_description(
    pet_description: str,
    art_style: str = "oil_painting",
    size: str = "1024x1024"
) -> dict:
    """
    Generate a pet portrait from a text description.
    
    Args:
        pet_description: Description of the pet (breed, color, features)
        art_style: One of the keys in ART_STYLES
        size: Image size (1024x1024, 1024x1792, 1792x1024)
    
    Returns:
        dict with image_url and metadata
    """
    
    style_text = ART_STYLES.get(art_style, art_style)
    
    prompt = (
        f"A stunning {style_text} portrait of {pet_description}. "
        f"Beautiful artistic composition, professional quality, "
        f"dramatic lighting, highly detailed, masterpiece quality {style_text}."
    )
    
    response = requests.post(
        f"{BASE_URL}/images/generations",
        headers=HEADERS,
        json={
            "model": "flux-pro/v1.1",
            "prompt": prompt,
            "size": size,
            "n": 1
        }
    )
    
    result = response.json()
    image_url = result["data"][0]["url"]
    
    return {
        "image_url": image_url,
        "art_style": style_text,
        "pet_description": pet_description,
        "model": "flux-pro/v1.1"
    }


def generate_pet_portrait_from_photo(
    image_path: str,
    art_style: str = "oil_painting",
    pet_type: str = "pet"
) -> dict:
    """
    Transform an existing pet photo into an artistic portrait.
    
    Args:
        image_path: Path to pet image file (jpg, png, webp)
        art_style: One of the keys in ART_STYLES
        pet_type: Type of pet for context (dog, cat, rabbit, etc.)
    
    Returns:
        dict with transformed image URL
    """
    
    style_text = ART_STYLES.get(art_style, art_style)
    
    with open(image_path, "rb") as f:
        b64_image = base64.b64encode(f.read()).decode()
    
    ext = image_path.rsplit(".", 1)[-1].lower()
    mime_map = {"jpg": "image/jpeg", "jpeg": "image/jpeg", "png": "image/png", "webp": "image/webp"}
    mime_type = mime_map.get(ext, "image/jpeg")
    
    response = requests.post(
        f"{BASE_URL}/chat/completions",
        headers=HEADERS,
        json={
            "model": "gemini/gemini-3-pro-image-preview",
            "messages": [{
                "role": "user",
                "content": [
                    {
                        "type": "text",
                        "text": f"Transform this {pet_type} photo into a stunning {style_text} portrait. "
                                f"Maintain the pet's distinctive features, colors, and expression. "
                                f"Make it look like a professional artistic {style_text}. "
                                f"High quality, beautiful artistic composition."
                    },
                    {
                        "type": "image_url",
                        "image_url": {"url": f"data:{mime_type};base64,{b64_image}"}
                    }
                ]
            }]
        }
    )
    
    result = response.json()
    content = result["choices"][0]["message"]["content"]
    
    return {
        "result": content,
        "art_style": style_text,
        "model": "gemini/gemini-3-pro-image-preview"
    }

Usage Examples

# From text description
portrait = generate_pet_portrait_from_description(
    pet_description="a fluffy golden retriever with soulful brown eyes and floppy ears",
    art_style="oil_painting"
)
print(portrait["image_url"])

# From photo
portrait = generate_pet_portrait_from_photo(
    image_path="my_cat.jpg",
    art_style="watercolor",
    pet_type="tabby cat"
)

# Available styles
for style_key, style_name in ART_STYLES.items():
    print(f"{style_key}: {style_name}")

Available Art Styles

Key Style
oil_painting Classic oil painting
watercolor Soft watercolor
anime Japanese anime illustration
renaissance Renaissance portrait
cartoon Cartoon illustration
pencil_sketch Colored pencil sketch
pixel_art Retro pixel art

Get Started

  1. Sign up at aipass.one
  2. Go to Developer DashboardAPI Keys
  3. Set AIPASS_API_KEY in your environment

Try the app: aipass.one/apps/pet-portrait

Related skills: