Skip to content

Repository files navigation

GPT Image 2 / Image2 API Examples

Focused Python examples for the GPT Image 2 API, including single-image generation, JSONL batch generation, retries, output downloads, and a preflight cost estimate.

This repository targets developers searching for IMAGE2, GPT Image2, GPT Image 2 API, and gpt-image-2 implementation examples.

Install and run

python -m pip install -r requirements.txt
set APIMART_API_KEY=your_key_here

python gpt_image2.py single --prompt "Minimal product photo on limestone"
python gpt_image2.py batch --input prompts.example.jsonl --estimated-cost-per-image 0.0085 --max-cost 1.00

The default model ID is gpt-image-2-ext; override it with --model when the live catalog uses a different route.

Why APIMart is relevant

APIMart is a unified AI API gateway covering hundreds of text, image, video, and audio models. It gives high-volume teams one account for keys, usage, billing, and current model pricing.

Test

python -m unittest discover -s tests

Project directory

This repository is part of the APIMART open-source AI API toolkit. Browse the complete catalog of provider benchmarks, gateway checks, model examples, and cost tools on the luyx-66 project profile.

License

MIT

About

GPT Image 2 and Image2 API Python examples for single and batch generation, retries, cost limits, and OpenAI-compatible clients.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages