本页还没有译文
本页 34 段还没译成简体中文,下面显示的是英文原文。Firemoon
还没翻译译自英文(ai-sdk.dev)本页 34 段都还没译
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:
pnpm add @firemoon/ai-providernpm install @firemoon/ai-provideryarn add @firemoon/ai-providerbun add @firemoon/ai-providerProvider Instance
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.
Image Generation
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]);Available Models
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 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:
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
});Seed
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,
});Custom Parameters
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
},
},
});Fine-tuned Models
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,
},
},
});Quickstart Examples
generateImage
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
- Aspect ratio mapping: Use
aspectRatiofor convenient presets instead of hard-coding sizes. - Reproducible outputs: Provide
seedto make results more repeatable. - Model-specific options: Use
providerOptions.firemoonto pass through Firemoon parameters.
Error handling
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);
}
}