Skip to content

Commit 19f8e21

Browse files
quinnypigclaude
andcommitted
fix: the model was speaking but nobody told it to answer in pictures.
responseModalities: ["TEXT", "IMAGE"] — two words that Google made mandatory around March 12th without updating the deprecation calendar. the model name was fine. the parameters were fine. the API just stopped inferring that an image generation request should return images. the old request: here is a picture, here is a prompt, make me a picture. the API: I see no explicit instruction to return images. request denied. "Request contains an invalid argument." the argument it wanted was permission to do what it was already designed to do. reverted gemini-3.1-pro-image-preview back to gemini-3-pro-image-preview. the model was never deprecated. only its willingness to cooperate without paperwork. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c97556d commit 19f8e21

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

pkg/gemini/client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
const (
15-
ModelName = "gemini-3.1-pro-image-preview"
15+
ModelName = "gemini-3-pro-image-preview"
1616
ModelNameFrugal = "gemini-3.1-flash-image-preview" // Nano Banana 2
1717
BaseURL = "https://generativelanguage.googleapis.com/v1beta/models"
1818
FilenameSuffix = "\n\nAfter generating the image, respond with a short (2-4 word) evocative filename for it. Just the words, no extension."
@@ -86,7 +86,8 @@ type GenerateRequest struct {
8686

8787
// GenerationConfig represents generation configuration
8888
type GenerationConfig struct {
89-
ImageConfig *ImageConfig `json:"imageConfig,omitempty"`
89+
ResponseModalities []string `json:"responseModalities,omitempty"`
90+
ImageConfig *ImageConfig `json:"imageConfig,omitempty"`
9091
}
9192

9293
// ImageConfig represents image-specific configuration
@@ -301,7 +302,8 @@ func (c *Client) GenerateContentWithFullOptions(prompt string, imagesBase64 []st
301302
imageConfig.ImageSize = imageSize
302303

303304
reqBody.GenerationConfig = &GenerationConfig{
304-
ImageConfig: imageConfig,
305+
ResponseModalities: []string{"TEXT", "IMAGE"},
306+
ImageConfig: imageConfig,
305307
}
306308

307309
jsonData, err := json.Marshal(reqBody)

0 commit comments

Comments
 (0)