Skip to content

feat: add support for image generation using gpt-image-1 #971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

PChaparro
Copy link

@PChaparro PChaparro commented Apr 23, 2025

Describe the change

This PR adds support for the new gpt-image-1 model from OpenAI, along with several missing constants and optional fields related to image generation.

Provide OpenAI documentation link

Describe your solution

  • Added constant for the new gpt-image-1 model.

  • Included image sizes specific to the model: 1536x1024 (landscape), 1024x1536 (portrait).

  • Added quality levels: low, medium, high.

  • Added background options: transparent, opaque.

  • Added moderation level: low.

  • Added output formats: png, jpeg, webp.

  • Updated the Request and Response structs to include optional fields from the OpenAI API response that were previously missing.

  • Updated README file to include GPT Image 1.

Tests

I tested the changes locally by modifying examples/images/main.go to generate an image using the gpt-image-1 model and the new parameters. The request completed successfully, and the image was generated as expected.

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.

Project coverage is 83.89%. Comparing base (774fc9d) to head (286d79c).
Report is 90 commits behind head on master.

Files with missing lines Patch % Lines
examples/images/main.go 0.00% 47 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #971       +/-   ##
===========================================
- Coverage   98.46%   83.89%   -14.57%     
===========================================
  Files          24       43       +19     
  Lines        1364     2304      +940     
===========================================
+ Hits         1343     1933      +590     
- Misses         15      349      +334     
- Partials        6       22       +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant