content/providers/03-community-providers/16-firemoon.mdx
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:
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>
Create a Firemoon provider instance with your API key:
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.
Firemoon supports various image generation models through the image() method:
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]);
flux/dev - Fast, high-quality image generationflux-2-dev/edit - Fast, high-quality image editing with Flux 2nano-banana - Fast, high-quality image generationnano-banana/edit - High quality image editing by Gemini, also known as Gemini 2.5 Flash Imagenano-banana-pro/edit - High quality image editing by Gemini 3 Profiremoon-studio/memphis-style - Memphis style image generationYou can browse all available models on the Firemoon Studio Models page.
You can specify the image size using the size parameter:
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:
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
});
For reproducible results, you can specify a seed:
const result = await generateImage({
model: firemoon.image('flux/dev'),
prompt: 'A beautiful landscape with an orangered moon in the background',
seed: 12345,
});
You can pass additional parameters specific to Firemoon models:
const result = await generateImage({
model: firemoon.image('flux/dev'),
prompt: 'A beautiful landscape with an orangered moon in the background',
providerOptions: {
firemoon: {
// custom parameters
},
},
});
You can use a fine-tuned model by passing the model id to the image() method:
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,
},
},
});
generateImageimport { 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]);
aspectRatio for convenient presets instead of hard-coding sizes.seed to make results more repeatable.providerOptions.firemoon to pass through Firemoon parameters.The Firemoon provider throws APICallError for API-related errors:
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);
}
}