alasano/gpt-image-playground
Acerca de
A web-based playground for OpenAI's GPT image models (gpt-image-2.6-flare, gpt-image-2.6-sunburst, gpt-image-2.5-flare, gpt-image-2.5-sunburst) to generate and edit images, including animated GIF and SVG output.
Diseño y multimediaWhat you can do
- 🎨 Image Generation Mode: Create new images from text prompts.
- 🖌️ Image Editing Mode: Modify existing images (up to 16 source images per request) based on text prompts and an optional mask or markup.
- ⚙️ Full API Parameter Control: Access and adjust all relevant parameters supported by the OpenAI Images API directly through the UI, in both generate and edit mode (size, quality including the xhigh/max tiers, complexity, output format, compression, background, moderation, number of images).
- 📐 Custom Resolutions: Pick from the 2048×2048, 3072×2048 or 2048×3072 presets or enter an arbitrary Width × Height with live validation against the model constraints (multiples of 16, max 3840px per edge, ≤ 3:1 aspect ratio, 655,360 to 8,294,400 total pixels).
Crecimiento de estrellas medido
- in 24h
- +2
- in 7 days
- +4
- in 15 days
- +5
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original
GPT Image Playground
A web-based playground to interact with OpenAI's GPT image models (gpt-image-2.6-flare, gpt-image-2.6-sunburst, gpt-image-2.5-flare, gpt-image-2.5-sunburst, and gpt-image-2) for generating and editing images.
Note: The playground defaults to
gpt-image-2.6-flare, OpenAI's fast default model. All five models support arbitrary resolutions up to 4K (with constraint validation), transparent backgrounds (preview ongpt-image-2) and markup-guided edits. Thegpt-image-2.5andgpt-image-2.6models add thexhighandmaxquality tiers. Thegpt-image-2.6models add thecomplexitysetting, animated GIF output and SVG output. Retired models (gpt-image-1,gpt-image-1-mini,gpt-image-1.5) can no longer be selected, but images generated with them remain visible in the history with their original cost breakdown.
✨ Features
🎨 Image Generation Mode: Create new images from text prompts.
🖌️ Image Editing Mode: Modify existing images (up to 16 source images per request) based on text prompts and an optional mask or markup.
⚙️ Full API Parameter Control: Access and adjust all relevant parameters supported by the OpenAI Images API directly through the UI, in both generate and edit mode (size, quality including the
xhigh/maxtiers, complexity, output format, compression, background, moderation, number of images).📐 Custom Resolutions: Pick from the 2048×2048, 3072×2048 or 2048×3072 presets or enter an arbitrary Width × Height with live validation against the model constraints (multiples of 16, max 3840px per edge, ≤ 3:1 aspect ratio, 655,360 to 8,294,400 total pixels).
🎞️ Animated GIF Output (
gpt-image-2.6): Generate GIFs from a prompt or animate an uploaded image in edit mode, with 2 to 16 frames and a per-frame duration of 20 to 2000 ms. Custom frame sizes are validated against the API's sheet limits: frames are rendered tiled into one image (4×2 or 2×4 for up to 8 frames, 3×3 for 9, 4×4 for 10 or more) that must meet the still-image constraints, and the number of images × sheet pixels must stay within 16,777,216.✒️ SVG Output (
gpt-image-2.6, generate mode): The image model draws a reference image and a chat model (gpt-6.1-sol,gpt-6-astra,gpt-6.1-terraorgpt-6-luna, with an optional reasoning effort) writes it as SVG. One image per request; the writer's token cost is included in the cost breakdown.🎭 Integrated Masking & Markup Tool: Easily create or upload masks directly within the editing mode to specify areas for modification. Draw directly on the image to generate a mask, or switch to Markup to circle or sketch where a change should go and describe it in the prompt (markup can't be combined with a mask, and masks can't be used with GIF output).
⚠️ Please note that the GPT Image models' masking feature does not guarantee 100% control at this time.
1) It's a known & acknowledged model limitation.
2) OpenAI are looking to address it in a future update.
- 📜 Detailed History & Cost Tracking:
- View a comprehensive history of all your image generations and edits.
- See the parameters used for each request.
- Get detailed API token usage and estimated cost breakdowns (
$USD) for each operation. (hint: click the$amount on the image) - View the full prompt used for each history item.
- View total historical API cost.
- Delete items from history
- 🖼️ Flexible Image Output View: View generated image batches as a grid or select individual images for a closer look.
- 🚀 Send to Edit: Quickly send any generated or history image directly to the editing form.
- 📋 Paste to Edit: Paste images directly from your clipboard into the Edit mode's source image area.
- 💾 Storage: Supports two modes via
NEXT_PUBLIC_IMAGE_STORAGE_MODE:- Filesystem (default): Images saved to
./generated-imageson the server. - IndexedDB: Images saved directly in the browser's IndexedDB (ideal for serverless deployments).
- Generation history metadata is always saved in the browser's local storage.
- Filesystem (default): Images saved to
▲ Deploy to Vercel
🚨 CAUTION: If you deploy from main or master branch, your Vercel deployment will be publicly available to anyone who has the URL. Deploying from other branches will require users to be logged into Vercel (on your team) to access the preview build. 🚨
You can deploy your own instance of this playground to Vercel with one click:
You will be prompted to enter your OPENAI_API_KEY and APP_PASSWORD during the deployment setup. For Vercel deployments, it's required to set NEXT_PUBLIC_IMAGE_STORAGE_MODE to indexeddb.
Note: If NEXT_PUBLIC_IMAGE_STORAGE_MODE is not set, the application will automatically detect if it's running on Vercel (using the VERCEL or NEXT_PUBLIC_VERCEL_ENV environment variables) and default to indexeddb mode in that case. Otherwise (e.g., running locally), it defaults to fs mode. You can always explicitly set the variable to fs or indexeddb to override this automatic behavior.
🚀 Getting Started [Local Deployment]
Follow these steps to get the playground running locally.
Prerequisites
1. Set Up API Key 🟢
You need an OpenAI API key to use this application.
⚠️ Your OpenAI Organization needs to be verified to use GPT Image models
If you don't have a
.env.localfile, create one.Add your OpenAI API key to the
.env.localfile:OPENAI_API_KEY=your_openai_api_key_hereImportant: Keep your API key secret. The
.env.localfile is included in.gitignoreby default to prevent accidental commits.
🟡 (Optional) IndexedDB Mode (for serverless hosts) [e.g. Vercel]
For environments where the filesystem is read-only or ephemeral (like Vercel serverless functions), you can configure the application to store generated images directly in the browser's IndexedDB using Dexie.js.
Set the following environment variable in your .env.local file or directly in your hosting provider's UI (like Vercel):
NEXT_PUBLIC_IMAGE_STORAGE_MODE=indexeddb
When this variable is set to indexeddb:
- The server API (
/api/images) will return the image data as base64 (b64_json) instead of saving it to disk. - The client-side application will decode the base64 data and store the image blob in IndexedDB.
- Images will be served directly from the browser's storage using Blob URLs.
If this variable is not set or has any other value, the application defaults to the standard behavior of saving images to the ./generated-images directory on the server's filesystem.
Note: If NEXT_PUBLIC_IMAGE_STORAGE_MODE is not set, the application will automatically detect if it's running on Vercel (using the VERCEL or NEXT_PUBLIC_VERCEL_ENV environment variables) and default to indexeddb mode in that case. Otherwise (e.g., running locally), it defaults to fs mode. You can always explicitly set the variable to fs or indexeddb to override this automatic behavior.
🟡 (Optional) Use a Custom API Endpoint
If you need to use an OpenAI-compatible API endpoint (e.g., a local model server or a different provider), you can specify its base URL using the OPENAI_API_BASE_URL environment variable in your .env.local file:
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_API_BASE_URL=your_compatible_api_endpoint_here
If OPENAI_API_BASE_URL is not set, the application will default to the standard OpenAI API endpoint.
🟡 (Optional) Enable Password Validation
APP_PASSWORD=your_password_here
When APP_PASSWORD is set, the frontend will prompt you for a password to authenticate requests.
2. Install Dependencies 🟢
Navigate to the project directory in your terminal and install the necessary packages:
npm install
# or
# yarn install
# or
# pnpm install
# or
# bun install
3. Run the Development Server 🟢
Start the Next.js development server:
npm run dev
# or
# yarn dev
# or
# pnpm dev
# or
# bun dev
4. Open the Playground 🟢
Open http://localhost:3000 in your web browser. You should now be able to use the GPT Image Playground!
🤝 Contributing
Contributions are welcome! Issues and feature requests, not as much welcome but I'll think about it.
📄 License
MIT
Explorar proyectos relacionados
Cargando…