AI
Pass

AI Ghibli Filter Agent Skill — Transform Images in Any Workflow

AI Ghibli Filter Agent Skill

Transform any image into Studio Ghibli-style artwork via the AI Pass API. Use this skill when an agent workflow needs to apply Ghibli-style image transformation.

Skill Overview

  • Input: Image URL or base64-encoded image
  • Output: Ghibli-style transformed image URL
  • Model: gemini/gemini-3-pro-image-preview via AI Pass
  • Auth: $AIPASS_API_KEY environment variable

Skill File

name: ghibli-filter
description: Transform images into Studio Ghibli anime art style using AI Pass API
parameters:
  image_url:
    type: string
    description: URL of the image to transform (must be publicly accessible)
  style_prompt:
    type: string
    description: Additional style instructions (optional)
    default: ""
returns:
  type: string
  description: URL of the Ghibli-style transformed image

Implementation

Python

import requests
import base64
import os
from io import BytesIO

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

def apply_ghibli_filter(image_url: str, style_prompt: str = "") -> str:
    """
    Transform an image into Studio Ghibli art style.
    
    Args:
        image_url: URL of the source image
        style_prompt: Additional style guidance (optional)
    
    Returns:
        URL of the Ghibli-transformed image
    """
    # Download the image and convert to base64
    img_response = requests.get(image_url, timeout=30)
    img_response.raise_for_status()
    
    # Detect content type
    content_type = img_response.headers.get('Content-Type', 'image/jpeg')
    if 'png' in content_type:
        mime = 'image/png'
    elif 'webp' in content_type:
        mime = 'image/webp'
    else:
        mime = 'image/jpeg'
    
    b64_image = base64.b64encode(img_response.content).decode('utf-8')
    
    # Build the transformation prompt
    base_prompt = (
        "Transform this photo into Studio Ghibli anime art style. "
        "Make it look like a scene from a Hayao Miyazaki film — warm colors, "
        "hand-painted feel, soft natural lighting, lush organic environments, "
        "and the characteristic Ghibli aesthetic with expressive detail. "
        "Preserve the main subject and composition but fully reimagine in Ghibli style."
    )
    
    full_prompt = f"{base_prompt} {style_prompt}".strip()
    
    # Call AI Pass image editing endpoint
    response = requests.post(
        f"{BASE_URL}/chat/completions",
        headers={
            "Authorization": f"Bearer {AIPASS_API_KEY}",
            "Content-Type": "application/json"
        },
        json={
            "model": "gemini/gemini-3-pro-image-preview",
            "messages": [{
                "role": "user",
                "content": [
                    {"type": "text", "text": full_prompt},
                    {
                        "type": "image_url",
                        "image_url": {"url": f"data:{mime};base64,{b64_image}"}
                    }
                ]
            }]
        },
        timeout=60
    )
    
    result = response.json()
    content = result["choices"][0]["message"]["content"]
    
    # Extract image URL from the markdown response
    import re
    img_match = re.search(
        r'!\[.*?\]\((https?://[^)]+)\)|((https?://[^\s]+\.(?:png|jpg|jpeg|webp)))',
        content, re.IGNORECASE
    )
    
    if img_match:
        return img_match.group(1) or img_match.group(2)
    
    # Return raw content if no URL pattern found (may be base64 inline)
    return content


# Example usage
if __name__ == "__main__":
    result_url = apply_ghibli_filter(
        image_url="https://example.com/my-photo.jpg",
        style_prompt="make it look like a forest spirit realm"
    )
    print(f"Transformed image: {result_url}")

Bash

#!/bin/bash
# Apply Ghibli filter to an image via AI Pass API

IMAGE_URL="$1"
API_KEY="$AIPASS_API_KEY"

# Download and encode image
B64=$(curl -s "$IMAGE_URL" | base64 -w0)

# Apply transformation
curl -s -X POST https://aipass.one/apikey/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"gemini/gemini-3-pro-image-preview\",
    \"messages\": [{
      \"role\": \"user\",
      \"content\": [
        {\"type\": \"text\", \"text\": \"Transform this photo into Studio Ghibli anime art style with warm colors, hand-painted feel, and the characteristic Miyazaki aesthetic.\"},
        {\"type\": \"image_url\", \"image_url\": {\"url\": \"data:image/jpeg;base64,$B64\"}}
      ]
    }]
  }" | python3 -c "import json,sys; r=json.load(sys.stdin); print(r['choices'][0]['message']['content'])"

Agent Integration Example

Here is how to integrate this skill into an agent workflow:

# Example: Agent that receives a photo URL and returns a Ghibli version

def process_user_request(user_message: str, image_url: str = None) -> dict:
    """
    Example agent handler that applies Ghibli filter when image is provided.
    """
    if image_url:
        ghibli_url = apply_ghibli_filter(image_url)
        return {
            "type": "image",
            "url": ghibli_url,
            "caption": "Your photo, reimagined in Studio Ghibli style!"
        }
    return {"type": "text", "content": "Please provide an image URL to transform."}

API Details

  • Endpoint: POST https://aipass.one/apikey/v1/chat/completions
  • Model: gemini/gemini-3-pro-image-preview
  • Auth: Bearer token via $AIPASS_API_KEY
  • Get API Key: AI Pass Developer Dashboard → API Keys
  • Pricing: Pay-as-you-go, see dashboard for current rates

Notes for Agents

  • Images must be < 20MB for reliable processing
  • Response time is typically 15–45 seconds for image editing
  • The model returns a URL to the transformed image hosted on Google's infrastructure
  • For high-volume workflows, implement retry logic with exponential backoff
  • Rate limits apply — check your API dashboard for current quotas

Try It Live

See this skill in action: aipass.one/apps/ghibli-filter

Get your API key: aipass.one/panel/developer.html