Prodia
Prodia is a fast inference platform for generative AI, offering high-speed image generation with FLUX and Stable Diffusion models.
You can use Prodia models through AI Gateway (recommended) or connect directly with @ai-sdk/prodia.
Using AI Gateway
The AI SDK uses AI Gateway by default for model strings. Gateway provides access to models across providers through a single API key, with usage and cost tracking. Install ai:
$ pnpm add ai
$ npm install ai
$ yarn add ai
$ bun add ai
Set an AI Gateway API key in your environment:
Vercel deployments can also use OIDC authentication. See the AI Gateway provider documentation for configuration and the model catalog for available models.
Gateway feature and provider-option support depends on the model and the provider serving the request. See Gateway provider options.
Using @ai-sdk/prodia
For direct access to Prodia, install ai and @ai-sdk/prodia:
$ pnpm add ai @ai-sdk/prodia
$ npm install ai @ai-sdk/prodia
$ yarn add ai @ai-sdk/prodia
$ bun add ai @ai-sdk/prodia
Set your Prodia API credential in the PRODIA_TOKEN environment variable:
AI Gateway does not expose every API in @ai-sdk/prodia. Use the direct provider for provider-specific APIs or custom connection settings.
The following sections document the direct @ai-sdk/prodia provider,
including its model factories and settings. Gateway model and feature
availability can differ.
Provider Instance
You can import the default provider instance prodia from @ai-sdk/prodia:
If you need a customized setup, you can import createProdia and create a provider instance with your settings:
You can use the following optional settings to customize the Prodia provider instance:
-
baseURL string
Use a different URL prefix for API calls. The default prefix is
https://inference.prodia.com/v2. -
apiKey string | PromiseLike<string> | (() => string | PromiseLike<string>)
Pass a function to resolve credentials before each request, including when keys rotate. The function can return a string or a promise. Credential caching and refresh are managed by the function.
API key that is being sent using the
Authorizationheader as a Bearer token. It defaults to thePRODIA_TOKENenvironment variable. -
headers Record<string,string>
Custom headers to include in the requests.
-
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for e.g. testing.
Image Models
You can create Prodia image models using the .image() factory method.
For more on image generation with the AI SDK see generateImage().
Basic Usage
Model Capabilities
Prodia offers fast inference for various image generation models. Here are the supported model types:
| Model | Description | Sizes | Image Editing | Mask Input | Max Images Per Call |
|---|---|---|---|---|---|
inference.flux-fast.schnell.txt2img.v2 | Fast FLUX Schnell model for text-to-image generation | Output width and height in pixels, configured with size or providerOptions.prodia. | 1 | ||
inference.flux.schnell.txt2img.v2 | FLUX Schnell model for text-to-image generation | Output width and height in pixels, configured with size or providerOptions.prodia. | 1 |
Prodia supports additional model IDs. Check the Prodia documentation for the full list of available models.
Image Size
You can specify the image size using the size parameter in WIDTHxHEIGHT format:
Provider Options
Prodia image models support additional options through the providerOptions.prodia object:
The following provider options are supported:
- width number - Output width in pixels (256–1920). When set, this overrides any width derived from
size. - height number - Output height in pixels (256–1920). When set, this overrides any height derived from
size. - steps number - Number of computational iterations (1–4). More steps typically produce higher quality results.
- stylePreset string - Apply a visual theme to the output image. Supported presets:
3d-model,analog-film,anime,cinematic,comic-book,digital-art,enhance,fantasy-art,isometric,line-art,low-poly,neon-punk,origami,photographic,pixel-art,texture,craft-clay. - loras string[] - Augment the output with up to 3 LoRA models.
- progressive boolean - When using JPEG output, return a progressive JPEG.
Seed
You can use the seed parameter to get reproducible results:
Provider Metadata
The generateImage response includes provider-specific metadata in providerMetadata.prodia.images[]. Each image object may contain the following properties:
- jobId string - The unique identifier for the generation job.
- seed number - The seed used for generation. Useful for reproducing results.
- elapsed number - Generation time in seconds.
- iterationsPerSecond number - Processing speed metric.
- createdAt string - Timestamp when the job was created.
- updatedAt string - Timestamp when the job was last updated.
Language Model Capabilities
| Model | Image Input | Object Generation | Tool Usage | Tool Streaming | Text Generation | Image Generation |
|---|---|---|---|---|---|---|
inference.nano-banana.img2img.v2 |
Video Model Capabilities
| Model | Image Input | First Frame | Last Frame | Reference Images | Reference Video | Audio | Aspect Ratio | Resolution | Duration | FPS | Seed |
|---|---|---|---|---|---|---|---|---|---|---|---|
inference.wan2-2.lightning.txt2vid.v0 | Conditional: Configured through providerOptions.prodia.resolution. | ||||||||||
inference.wan2-2.lightning.img2vid.v0 | Conditional: Configured through providerOptions.prodia.resolution. |
Provider Option Reference
The following option definitions are generated from the provider catalog.
| Operation | Option | Description |
|---|---|---|
| image | steps | Amount of computational iterations to run. More is typically higher quality. |
| image | width | Width of the output image in pixels. |
| image | height | Height of the output image in pixels. |
| image | stylePreset | Apply a visual theme to your output image. |
| image | loras | Augment the output with a LoRa model. |
| image | progressive | When using JPEG output, return a progressive JPEG. |
| language | aspectRatio | Aspect ratio for the output image. |
| video | resolution | Video resolution (e.g. "480p", "720p"). |