fal-text-to-image について
fal.aiのモデルでテキストプロンプトから画像を生成するためのリファレンススキルです。開発者向けに、モデルの選択やサイズ、生成パラメーター、LoRAスタイル、バッチ生成の設定を説明します。
主な機能
- 01FLUX、SDXL、特化モデルを比較
- 02プリセットまたは任意の画像サイズを設定
- 03モデル固有の生成パラメーターを指定
- 04FLUXにLoRAスタイルを適用
- 05複数の画像バリエーションを生成
活用シーン
- 01テキストプロンプトから画像を作成
- 02速度や品質に応じてモデルを選択
- 03文字入り画像やベクター風素材を制作
- 04異なるスタイルの画像をまとめて生成
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ josiahsiegel/ claude-plugin-marketplace --skill fal-text-to-imageインストール後、Claude Code で/fal-text-to-imageを入力して読み込まれたか確認します。
詳細
クイックリファレンス
| モデル | エンドポイント | 速度 | 品質 | コスト |
|---|---|---|---|---|
| FLUX.2 Pro | fal-ai/flux-2-pro | 中速 | 最高 | $$$ |
| FLUX.1 Dev | fal-ai/flux/dev | 中速 | 高 | $$ |
| FLUX Schnell | fal-ai/flux/schnell | 高速 | 良好 | $ |
| Fast SDXL | fal-ai/fast-sdxl | 高速 | 良好 | $ |
| 画像サイズ | プリセット | 寸法 |
|---|---|---|
| 正方形 HD | square_hd | 1024x1024 |
| 横長 | landscape_16_9 | 1024x576 |
| 縦長 | portrait_16_9 | 576x1024 |
| カスタム | { width, height } | 任意 |
| パラメーター | FLUX のデフォルト | SDXL のデフォルト |
|---|---|---|
guidance_scale | 3.5 | 7.5 |
num_inference_steps | 28 | 25 |
num_images | 1 | 1 |
このスキルを使う場面
テキストから画像を生成する場合に使用します:
- テキストプロンプトから画像を生成する
- FLUX と SDXL のモデルを選ぶ
- 画像サイズと品質パラメーターを設定する
- LoRA モデルを使用して独自のスタイルを実現する
- 複数の画像を一括生成する
関連スキル:
- 画像編集については、
fal-image-to-imageを参照してください - モデルの比較については、
fal-model-guideを参照してください - API の統合については、
fal-api-referenceを参照してください
fal.ai のテキストから画像を生成するモデル
fal.ai のテキストから画像を生成するすべてのモデルの完全なリファレンスです。
FLUX モデル
FLUX.1 [dev]
エンドポイント: fal-ai/flux/dev
料金: 1 メガピクセルあたり $0.025
最適な用途: 高品質なオープンソース生成
12B パラメーターの FLUX.1 モデルは、オープンソースとして利用でき、優れた品質を提供します。
import { fal } from "@fal-ai/client";
const result = await fal.subscribe("fal-ai/flux/dev", {
input: {
prompt: "A serene Japanese garden with cherry blossoms, koi pond, wooden bridge, soft morning light",
image_size: "landscape_16_9",
num_inference_steps: 28,
guidance_scale: 3.5,
num_images: 1,
seed: 42,
enable_safety_checker: true,
output_format: "jpeg"
}
});
console.log(result.images[0].url);
import fal_client
result = fal_client.subscribe(
"fal-ai/flux/dev",
arguments={
"prompt": "A serene Japanese garden with cherry blossoms",
"image_size": "landscape_16_9",
"num_inference_steps": 28,
"guidance_scale": 3.5,
"num_images": 1,
"seed": 42,
"enable_safety_checker": True,
"output_format": "jpeg"
}
)
print(result["images"][0]["url"])
FLUX Schnell
エンドポイント: fal-ai/flux/schnell
料金: 画像あたりのコストが低い
最適な用途: 高速な試行、プレビュー、4 ステップ生成
推論ステップを 4 回だけ必要とするよう最適化されており、高速に動作します。
const result = await fal.subscribe("fal-ai/flux/schnell", {
input: {
prompt: "A colorful abstract painting",
image_size: "square_hd",
num_inference_steps: 4, // Optimized for 4 steps
num_images: 1
}
});
FLUX Pro
エンドポイント: fal-ai/flux-pro
料金: プレミアム
最適な用途: 本番環境のワークロード
const result = await fal.subscribe("fal-ai/flux-pro", {
input: {
prompt: "Professional product photography of a luxury watch",
image_size: "square_hd",
num_inference_steps: 28,
guidance_scale: 3.5
}
});
FLUX.2 [pro]
エンドポイント: fal-ai/flux-2-pro
料金: 1 メガピクセルあたり $0.03
最適な用途: 最高品質、自動プロンプト強化
プロンプト最適化機能を内蔵した最新の FLUX モデルです。
const result = await fal.subscribe("fal-ai/flux-2-pro", {
input: {
prompt: "A majestic lion in the savanna at golden hour",
image_size: "landscape_16_9",
num_inference_steps: 28,
guidance_scale: 3.5,
// FLUX 2 Pro features
safety_tolerance: "2", // 1-6, higher = more permissive
raw: false // Set true to disable prompt enhancement
}
});
FLUX.2 Pro 固有のパラメーター:
safety_tolerance:1~6。コンテンツフィルタリングの感度を制御しますraw:ブール値。自動プロンプト強化を無効にするにはtrueに設定します
FLUX LoRA
エンドポイント: fal-ai/flux-lora
最適な用途: カスタム学習済みのスタイルや被写体
カスタム LoRA モデルを FLUX の生成に適用します。
const result = await fal.subscribe("fal-ai/flux-lora", {
input: {
prompt: "A portrait in the style of <lora_trigger>",
loras: [
{
path: "https://huggingface.co/user/lora-model/resolve/main/lora.safetensors",
scale: 0.8
}
],
image_size: "portrait_4_3",
num_inference_steps: 28,
guidance_scale: 3.5
}
});
LoRA パラメーター:
loras:LoRA 設定の配列path:LoRA の重み(.safetensors)への URLscale:0~1。LoRA の効果の強さ
FLUX Realism
エンドポイント: fal-ai/flux-realism
最適な用途: 写実的な画像
const result = await fal.subscribe("fal-ai/flux-realism", {
input: {
prompt: "A photorealistic portrait of a young woman, natural lighting, 85mm lens",
image_size: "portrait_4_3",
num_inference_steps: 28
}
});
FLUX Fill(アウトペインティング)
エンドポイント: fal-ai/flux-pro/v1/fill
最適な用途: 画像の境界を越えて拡張する
const result = await fal.subscribe("fal-ai/flux-pro/v1/fill", {
input: {
prompt: "Continue the landscape with mountains",
image_url: "https://example.com/partial-image.jpg",
mask_url: "https://example.com/outpaint-mask.png"
}
});
Stable Diffusion モデル
Fast SDXL
エンドポイント: fal-ai/fast-sdxl
最適な用途: 高速性とコスト効率
const result = await fal.subscribe("fal-ai/fast-sdxl", {
input: {
prompt: "A fantasy castle on a cliff, dramatic lighting",
negative_prompt: "blurry, low quality, distorted",
image_size: "landscape_16_9",
num_inference_steps: 25,
guidance_scale: 7.5,
num_images: 1,
seed: 42
}
});
SDXL 固有のパラメーター:
negative_prompt:生成で避ける内容- SDXL では、より高い
guidance_scale(7~12)が効果的です
Stable Diffusion 3 Medium
エンドポイント: fal-ai/stable-diffusion-v3-medium
最適な用途: SD3 アーキテクチャ、優れたテキスト描画
const result = await fal.subscribe("fal-ai/stable-diffusion-v3-medium", {
input: {
prompt: "A sign that says 'Hello World' in neon lights",
negative_prompt: "blurry, distorted text",
image_size: "square_hd",
num_inference_steps: 28,
guidance_scale: 7.0
}
});
SDXL Turbo
エンドポイント: fal-ai/sdxl-turbo
最適な用途: 超高速の 1 ステップ生成
const result = await fal.subscribe("fal-ai/sdxl-turbo", {
input: {
prompt: "A cute robot",
num_inference_steps: 1, // Single step!
guidance_scale: 0 // No guidance needed
}
});
SDXL Lightning
エンドポイント: fal-ai/fast-lightning-sdxl
最適な用途: 高速な 4 ステップ SDXL
const result = await fal.subscribe("fal-ai/fast-lightning-sdxl", {
input: {
prompt: "A beautiful sunset",
num_inference_steps: 4,
guidance_scale: 1.5
}
});
特化型モデル
Recraft V3
エンドポイント: fal-ai/recraft-v3
最適な用途: デザイン素材、イラスト、ベクタースタイル
const result = await fal.subscribe("fal-ai/recraft-v3", {
input: {
prompt: "A minimalist logo for a tech startup, clean lines",
image_size: "square_hd",
style: "digital_illustration" // or "realistic_image", "vector_illustration"
}
});
Recraft のスタイル:
realistic_imagedigital_illustrationvector_illustrationicon
Ideogram
エンドポイント: fal-ai/ideogram
最適な用途: 画像内のテキスト、タイポグラフィ
const result = await fal.subscribe("fal-ai/ideogram", {
input: {
prompt: "A vintage poster with the text 'JAZZ FESTIVAL' in art deco style",
aspect_ratio: "portrait_4_3"
}
});
Playground v2.5
エンドポイント: fal-ai/playground-v25
最適な用途: クリエイティブで芸術的な画像
const result = await fal.subscribe("fal-ai/playground-v25", {
input: {
prompt: "A surreal dreamscape with floating islands",
image_size: "landscape_16_9",
guidance_scale: 3.0
}
});
AuraFlow
エンドポイント: fal-ai/aura-flow
最適な用途: オープンソースのフローベースモデル
const result = await fal.subscribe("fal-ai/aura-flow", {
input: {
prompt: "A magical forest with bioluminescent plants",
num_inference_steps: 28,
guidance_scale: 3.5
}
});
Kolors
エンドポイント: fal-ai/kolors
最適な用途: 芸術的でカラフルな生成
const result = await fal.subscribe("fal-ai/kolors", {
input: {
prompt: "A vibrant street market in Morocco",
image_size: "landscape_4_3"
}
});
共通パラメーターのリファレンス
画像サイズのオプション
| プリセット | 寸法 | アスペクト比 |
|---|---|---|
square | 512x512 | 1:1 |
square_hd | 1024x1024 | 1:1 |
portrait_4_3 | 768x1024 | 3:4 |
portrait_16_9 | 576x1024 | 9:16 |
landscape_4_3 | 1024x768 | 4:3 |
landscape_16_9 | 1024x576 | 16:9 |
カスタム寸法:
image_size: { width: 1920, height: 1080 }
パラメーターの完全なリファレンス
interface TextToImageInput {
// Required
prompt: string;
// Image dimensions
image_size?:
| "square" | "square_hd"
| "portrait_4_3" | "portrait_16_9"
| "landscape_4_3" | "landscape_16_9"
| { width: number; height: number };
// Generation parameters
num_inference_steps?: number; // 1-50, default varies by model
guidance_scale?: number; // 1-20, default: 3.5 (FLUX) or 7.5 (SDXL)
num_images?: number; // 1-4, default: 1
seed?: number; // For reproducibility
// Output options
output_format?: "jpeg" | "png";
enable_safety_checker?: boolean;
// SDXL-specific
negative_prompt?: string;
// FLUX 2 Pro specific
safety_tolerance?: string; // "1" to "6"
raw?: boolean; // Disable prompt enhancement
// LoRA specific
loras?: Array<{
path: string;
scale: number;
}>;
}
レスポンス構造
interface TextToImageOutput {
images: Array<{
url: string;
width: number;
height: number;
content_type: string;
}>;
seed: number;
prompt: string;
has_nsfw_concepts?: boolean[];
timings?: {
inference: number;
};
}
モデル選択ガイド
| ユースケース | 推奨モデル | 理由 |
|---|---|---|
| 最高品質 | fal-ai/flux-2-pro | 最新モデル、プロンプトを強化 |
| オープンソース | fal-ai/flux/dev | 12B パラメーター、高品質 |
| 高速な反復 | fal-ai/flux/schnell | 4ステップ生成 |
| 予算重視 | fal-ai/fast-sdxl | 画像あたりのコストが低い |
| 超高速 | fal-ai/sdxl-turbo | 1ステップ |
| カスタムスタイル | fal-ai/flux-lora | LoRA に対応 |
| 画像内のテキスト | fal-ai/ideogram | タイポグラフィに特化 |
| デザイン素材 | fal-ai/recraft-v3 | ベクタースタイルの出力 |
| 写実的 | fal-ai/flux-realism | リアリズムに最適化 |
ベストプラクティス
プロンプトエンジニアリング
FLUX モデルの場合:
- 説明を詳しく、具体的にします
- スタイル、ライティング、構図を指定します
- FLUX 2 Pro はプロンプトを自動で強化します(無効にするには
raw: trueを使用します) - ガイダンススケールは 3~4 が最適です
SDXL モデルの場合:
- ネガティブプロンプトを使用します
- プロンプトへの準拠度を高めるには、ガイダンスを高く(7~12)します
- 品質を示すキーワード(「high quality, detailed, 8k」)を含めます
品質と速度のトレードオフ
// Quality priority
const quality = await fal.subscribe("fal-ai/flux-2-pro", {
input: {
prompt: "...",
num_inference_steps: 28,
guidance_scale: 3.5
}
});
// Speed priority
const fast = await fal.subscribe("fal-ai/flux/schnell", {
input: {
prompt: "...",
num_inference_steps: 4
}
});
// Balance
const balanced = await fal.subscribe("fal-ai/flux/dev", {
input: {
prompt: "...",
num_inference_steps: 20,
guidance_scale: 3.5
}
});
バッチ生成
// Generate multiple variations
const result = await fal.subscribe("fal-ai/flux/dev", {
input: {
prompt: "A beautiful landscape",
num_images: 4,
seed: 42 // Same seed = similar outputs
}
});
// Access all images
result.images.forEach((img, i) => {
console.log(`Image ${i + 1}: ${img.url}`);
});
再現性
// Use seed for reproducible results
const seed = 12345;
const result1 = await fal.subscribe("fal-ai/flux/dev", {
input: { prompt: "A cat", seed }
});
const result2 = await fal.subscribe("fal-ai/flux/dev", {
input: { prompt: "A cat", seed }
});
// result1 and result2 will be identical