jpskill.com
🎨 画像AI コミュニティ

fal-ai

fal.aiを活用し、画像生成や動画・音声処理、大規模な機械学習推論、最先端の生成モデルへのアクセスをAPI経由で実現し、AIメディア機能を迅速に構築するSkill。

📜 元の英語説明(参考)

Deploy and run AI models instantly with fal.ai — image generation, video, audio, and custom models. Use when generating images with Flux/SDXL/LoRA, running ML inference at scale, building AI media features, or accessing state-of-the-art generative models via a simple API.

🇯🇵 日本人クリエイター向け解説

一言でいうと

fal.aiを活用し、画像生成や動画・音声処理、大規模な機械学習推論、最先端の生成モデルへのアクセスをAPI経由で実現し、AIメディア機能を迅速に構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o fal-ai.zip https://jpskill.com/download/14886.zip && unzip -o fal-ai.zip && rm fal-ai.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14886.zip -OutFile "$d\fal-ai.zip"; Expand-Archive "$d\fal-ai.zip" -DestinationPath $d -Force; ri "$d\fal-ai.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して fal-ai.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → fal-ai フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

fal.ai

概要

fal.ai は、AIモデルのためのインスタントなサーバーレス推論を提供します。GPUのプロビジョニングやコンテナは不要で、推論ごとに料金が発生します。APIはシンプルで、モデルIDを選択し、入力を渡し、出力を取得します。Webhookによる非同期ジョブ、リアルタイムストリーミング、ファイルアップロードをサポートしています。Flux画像生成、動画生成、オーディオモデルに最適です。

インストール

npm install @fal-ai/client    # JavaScript/TypeScript
pip install fal-client         # Python

認証

export FAL_KEY="your-api-key"  # fal.ai/dashboard から取得

クイックスタート

TypeScript

import * as fal from "@fal-ai/client";

// 設定 (デフォルトで環境変数 FAL_KEY を読み込みます)
fal.config({ credentials: process.env.FAL_KEY });

// Flux Schnell (最速) で画像を生成
const result = await fal.subscribe("fal-ai/flux/schnell", {
  input: {
    prompt: "夜の未来都市、ネオンライト、サイバーパンクスタイル",
    image_size: "landscape_4_3",
    num_images: 1,
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      console.log(update.logs?.map(l => l.message).join("\n"));
    }
  },
});

console.log(result.data.images[0].url);

Python

import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
            print(log["message"])

result = fal_client.subscribe(
    "fal-ai/flux/schnell",
    arguments={
        "prompt": "夜の未来都市、ネオンライト、サイバーパンクスタイル",
        "image_size": "landscape_4_3",
        "num_images": 1,
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)

print(result["images"][0]["url"])

人気のモデル

Flux 画像生成

// Flux Pro — 最高品質
const pro = await fal.subscribe("fal-ai/flux-pro", {
  input: {
    prompt: "ロボットシェフのポートレート、フォトリアリスティック、ソフトな照明",
    image_size: "portrait_4_3",   // landscape_4_3, square, square_hd
    num_inference_steps: 28,
    guidance_scale: 3.5,
    num_images: 1,
    safety_tolerance: "2",        // 1-6, 大きいほど寛容
  }
});

// Flux Dev — 高品質、Proより高速
const dev = await fal.subscribe("fal-ai/flux/dev", {
  input: {
    prompt: "...",
    num_inference_steps: 28,
    seed: 42,  // 再現性のために
  }
});

// Flux Schnell — 最速、高品質
const schnell = await fal.subscribe("fal-ai/flux/schnell", {
  input: { prompt: "...", num_inference_steps: 4 }  // 4ステップのみ必要
});

// LoRA を使用した Flux
const lora = await fal.subscribe("fal-ai/flux-lora", {
  input: {
    prompt: "タキシードを着た TOK の写真",
    loras: [
      {
        path: "https://huggingface.co/your-lora/model.safetensors",
        scale: 1.0
      }
    ],
    num_inference_steps: 28,
  }
});

Image-to-Image

const result = await fal.subscribe("fal-ai/flux/dev/image-to-image", {
  input: {
    prompt: "油絵スタイルに変換",
    image_url: "https://example.com/photo.jpg",
    strength: 0.85,  // 0-1, 変換の度合い (1 = 元の画像を無視)
    num_inference_steps: 28,
  }
});

動画生成

// AnimateDiff — 静止画をアニメーション化
const video = await fal.subscribe("fal-ai/animatediff-v2v", {
  input: {
    image_url: "https://example.com/frame.jpg",
    prompt: "木々を通り抜ける穏やかなそよ風",
    num_frames: 16,
    fps: 8,
  }
});
console.log(video.data.video.url);  // .mp4 URL

// Runway スタイルの動画生成
const runway = await fal.subscribe("fal-ai/kling-video/v1/standard/image-to-video", {
  input: {
    image_url: "https://example.com/start.jpg",
    prompt: "カメラがゆっくりと右にパン",
    duration: "5",
  }
});

オーディオ — Whisper 文字起こし

// 最初にオーディオファイルをアップロード
const audioUrl = await fal.storage.upload(fs.readFileSync("audio.mp3"), "audio.mp3");

const transcript = await fal.subscribe("fal-ai/whisper", {
  input: {
    audio_url: audioUrl,
    task: "transcribe",  // または "translate" (英語に翻訳)
    language: "en",      // オプション、省略した場合は自動検出
    chunk_level: "segment",
    version: "3",
  }
});

console.log(transcript.data.text);

MusicGen

result = fal_client.subscribe(
    "fal-ai/musicgen",
    arguments={
        "prompt": "テック製品デモのためのアップビートなエレクトロニック音楽、120 BPM",
        "duration": 30,   # 秒
        "top_k": 250,
        "top_p": 0.0,
        "temperature": 1.0,
    }
)
print(result["audio"]["url"])

Webhook を使用した非同期ジョブ

長時間実行されるジョブの場合は、subscribe の代わりに submit → poll を使用します。

// ジョブを送信 (すぐに戻ります)
const { request_id } = await fal.queue.submit("fal-ai/flux-pro", {
  input: { prompt: "..." },
  webhookUrl: "https://your-app.com/webhooks/fal",  // オプション
});

// 結果をポーリング
const checkStatus = async () => {
  const status = await fal.queue.status("fal-ai/flux-pro", {
    requestId: request_id,
    logs: true,
  });

  if (status.status === "COMPLETED") {
    const result = await fal.queue.result("fal-ai/flux-pro", {
      requestId: request_id,
    });
    return result.data;
  }

  if (status.status === "FAILED") {
    throw new Error(`ジョブが失敗しました: ${status.error}`);
  }

  // まだキューにあるので、2秒後に再度確認
  await new Promise(r => setTimeout(r, 2000));
  return checkStatus();
};

const result = await checkStatus();

Webhook ハンドラー (Next.js)

// app/api/webhooks/fal/route.ts
export async function POST(req: Request) {
  const payload = await req.json();

  if (payload.status === "OK") {
    const imageUrl = payload.payload.images[0].url;
    await db.update({ requestId: payload.request_id, imageUrl, status: "done" });
  } else {
    await db.update({ requestId: payload.request_id, status: "failed" });
  }

  return Response.json({ ok: true });
}

ファイルアップロード


import * as fal from "@fal-ai/client";
import * as fs from "fs";

// アップロード

(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

fal.ai

Overview

fal.ai provides instant serverless inference for AI models — no GPU provisioning, no containers, pay per inference. The API is simple: pick a model ID, pass inputs, get outputs. Supports async jobs with webhooks, real-time streaming, and file uploads. Best-in-class for Flux image generation, video generation, and audio models.

Install

npm install @fal-ai/client    # JavaScript/TypeScript
pip install fal-client         # Python

Authentication

export FAL_KEY="your-api-key"  # Get from fal.ai/dashboard

Quick Start

TypeScript

import * as fal from "@fal-ai/client";

// Configure (reads FAL_KEY from env by default)
fal.config({ credentials: process.env.FAL_KEY });

// Generate an image with Flux Schnell (fastest)
const result = await fal.subscribe("fal-ai/flux/schnell", {
  input: {
    prompt: "A futuristic city at night, neon lights, cyberpunk style",
    image_size: "landscape_4_3",
    num_images: 1,
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      console.log(update.logs?.map(l => l.message).join("\n"));
    }
  },
});

console.log(result.data.images[0].url);

Python

import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
            print(log["message"])

result = fal_client.subscribe(
    "fal-ai/flux/schnell",
    arguments={
        "prompt": "A futuristic city at night, neon lights, cyberpunk style",
        "image_size": "landscape_4_3",
        "num_images": 1,
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)

print(result["images"][0]["url"])

Popular Models

Flux Image Generation

// Flux Pro — highest quality
const pro = await fal.subscribe("fal-ai/flux-pro", {
  input: {
    prompt: "Portrait of a robot chef, photorealistic, soft lighting",
    image_size: "portrait_4_3",   // landscape_4_3, square, square_hd
    num_inference_steps: 28,
    guidance_scale: 3.5,
    num_images: 1,
    safety_tolerance: "2",        // 1-6, higher = more permissive
  }
});

// Flux Dev — high quality, faster than Pro
const dev = await fal.subscribe("fal-ai/flux/dev", {
  input: {
    prompt: "...",
    num_inference_steps: 28,
    seed: 42,  // For reproducibility
  }
});

// Flux Schnell — fastest, good quality
const schnell = await fal.subscribe("fal-ai/flux/schnell", {
  input: { prompt: "...", num_inference_steps: 4 }  // Only needs 4 steps
});

// Flux with LoRA
const lora = await fal.subscribe("fal-ai/flux-lora", {
  input: {
    prompt: "A photo of TOK wearing a tuxedo",
    loras: [
      {
        path: "https://huggingface.co/your-lora/model.safetensors",
        scale: 1.0
      }
    ],
    num_inference_steps: 28,
  }
});

Image-to-Image

const result = await fal.subscribe("fal-ai/flux/dev/image-to-image", {
  input: {
    prompt: "Transform into oil painting style",
    image_url: "https://example.com/photo.jpg",
    strength: 0.85,  // 0-1, how much to transform (1 = ignore original)
    num_inference_steps: 28,
  }
});

Video Generation

// AnimateDiff — animate a still image
const video = await fal.subscribe("fal-ai/animatediff-v2v", {
  input: {
    image_url: "https://example.com/frame.jpg",
    prompt: "Gentle breeze moving through the trees",
    num_frames: 16,
    fps: 8,
  }
});
console.log(video.data.video.url);  // .mp4 URL

// Runway-style video gen
const runway = await fal.subscribe("fal-ai/kling-video/v1/standard/image-to-video", {
  input: {
    image_url: "https://example.com/start.jpg",
    prompt: "Camera slowly pans right",
    duration: "5",
  }
});

Audio — Whisper Transcription

// Upload audio file first
const audioUrl = await fal.storage.upload(fs.readFileSync("audio.mp3"), "audio.mp3");

const transcript = await fal.subscribe("fal-ai/whisper", {
  input: {
    audio_url: audioUrl,
    task: "transcribe",  // or "translate" (to English)
    language: "en",      // Optional, auto-detected if omitted
    chunk_level: "segment",
    version: "3",
  }
});

console.log(transcript.data.text);

MusicGen

result = fal_client.subscribe(
    "fal-ai/musicgen",
    arguments={
        "prompt": "Upbeat electronic music for a tech product demo, 120 BPM",
        "duration": 30,   # seconds
        "top_k": 250,
        "top_p": 0.0,
        "temperature": 1.0,
    }
)
print(result["audio"]["url"])

Async Jobs with Webhooks

For long-running jobs, use submit → poll instead of subscribe:

// Submit job (returns immediately)
const { request_id } = await fal.queue.submit("fal-ai/flux-pro", {
  input: { prompt: "..." },
  webhookUrl: "https://your-app.com/webhooks/fal",  // Optional
});

// Poll for result
const checkStatus = async () => {
  const status = await fal.queue.status("fal-ai/flux-pro", {
    requestId: request_id,
    logs: true,
  });

  if (status.status === "COMPLETED") {
    const result = await fal.queue.result("fal-ai/flux-pro", {
      requestId: request_id,
    });
    return result.data;
  }

  if (status.status === "FAILED") {
    throw new Error(`Job failed: ${status.error}`);
  }

  // Still in queue, check again in 2s
  await new Promise(r => setTimeout(r, 2000));
  return checkStatus();
};

const result = await checkStatus();

Webhook Handler (Next.js)

// app/api/webhooks/fal/route.ts
export async function POST(req: Request) {
  const payload = await req.json();

  if (payload.status === "OK") {
    const imageUrl = payload.payload.images[0].url;
    await db.update({ requestId: payload.request_id, imageUrl, status: "done" });
  } else {
    await db.update({ requestId: payload.request_id, status: "failed" });
  }

  return Response.json({ ok: true });
}

File Uploads

import * as fal from "@fal-ai/client";
import * as fs from "fs";

// Upload a file to fal.ai storage
const fileBuffer = fs.readFileSync("my-image.jpg");
const url = await fal.storage.upload(fileBuffer, "image.jpg");
// Returns: "https://fal.run/files/..."

// Use uploaded URL as model input
const result = await fal.subscribe("fal-ai/flux/dev/image-to-image", {
  input: { image_url: url, prompt: "..." }
});
# Python file upload
import fal_client

url = fal_client.upload_file("./photo.png")
print(url)  # https://fal.run/files/...

Batch Processing

async function generateBatch(prompts: string[]): Promise<string[]> {
  // Submit all jobs in parallel
  const jobs = await Promise.all(
    prompts.map(prompt =>
      fal.queue.submit("fal-ai/flux/schnell", {
        input: { prompt, num_images: 1 }
      })
    )
  );

  // Poll all results
  const results = await Promise.all(
    jobs.map(({ request_id }) =>
      fal.queue.result("fal-ai/flux/schnell", { requestId: request_id })
    )
  );

  return results.map(r => r.data.images[0].url);
}

const urls = await generateBatch([
  "A red sports car",
  "A blue mountain lake",
  "A golden sunset over the ocean",
]);

Guidelines

  • Use fal.subscribe() for synchronous workflows (waits for completion, handles polling internally)
  • Use fal.queue.submit() + webhooks for production async pipelines
  • Flux Schnell is fastest (4 steps, ~2s); use for prototyping and bulk generation
  • Flux Pro gives highest quality; use for final production images
  • Always handle onQueueUpdate for user-facing apps to show progress
  • Uploaded files are stored temporarily — download and persist to your own storage if needed
  • Rate limits apply per API key; for high volume use the queue API to avoid timeouts
  • Check fal.ai/models for the full list of available models (100+)