openai
/
gpt-image-1
A multimodal image generation model that creates high-quality images. You need to bring your own verified OpenAI key to use this model.
Run replicate/openai-gpt-image-1-internal with an API
Use one of our client libraries to get started quickly.
Set the REPLICATE_API_TOKEN
environment variable
export REPLICATE_API_TOKEN=<paste-your-token-here>
Learn more about authentication
Install Replicate’s Node.js client library
npm install replicate
Run openai/gpt-image-1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
import Replicate from "replicate";
const replicate = new Replicate();
const input = {
prompt: "A beautiful landscape",
aspect_ratio: "3:2"
};
const output = await replicate.run("openai/gpt-image-1", { input });
import { writeFile } from "node:fs/promises";
for (const [index, item] of Object.entries(output)) {
await writeFile(`output_${index}.png`, item);
}
//=> output_0.png written to disk