Back to Ai

Firemoon

content/providers/03-community-providers/16-firemoon.mdx

2.1.105.1 KB
Original Source

Firemoon Provider

Firemoon Studio is an AI platform specializing in high-quality image and video generation models, specifically fine-tunes and state-of-the-art models.

The Firemoon provider for the AI SDK enables you to use these models with a simple, consistent API:

  • Image generation: Generate images today, with early video model support.
  • Model variety: Access multiple model families through a single provider.
  • Provider options: Pass model-specific parameters when you need more control.

Setup

The Firemoon provider is available via the @firemoon/ai-provider module. You can install it with:

<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}> <Tab> <Snippet text="pnpm add @firemoon/ai-provider" dark /> </Tab> <Tab> <Snippet text="npm install @firemoon/ai-provider" dark /> </Tab> <Tab> <Snippet text="yarn add @firemoon/ai-provider" dark /> </Tab> <Tab> <Snippet text="bun add @firemoon/ai-provider" dark /> </Tab> </Tabs>

Provider Instance

Create a Firemoon provider instance with your API key:

ts
import { createFiremoon } from '@firemoon/ai-provider';

const firemoon = createFiremoon({
  apiKey: process.env.FIREMOON_API_KEY,
});

You can obtain your Firemoon API key from the Firemoon Dashboard.

Image Generation

Firemoon supports various image generation models through the image() method:

ts
import { generateImage } from 'ai';

const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'An orangered moon with a dark background',
  size: 'square_hd',
});

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

Available Models

  • flux/dev - Fast, high-quality image generation
  • flux-2-dev/edit - Fast, high-quality image editing with Flux 2
  • nano-banana - Fast, high-quality image generation
  • nano-banana/edit - High quality image editing by Gemini, also known as Gemini 2.5 Flash Image
  • nano-banana-pro/edit - High quality image editing by Gemini 3 Pro
  • firemoon-studio/memphis-style - Memphis style image generation

You can browse all available models on the Firemoon Studio Models page.

Parameters

Size

You can specify the image size using the size parameter:

ts
const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'A beautiful landscape with an orangered moon in the background',
  size: 'square_hd', // or 'landscape_16_9', etc.
});

Or use aspect ratio mapping:

ts
const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'A beautiful landscape with an orangered moon in the background',
  aspectRatio: '16:9', // maps to landscape_16_9
});

Seed

For reproducible results, you can specify a seed:

ts
const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'A beautiful landscape with an orangered moon in the background',
  seed: 12345,
});

Custom Parameters

You can pass additional parameters specific to Firemoon models:

ts
const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'A beautiful landscape with an orangered moon in the background',
  providerOptions: {
    firemoon: {
      // custom parameters
    },
  },
});

Fine-tuned Models

You can use a fine-tuned model by passing the model id to the image() method:

ts
const result = await generateImage({
  model: firemoon.image('firemoon-studio/memphis-style'),
  prompt: 'a man smiling at the camera',
  size: 'landscape_16_9',
  providerOptions: {
    firemoon: {
      lora_scale: 0.6,
      num_images: 1,
      image_size: 'landscape_4_3',
      output_format: 'jpeg',
      guidance_scale: 3.5,
      num_inference_steps: 28,
      enable_safety_checker: true,
    },
  },
});

Quickstart Examples

generateImage

ts
import { createFiremoon } from '@firemoon/ai-provider';
import { generateImage } from 'ai';

const firemoon = createFiremoon({
  apiKey: process.env.FIREMOON_API_KEY,
});

const result = await generateImage({
  model: firemoon.image('flux/dev'),
  prompt: 'A beautiful landscape with an orangered moon in the background',
  aspectRatio: '16:9',
});

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

Advanced features

  1. Aspect ratio mapping: Use aspectRatio for convenient presets instead of hard-coding sizes.
  2. Reproducible outputs: Provide seed to make results more repeatable.
  3. Model-specific options: Use providerOptions.firemoon to pass through Firemoon parameters.

Error handling

The Firemoon provider throws APICallError for API-related errors:

ts
import { APICallError } from 'ai';

try {
  const result = await generateImage({
    model: firemoon.image('flux/dev'),
    prompt: 'A beautiful landscape with an orangered moon in the background',
  });
} catch (error) {
  if (error instanceof APICallError) {
    console.error('API Error:', error.message);
    console.error('Status:', error.statusCode);
  }
}

Additional resources