TinyShip
TinyShip
 TinyShip
TinyShip
TinyShip Documentation
TinyShip User GuideGetting StartedBasic Configuration
Credits System ConfigurationAffiliate System Configuration
AI Features ConfigurationAI Chat ConfigurationAI Image Generation ConfigurationAI Video Generation Configuration
Storage Service ConfigurationDatabase ConfigurationCaptcha Configuration
Development Best PracticesLocal E2E Workflow
User GuideAI Features

AI Image Generation Configuration

Configure Fal, OpenAI, and Qwen image generation

Image generation uses three providers: Fal, OpenAI (DALL·E), and Qwen. For an English-language product, start with Fal or DALL·E. Qwen remains the option with stronger Chinese prompts. The file in the repo still defaults to Qwen.

Related pages

PagePathDescription
Image generation/image-generateImage UI

Providers

ProviderModels in config/aiImage.tsFit
Falfal-ai/qwen-image-2512/lora, fal-ai/nano-banana-pro, fal-ai/recraft/v3/text-to-image, fal-ai/flux/devFast hosted models, including Flux
OpenAIdall-e-3, dall-e-2DALL·E. Stable, familiar API
Qwenqwen-image-plus, qwen-image-maxChinese prompts, Alibaba Cloud

config/aiImage.ts

defaultProvider is 'qwen' | 'fal' | 'openai'. Models are string arrays per provider, same shape as chat. Sizes are three separate lists: qwenSizes (width*height), falAspectRatios (width:height), and openaiSizes (widthxheight). getImageSizesForProvider returns the list for the active provider.

// config/aiImage.ts
export const aiImageConfig = {
  defaultProvider: 'qwen' as const, // 'qwen' | 'fal' | 'openai'

  defaultModels: {
    qwen: 'qwen-image-plus',
    fal: 'fal-ai/qwen-image-2512/lora',
    openai: 'dall-e-3',
  },

  availableModels: {
    qwen: ['qwen-image-plus', 'qwen-image-max'],
    fal: [
      'fal-ai/qwen-image-2512/lora',
      'fal-ai/nano-banana-pro',
      'fal-ai/recraft/v3/text-to-image',
      'fal-ai/flux/dev',
    ],
    openai: ['dall-e-3', 'dall-e-2'],
  },

  qwenSizes: [
    { value: '1664*928', label: '16:9' },
    { value: '1472*1104', label: '4:3' },
    { value: '1328*1328', label: '1:1' },
    { value: '1104*1472', label: '3:4' },
    { value: '928*1664', label: '9:16' },
  ],

  falAspectRatios: [
    { value: '21:9', label: '21:9' },
    { value: '16:9', label: '16:9' },
    { value: '4:3', label: '4:3' },
    { value: '1:1', label: '1:1' },
    { value: '3:4', label: '3:4' },
    { value: '9:16', label: '9:16' },
    { value: '9:21', label: '9:21' },
  ],

  openaiSizes: [
    { value: '1024x1024', label: '1:1' },
    { value: '1792x1024', label: '16:9' },
    { value: '1024x1792', label: '9:16' },
  ],

  defaults: {
    numInferenceSteps: 28,
    guidanceScale: 4,
    promptExtend: true,
    watermark: false,
  },
}

Set defaultProvider to 'fal' or 'openai' for an English product. Fal requests send aspectRatio. Qwen and OpenAI send size.

Environment variables

Qwen and OpenAI reuse the chat keys. Fal has its own key.

# Fal — start here, or use OpenAI below
FAL_API_KEY="your-fal-api-key"

# OpenAI DALL·E (same key as chat)
OPENAI_API_KEY="your-openai-api-key"

# Qwen image (same key as chat)
QWEN_API_KEY="your-qwen-api-key"

libs/ai reads FAL_API_KEY for Fal. There is no separate image key for OpenAI or Qwen.

Credit cost

Images always use fixedConsumption.aiImage in config/credits.ts, even when chat is in dynamic mode. Unknown model ids use default (10).

// config/credits.ts
export const creditsConfig = {
  fixedConsumption: {
    aiImage: {
      default: 10,
      models: {
        'qwen-image-max': 8,
        'qwen-image-plus': 5,
        'fal-ai/flux/schnell': 6,
        'fal-ai/flux/dev': 10,
        'fal-ai/flux-pro': 12,
        'fal-ai/qwen-image-2512/lora': 8,
        'fal-ai/nano-banana-pro': 6,
        'dall-e-3': 15,
        'dall-e-2': 8,
      },
    },
  },
}

/api/image-generate consumes that amount before calling the provider and refunds it if generation throws.


Related docs:

  • AI chat
  • Credits

AI Chat Configuration

Configure OpenAI, Qwen, and DeepSeek chat

AI Video Generation Configuration

Configure AI video generation

On this page

Related pagesProvidersconfig/aiImage.tsEnvironment variablesCredit cost