Use case
Multimodal generation.One key, many models
Agents that generate images and reason over what they produce.
Why open models fit
An open image model and a vision checker on one key let an agent generate and self-review in a single loop.
The pipeline
One OpenAI-compatible key runs the whole pipeline. Swap any step's model without touching your loop.
- 1 ServingGenerate imageFLUX.1 [schnell]
Few-step image generation for fast iterations.
$0.00045 / image
- 2 ServingDescribe & QAGemma 4 31B IT
A vision chat model to caption and quality-check outputs.
256K ctx · $0.108 / $0.315 per M
Call the whole pipeline
Point the OpenAI SDK at FlexAI once. Every step names its own model on the same key: no per-model clients, endpoints, or keys to juggle.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://tokens.flex.ai/v1",
apiKey: process.env.FLEXAI_API_KEY,
});
const prompt = "A product photo on a seamless background.";
// 1. Generate image: same key, swap the model anytime
const generateImage = await client.images.generate({
model: "FLUX.1-schnell",
prompt: prompt,
});
// 2. Describe & QA: same key, swap the model anytime
const describeQA = await client.chat.completions.create({
model: "gemma-4-31b-it",
messages: [{ role: "user", content: [{ type: "image_url", image_url: { url: `data:image/png;base64,${generateImage.data[0].b64_json}` } }] }],
});Start serverless and pay per token. When a step becomes steady production traffic, move it to a dedicated endpoint on the same key.
Build your multimodal generation on FlexAI
Every model in the pipeline behind one OpenAI-compatible key, with source-linked pricing.
$10/month in free credits for your first 3 months