Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;
internal sealed record CreateImageEditRequestOptionSet(
Option<string> Prompt,
Option<string?> Maskname,
Option<global::tryAGI.OpenAI.CreateImageEditRequestBackground?> Background,
Option<int?> N,
Option<global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat?> ResponseFormat,
Option<global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat?> OutputFormat,
Option<int?> OutputCompression,
Option<string?> User,
Option<bool?> Stream,
Option<int?> PartialImages,
Option<global::tryAGI.OpenAI.CreateImageEditRequestQuality?> Quality)
Option<int?> PartialImages)
{
public static CreateImageEditRequestOptionSet Create(string? prefix = null)
{
Expand All @@ -32,20 +29,6 @@ public static CreateImageEditRequestOptionSet Create(string? prefix = null)
{
Description = @"An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.",
},
Background: new Option<global::tryAGI.OpenAI.CreateImageEditRequestBackground?>($"--{normalizedPrefix}background")
{
Description = @"Set the background of the generated image(s). This parameter is only supported for
the GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default
value). When `auto` is used, the model will automatically determine the best
background for the image.

`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds
are available for supported GPT Image models. For `gpt-image-2` and
`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
set the output format to `png` or `webp`.
",
},
N: new Option<int?>($"--{normalizedPrefix}n")
{
Description = @"The number of images to generate. Must be between 1 and 10.",
Expand All @@ -54,13 +37,6 @@ set the output format to `png` or `webp`.
{
Description = @"Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images.",
},
OutputFormat: new Option<global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat?>($"--{normalizedPrefix}output-format")
{
Description = @"The format in which the generated images are returned. This parameter is
only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
The default value is `png`.
",
},
OutputCompression: new Option<int?>($"--{normalizedPrefix}output-compression")
{
Description = @"The compression level (0-100%) for the generated images. This parameter
Expand All @@ -79,11 +55,6 @@ set the output format to `png` or `webp`.
PartialImages: new Option<int?>($"--{normalizedPrefix}partial-images")
{
Description = @"",
},
Quality: new Option<global::tryAGI.OpenAI.CreateImageEditRequestQuality?>($"--{normalizedPrefix}quality")
{
Description = @"The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`.
",
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;
internal sealed record CreateImageRequestOptionSet(
Option<string> Prompt,
Option<int?> N,
Option<global::tryAGI.OpenAI.CreateImageRequestQuality?> Quality,
Option<global::tryAGI.OpenAI.CreateImageRequestResponseFormat?> ResponseFormat,
Option<global::tryAGI.OpenAI.CreateImageRequestOutputFormat?> OutputFormat,
Option<int?> OutputCompression,
Option<bool?> Stream,
Option<int?> PartialImages,
Option<global::tryAGI.OpenAI.CreateImageRequestModeration?> Moderation,
Option<global::tryAGI.OpenAI.CreateImageRequestBackground?> Background,
Option<global::tryAGI.OpenAI.CreateImageRequestStyle?> Style,
Option<string?> User)
{
Expand All @@ -33,25 +29,10 @@ public static CreateImageRequestOptionSet Create(string? prefix = null)
{
Description = @"The number of images to generate. Must be between 1 and 10.",
},
Quality: new Option<global::tryAGI.OpenAI.CreateImageRequestQuality?>($"--{normalizedPrefix}quality")
{
Description = @"The quality of the image that will be generated.

- `auto` (default value) will automatically select the best quality for the given
model.
- `high`, `medium` and `low` are supported for the GPT image models.
- `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
snapshots, also support `xhigh` and `max`.
",
},
ResponseFormat: new Option<global::tryAGI.OpenAI.CreateImageRequestResponseFormat?>($"--{normalizedPrefix}response-format")
{
Description = @"Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images.",
},
OutputFormat: new Option<global::tryAGI.OpenAI.CreateImageRequestOutputFormat?>($"--{normalizedPrefix}output-format")
{
Description = @"The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.",
},
OutputCompression: new Option<int?>($"--{normalizedPrefix}output-compression")
{
Description = @"The compression level (0-100%) for the generated images. This parameter is only supported for the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100.",
Expand All @@ -64,24 +45,6 @@ public static CreateImageRequestOptionSet Create(string? prefix = null)
{
Description = @"",
},
Moderation: new Option<global::tryAGI.OpenAI.CreateImageRequestModeration?>($"--{normalizedPrefix}moderation")
{
Description = @"Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value).",
},
Background: new Option<global::tryAGI.OpenAI.CreateImageRequestBackground?>($"--{normalizedPrefix}background")
{
Description = @"Set the background of the generated image(s). This parameter is only supported for
the GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default
value). When `auto` is used, the model will automatically determine the best
background for the image.

`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds
are available for supported GPT Image models. For `gpt-image-2` and
`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
set the output format to `png` or `webp`.
",
},
Style: new Option<global::tryAGI.OpenAI.CreateImageRequestStyle?>($"--{normalizedPrefix}style")
{
Description = @"Legacy style parameter for retired image models. Unsupported for GPT image models; describe the desired style in the prompt instead.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ internal static partial class FineTuningListPaginatedFineTuningJobsCommandApiCom
private static Option<global::System.Collections.Generic.Dictionary<string, string>?> Metadata { get; } = new(
name: @"--metadata")
{
Description = @"Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Alternatively, set `metadata=null` to indicate no metadata.
Description = @"Optional metadata filter. To filter, use the syntax `metadata[k]=v`. Omitting the parameter or passing an empty object applies no metadata filter. An empty value, such as `metadata[k]=`, filters for that key with an empty string value.
To select jobs with null metadata, send the literal query string `metadata=null`. Nullable caller types do not specify how a client serializes null for a deep-object parameter. Use a raw query parameter if the client omits null. Do not combine the two query forms.
",
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,52 @@ internal static partial class ImagesCreateImageAsStreamCommandApiCommand
Required = true,
};

private static Option<global::tryAGI.OpenAI.CreateImageRequestQuality?> Quality { get; } = new(
name: @"--quality")
{
Description = @"The quality of the image that will be generated.

- `auto` (default value) will automatically select the best quality for the given
model.
- `high`, `medium` and `low` are supported for the GPT image models.
- `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
snapshots, also support `xhigh` and `max`.
",
};

private static Option<global::tryAGI.OpenAI.CreateImageRequestOutputFormat?> OutputFormat { get; } = new(
name: @"--output-format")
{
Description = @"The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.",
};

private static Option<global::tryAGI.OpenAI.AnyOf<string, global::tryAGI.OpenAI.CreateImageRequestSize?>?> Size { get; } = new(
name: @"--size")
{
Description = @"The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing.",
};

private static Option<global::tryAGI.OpenAI.CreateImageRequestModeration?> Moderation { get; } = new(
name: @"--moderation")
{
Description = @"Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value).",
};

private static Option<global::tryAGI.OpenAI.CreateImageRequestBackground?> Background { get; } = new(
name: @"--background")
{
Description = @"Set the background of the generated image(s). This parameter is only supported for
the GPT image models. Must be one of `transparent`, `opaque`, or `auto` (default
value). When `auto` is used, the model will automatically determine the best
background for the image.

`gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds
are available for supported GPT Image models. For `gpt-image-2` and
`gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
set the output format to `png` or `webp`.
",
};
private static readonly CreateImageRequestOptionSet CreateImageRequestOptionSetOptions = CreateImageRequestOptionSet.Create();
private static Option<string?> Input { get; } = new(@"--input")
{
Expand All @@ -45,14 +86,14 @@ public static Command Create(string? commandName = null)
Creates an image given a prompt using a GPT Image model. [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
");
command.Options.Add(Model);
command.Options.Add(Size); command.Options.Add(CreateImageRequestOptionSetOptions.Prompt);
command.Options.Add(Quality);
command.Options.Add(OutputFormat);
command.Options.Add(Size);
command.Options.Add(Moderation);
command.Options.Add(Background); command.Options.Add(CreateImageRequestOptionSetOptions.Prompt);
command.Options.Add(CreateImageRequestOptionSetOptions.N);
command.Options.Add(CreateImageRequestOptionSetOptions.Quality);
command.Options.Add(CreateImageRequestOptionSetOptions.OutputFormat);
command.Options.Add(CreateImageRequestOptionSetOptions.OutputCompression);
command.Options.Add(CreateImageRequestOptionSetOptions.PartialImages);
command.Options.Add(CreateImageRequestOptionSetOptions.Moderation);
command.Options.Add(CreateImageRequestOptionSetOptions.Background);
command.Options.Add(CreateImageRequestOptionSetOptions.User);
command.Options.Add(Input);
command.Options.Add(RequestJson);
Expand Down Expand Up @@ -80,29 +121,29 @@ await CliRuntime.RunAsync(async () =>
global::tryAGI.OpenAI.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var model = parseResult.GetRequiredValue(Model);
var size = CliRuntime.WasSpecified(parseResult, Size) ? parseResult.GetValue(Size) : (__requestBase is { } __SizeBaseValue ? __SizeBaseValue.Size : default); var prompt = parseResult.GetRequiredValue(CreateImageRequestOptionSetOptions.Prompt);
var quality = CliRuntime.WasSpecified(parseResult, Quality) ? parseResult.GetValue(Quality) : (__requestBase is { } __QualityBaseValue ? __QualityBaseValue.Quality : default);
var outputFormat = CliRuntime.WasSpecified(parseResult, OutputFormat) ? parseResult.GetValue(OutputFormat) : (__requestBase is { } __OutputFormatBaseValue ? __OutputFormatBaseValue.OutputFormat : default);
var size = CliRuntime.WasSpecified(parseResult, Size) ? parseResult.GetValue(Size) : (__requestBase is { } __SizeBaseValue ? __SizeBaseValue.Size : default);
var moderation = CliRuntime.WasSpecified(parseResult, Moderation) ? parseResult.GetValue(Moderation) : (__requestBase is { } __ModerationBaseValue ? __ModerationBaseValue.Moderation : default);
var background = CliRuntime.WasSpecified(parseResult, Background) ? parseResult.GetValue(Background) : (__requestBase is { } __BackgroundBaseValue ? __BackgroundBaseValue.Background : default); var prompt = parseResult.GetRequiredValue(CreateImageRequestOptionSetOptions.Prompt);
var n = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.N) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.N) : (__requestBase is { } __NBaseValue ? __NBaseValue.N : default);
var quality = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.Quality) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.Quality) : (__requestBase is { } __QualityBaseValue ? __QualityBaseValue.Quality : default);
var outputFormat = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.OutputFormat) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.OutputFormat) : (__requestBase is { } __OutputFormatBaseValue ? __OutputFormatBaseValue.OutputFormat : default);
var outputCompression = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.OutputCompression) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.OutputCompression) : (__requestBase is { } __OutputCompressionBaseValue ? __OutputCompressionBaseValue.OutputCompression : default);
var partialImages = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.PartialImages) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.PartialImages) : (__requestBase is { } __PartialImagesBaseValue ? __PartialImagesBaseValue.PartialImages : default);
var moderation = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.Moderation) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.Moderation) : (__requestBase is { } __ModerationBaseValue ? __ModerationBaseValue.Moderation : default);
var background = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.Background) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.Background) : (__requestBase is { } __BackgroundBaseValue ? __BackgroundBaseValue.Background : default);
var user = CliRuntime.WasSpecified(parseResult, CreateImageRequestOptionSetOptions.User) ? parseResult.GetValue(CreateImageRequestOptionSetOptions.User) : (__requestBase is { } __UserBaseValue ? __UserBaseValue.User : default);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = client.Images.CreateImageAsStreamAsync(
model: model,
quality: quality,
outputFormat: outputFormat,
size: size,
moderation: moderation,
background: background,
prompt: prompt,
n: n,
quality: quality,
outputFormat: outputFormat,
outputCompression: outputCompression,
partialImages: partialImages,
moderation: moderation,
background: background,
user: user,
cancellationToken: cancellationToken);

Expand Down
Loading
Loading