Skip to content

Add support for OpenAI's Create Image Edit API #3484

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 2 commits into
base: main
Choose a base branch
from

Conversation

namsoo2
Copy link

@namsoo2 namsoo2 commented Jun 9, 2025

Related issue - #2870

Added a model to use the Create image edit API provided by OpenAI.
https://platform.openai.com/docs/api-reference/images/createEdit


I'm submitting this new PR to replace #2914, which had problems caused by a mistaken rebase.
Sorry for the inconvenience, and thank you for your understanding.

@namsoo2 namsoo2 marked this pull request as ready for review June 9, 2025 09:00
return "image.png";
}
};
multipartBody.add("image", imageResource);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use image[] instead of image, to take into consideration if the array of images is more than 1

Resource imageResource = new ByteArrayResource(image) {
@Override
public String getFilename() {
return "image.png";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take into consideration that the filename should be unique if the array size is more than one, and the extension does not always come as PNG

Resource imageResource = new ByteArrayResource(openAiImageEditRequest.mask()) {
@Override
public String getFilename() {
return "mask.png";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take in consideration if the mask have another extension

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.

2 participants