227 lines
6.2 KiB
TypeScript
227 lines
6.2 KiB
TypeScript
export const FAL_IMAGE_BASE_URL = "https://fal.run";
|
|
export const FAL_NANO_BANANA_2_MODEL_ID = "fal-ai/nano-banana-2";
|
|
export const FAL_NANO_BANANA_2_EDIT_MODEL_ID = "fal-ai/nano-banana-2/edit";
|
|
export const FAL_GPT_IMAGE_2_EDIT_MODEL_ID = "openai/gpt-image-2/edit";
|
|
|
|
export interface FalImageModelPreset {
|
|
modelId: string;
|
|
displayName: string;
|
|
description: string;
|
|
supportsVision: boolean;
|
|
supportsImageGen: boolean;
|
|
capabilities?: Record<string, any>;
|
|
defaultParams?: Record<string, any>;
|
|
imageGenConfig?: Record<string, any>;
|
|
sortOrder: number;
|
|
}
|
|
|
|
export const FAL_IMAGE_MODEL_PRESETS: FalImageModelPreset[] = [
|
|
{
|
|
modelId: FAL_NANO_BANANA_2_MODEL_ID,
|
|
displayName: "FAL Nano Banana 2",
|
|
description:
|
|
"FAL 官方 Nano Banana 2 文生图模型。无参考图时用于生成图片;如传入参考图,系统会自动切换到官方 /edit 端点。",
|
|
supportsVision: true,
|
|
supportsImageGen: true,
|
|
capabilities: {
|
|
provider: "fal",
|
|
kind: "text-to-image",
|
|
endpoint: FAL_NANO_BANANA_2_MODEL_ID,
|
|
editEndpoint: FAL_NANO_BANANA_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-nano-banana-2",
|
|
officialUrl: "https://fal.ai/models/fal-ai/nano-banana-2/api",
|
|
editOfficialUrl: "https://fal.ai/models/fal-ai/nano-banana-2/edit/api",
|
|
requiredFields: ["prompt"],
|
|
optionalFields: [
|
|
"num_images",
|
|
"aspect_ratio",
|
|
"output_format",
|
|
"safety_tolerance",
|
|
"resolution",
|
|
"limit_generations",
|
|
"enable_web_search",
|
|
"image_urls",
|
|
],
|
|
supportsMultiImageReference: true,
|
|
autoRouteEditEndpoint: true,
|
|
},
|
|
defaultParams: {
|
|
provider: "fal",
|
|
endpoint: FAL_NANO_BANANA_2_MODEL_ID,
|
|
editEndpoint: FAL_NANO_BANANA_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-nano-banana-2",
|
|
imageSize: "1K",
|
|
aspectRatio: "auto",
|
|
outputFormat: "png",
|
|
safetyTolerance: "4",
|
|
limitGenerations: true,
|
|
},
|
|
imageGenConfig: {
|
|
maxImages: 4,
|
|
supportsSize: true,
|
|
supports1K: true,
|
|
supports2K: true,
|
|
supports4K: true,
|
|
supportsPromptExtend: true,
|
|
supportsNegativePrompt: false,
|
|
supportsWatermark: false,
|
|
supportsSeed: true,
|
|
supportedAspectRatios: [
|
|
"auto",
|
|
"21:9",
|
|
"16:9",
|
|
"3:2",
|
|
"4:3",
|
|
"5:4",
|
|
"1:1",
|
|
"4:5",
|
|
"3:4",
|
|
"2:3",
|
|
"9:16",
|
|
"4:1",
|
|
"1:4",
|
|
"8:1",
|
|
"1:8",
|
|
],
|
|
supportedImageSizes: ["0.5K", "1K", "2K", "4K"],
|
|
enableLoadingPlaceholder: true,
|
|
loadingColor: "purple",
|
|
creditCostPerImage: 0,
|
|
creditCostPerVideo: 0,
|
|
},
|
|
sortOrder: 10,
|
|
},
|
|
{
|
|
modelId: FAL_NANO_BANANA_2_EDIT_MODEL_ID,
|
|
displayName: "FAL Nano Banana 2 Edit",
|
|
description:
|
|
"FAL 官方 Nano Banana 2 图像编辑模型,支持最多 14 张参考图和自然语言编辑。",
|
|
supportsVision: true,
|
|
supportsImageGen: true,
|
|
capabilities: {
|
|
provider: "fal",
|
|
kind: "image-edit",
|
|
endpoint: FAL_NANO_BANANA_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-nano-banana-2-edit",
|
|
officialUrl: "https://fal.ai/models/fal-ai/nano-banana-2/edit/api",
|
|
requiredFields: ["prompt", "image_urls"],
|
|
optionalFields: [
|
|
"num_images",
|
|
"aspect_ratio",
|
|
"output_format",
|
|
"safety_tolerance",
|
|
"resolution",
|
|
"limit_generations",
|
|
"enable_web_search",
|
|
],
|
|
supportsMultiImageReference: true,
|
|
maxReferenceImages: 14,
|
|
},
|
|
defaultParams: {
|
|
provider: "fal",
|
|
endpoint: FAL_NANO_BANANA_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-nano-banana-2-edit",
|
|
imageSize: "1K",
|
|
aspectRatio: "auto",
|
|
outputFormat: "png",
|
|
safetyTolerance: "4",
|
|
limitGenerations: true,
|
|
},
|
|
imageGenConfig: {
|
|
maxImages: 4,
|
|
supportsSize: true,
|
|
supports1K: true,
|
|
supports2K: true,
|
|
supports4K: true,
|
|
supportsPromptExtend: true,
|
|
supportsNegativePrompt: false,
|
|
supportsWatermark: false,
|
|
supportsSeed: true,
|
|
supportedAspectRatios: [
|
|
"auto",
|
|
"21:9",
|
|
"16:9",
|
|
"3:2",
|
|
"4:3",
|
|
"5:4",
|
|
"1:1",
|
|
"4:5",
|
|
"3:4",
|
|
"2:3",
|
|
"9:16",
|
|
"4:1",
|
|
"1:4",
|
|
"8:1",
|
|
"1:8",
|
|
],
|
|
supportedImageSizes: ["0.5K", "1K", "2K", "4K"],
|
|
enableLoadingPlaceholder: true,
|
|
loadingColor: "purple",
|
|
creditCostPerImage: 0,
|
|
creditCostPerVideo: 0,
|
|
},
|
|
sortOrder: 11,
|
|
},
|
|
{
|
|
modelId: FAL_GPT_IMAGE_2_EDIT_MODEL_ID,
|
|
displayName: "FAL GPT Image 2 Edit",
|
|
description:
|
|
"FAL 托管的 OpenAI GPT Image 2 图片编辑模型,需至少一张参考图,支持多图参考、自然语言编辑与可选蒙版。",
|
|
supportsVision: true,
|
|
supportsImageGen: true,
|
|
capabilities: {
|
|
provider: "fal",
|
|
kind: "image-edit",
|
|
endpoint: FAL_GPT_IMAGE_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-gpt-image-2-edit",
|
|
officialUrl: "https://fal.ai/models/openai/gpt-image-2/edit",
|
|
requiredFields: ["prompt", "image_urls"],
|
|
optionalFields: [
|
|
"image_size",
|
|
"quality",
|
|
"num_images",
|
|
"output_format",
|
|
"mask_url",
|
|
"openai_api_key",
|
|
],
|
|
supportsMultiImageReference: true,
|
|
supportsMask: true,
|
|
supportsStreaming: true,
|
|
},
|
|
defaultParams: {
|
|
provider: "fal",
|
|
endpoint: FAL_GPT_IMAGE_2_EDIT_MODEL_ID,
|
|
apiFormat: "fal-gpt-image-2-edit",
|
|
imageSize: "auto",
|
|
quality: "high",
|
|
outputFormat: "png",
|
|
},
|
|
imageGenConfig: {
|
|
maxImages: 4,
|
|
supportsSize: true,
|
|
supports1K: true,
|
|
supports2K: true,
|
|
supports4K: true,
|
|
supportsPromptExtend: true,
|
|
supportsNegativePrompt: false,
|
|
supportsWatermark: false,
|
|
supportsSeed: false,
|
|
supportedImageSizes: [
|
|
"auto",
|
|
"square_hd",
|
|
"square",
|
|
"landscape_4_3",
|
|
"landscape_16_9",
|
|
"portrait_4_3",
|
|
"portrait_16_9",
|
|
],
|
|
supportedQualities: ["low", "medium", "high"],
|
|
enableLoadingPlaceholder: true,
|
|
loadingColor: "purple",
|
|
creditCostPerImage: 0,
|
|
creditCostPerVideo: 0,
|
|
},
|
|
sortOrder: 20,
|
|
},
|
|
];
|