Bug Report: image_config.image_size: "0.5K" returns 400 from Google provider
Model: google/gemini-3.1-flash-image-preview (Nano Banana 2)
Issue: Setting image_size: "0.5K" passes OpenRouter's input validation but Google returns INVALID_ARGUMENT. Using debug.echo_upstream_body reveals the root cause: OpenRouter passes image_size as-is to Google's API, but Google expects outputImageSize as the key name inside imageConfig.
Steps to reproduce:
This returns 400
curl https://openrouter.ai/api/v1/chat/completions
-H "Authorization: Bearer $KEY"
-H "Content-Type: application/json"
-d '{
"model": "google/gemini-3.1-flash-image-preview",
"modalities": ["image", "text"],
"image_config": { "image_size": "0.5K" },
"messages": [{"role": "user", "content": "Draw a green circle"}]
}'
Debug echo output (with stream: true and debug.echo_upstream_body: true):
"generationConfig": {
"responseModalities": ["image", "text"],
"imageConfig": { "image_size": "0.5K" },
...
}
Expected upstream body:
"imageConfig": { "outputImageSize": "IMAGE_SIZE_512" }
Google's native Gemini API uses outputImageSize with enum values like IMAGE_SIZE_512, IMAGE_SIZE_1024, etc. OpenRouter needs to map image_size: "0.5K" → outputImageSize: "IMAGE_SIZE_512".
Note: image_size: "1K" doesn't error because 1024 is Google's default — the invalid key is silently ignored and the default applies. So 1K appears to "work" but isn't actually being processed either.
Workaround attempted: Setting outputImageSize: "0.5K" directly in image_config — OpenRouter filters it out (only whitelists image_size and aspect_ratio keys).
Environment: OpenRouter API, March 2026. Provider routes observed: Google and Google AI Studio.