Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
56a6c247
authored
Oct 09, 2025
by
Sh1n3zZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: gemini imagen quality value
parent
5f19d212
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletions
+28
-1
dto/gemini.go
+1
-0
relay/channel/gemini/adaptor.go
+27
-1
No files found.
dto/gemini.go
View file @
56a6c247
...
...
@@ -329,6 +329,7 @@ type GeminiImageParameters struct {
SampleCount
int
`json:"sampleCount,omitempty"`
AspectRatio
string
`json:"aspectRatio,omitempty"`
PersonGeneration
string
`json:"personGeneration,omitempty"`
ImageSize
string
`json:"imageSize,omitempty"`
}
type
GeminiImageResponse
struct
{
...
...
relay/channel/gemini/adaptor.go
View file @
56a6c247
...
...
@@ -67,8 +67,12 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
aspectRatio
=
size
}
else
{
switch
size
{
case
"1024x1024"
:
case
"
256x256"
,
"512x512"
,
"
1024x1024"
:
aspectRatio
=
"1:1"
case
"1536x1024"
:
aspectRatio
=
"3:2"
case
"1024x1536"
:
aspectRatio
=
"2:3"
case
"1024x1792"
:
aspectRatio
=
"9:16"
case
"1792x1024"
:
...
...
@@ -91,6 +95,28 @@ func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInf
},
}
// Set imageSize when quality parameter is specified
// Map quality parameter to imageSize (only supported by Standard and Ultra models)
// quality values: auto, high, medium, low (for gpt-image-1), hd, standard (for dall-e-3)
// imageSize values: 1K (default), 2K
// https://ai.google.dev/gemini-api/docs/imagen
// https://platform.openai.com/docs/api-reference/images/create
if
request
.
Quality
!=
""
{
imageSize
:=
"1K"
// default
switch
request
.
Quality
{
case
"hd"
,
"high"
:
imageSize
=
"2K"
case
"2K"
:
imageSize
=
"2K"
case
"standard"
,
"medium"
,
"low"
,
"auto"
,
"1K"
:
imageSize
=
"1K"
default
:
// unknown quality value, default to 1K
imageSize
=
"1K"
}
geminiRequest
.
Parameters
.
ImageSize
=
imageSize
}
return
geminiRequest
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment