[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Feedback](/c/feedback/8)

# Support imageConfig for Google Gemini 4K images in AI Gateway REST API

62 views · 0 likes · 3 posts


Vrkairo 1120 (@vrkairo-1120) · 2026-01-29

## Summary

The AI Gateway REST API (`ai-gateway.vercel.sh/v1/chat/completions`) doesn’t support `imageConfig` parameters for Google Gemini image models.

AI SDK already supports this via `providerOptions.google.imageConfig` (PR #12059), but REST API users cannot access 4K image generation.

## Current Behavior

```bash
curl -X POST "https://ai-gateway.vercel.sh/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "google/gemini-3-pro-image",
    "messages": [{"role": "user", "content": "A landscape"}],
    "modalities": ["text", "image"],
    "imageConfig": { "aspectRatio": "16:9", "imageSize": "4K" }
  }'
```

**Result**: `imageConfig` ignored, images generated at default 1K resolution.

## Expected Behavior

Gateway should passthrough `imageConfig` to Google API:

- `imageSize`: `"1K"` | `"2K"` | `"4K"` 
- `aspectRatio`: `"1:1"` | `"16:9"` | `"9:16"` etc.

## Use Cases

- 4K images for print/marketing materials
- Platform-specific aspect ratios (Instagram, YouTube, TikTok)
- Non-TypeScript environments (Python, Go, `curl`) need REST API access

## Related

- AI SDK support: [PR #12059](https://github.com/vercel/ai/pull/12059), [Issue #11924](https://github.com/vercel/ai/issues/11924)
- Google docs: https://ai.google.dev/gemini-api/docs/image-generation


Pauline P. Narvas (@pawlean) · 2026-01-29

Thanks for reporting this feature gap! You're correct - while the AI SDK supports `imageConfig` for Google Gemini models (via PR #12059), this isn't currently available through the AI Gateway REST API.

You could try the following workarounds though:

1. Use the AI SDK with TypeScript (already supports this)
2. If using BYOK, make direct calls to Google's API with imageConfig parameters
Thanks again! Keep an eye out for updates :)


René Schubert (@renet) · 2026-03-05

Thanks for pointing to the [PR](https://github.com/vercel/ai/pull/12059), it helped me understand a bit more. However I’m not sure about the difference between

```ts
generateText({
  model: google("gemini-3-pro-image-preview"), // from the test in the PR
  /* … */
});
```
and
```ts
generateText({
  model: "google/gemini-3-pro-image", // what we're using
  /* … */
});
```

Is it basically the same and for both the structure of the `providerOptions` should be
```ts
providerOptions: {
  google: {
    responseModalities: ['TEXT', 'IMAGE'],
    imageConfig: {
      aspectRatio: '16:9',
      imageSize: '4K',
    },
  },
},
```
or does it differ, depending on whether I use `@ai-sdk/google` or not?