Skip to content

Commit 1ece97a

Browse files
authored
feat(provider/google): add support for new Google image model aspect ratios and sizes (#12897)
## Background With the launch of Gemini 3.1 Image, a few new image aspect ratios and one new size were introduced. Reference from the source: googleapis/python-genai@8b2a4e0 ## Summary Adds the new image aspect ratios. ## Manual Verification Run the updated example. ## Checklist - [ ] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review) ## Future Work N/A ## Related Issues N/A
1 parent 9900541 commit 1ece97a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.changeset/friendly-onions-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ai-sdk/google': patch
3+
---
4+
5+
feat(provider/google): add support for new Google image model aspect ratios and sizes

examples/ai-functions/src/generate-image/google/gemini-3-1-flash-image.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { google } from '@ai-sdk/google';
1+
import { google, GoogleLanguageModelOptions } from '@ai-sdk/google';
22
import { generateImage } from 'ai';
33
import { run } from '../../lib/run';
44
import { presentImages } from '../../lib/present-image';
@@ -7,6 +7,7 @@ run(async () => {
77
const { images } = await generateImage({
88
model: google.image('gemini-3.1-flash-image-preview'),
99
prompt: 'A nano banana in a fancy restaurant',
10+
aspectRatio: '4:1',
1011
});
1112

1213
presentImages(images);

packages/google/src/google-generative-ai-options.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,13 @@ export const googleLanguageModelOptions = lazySchema(() =>
181181
'9:16',
182182
'16:9',
183183
'21:9',
184+
'1:8',
185+
'8:1',
186+
'1:4',
187+
'4:1',
184188
])
185189
.optional(),
186-
imageSize: z.enum(['1K', '2K', '4K']).optional(),
190+
imageSize: z.enum(['1K', '2K', '4K', '512']).optional(),
187191
})
188192
.optional(),
189193

0 commit comments

Comments
 (0)