Summary
Update OpenRouterProvider.generate_image() and vision.generate_image_openrouter() to support the latest OpenRouter image models and the expanded image_config options (aspect_ratio, image_size, super_resolution_references, font_inputs).
Context
OpenRouter has added several new image models since the original integration:
| Model |
Notes |
google/gemini-2.5-flash-image |
Nano Banana — GA, contextual understanding |
google/gemini-3.1-flash-image-preview |
Nano Banana 2 — Pro-level quality at Flash speed |
google/gemini-3-pro-image |
Nano Banana Pro — improved multimodal reasoning |
bytedance/seedream-4.5 |
ByteDance's latest, editing consistency |
openai/gpt-5-image |
GPT-5 with image gen, superior text rendering |
sourceful/riverflow-v2-pro |
SOTA with integrated reasoning model |
New image_config Parameters
{
"image_config": {
"aspect_ratio": "16:9",
"image_size": "2K",
"super_resolution_references": ["url1", "url2"],
"font_inputs": [{"font_url": "...", "text": "..."}]
}
}
- aspect_ratio: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 (+ 1:4, 4:1, 1:8, 8:1 for Gemini 3.1 Flash)
- image_size: 0.5K, 1K (default), 2K, 4K
- super_resolution_references: Up to 4 reference URLs for enhancing low-quality elements (Sourceful only, $0.20/ref)
- font_inputs: Up to 2 font inputs for text rendering (Sourceful only, $0.03/input)
Files
| File |
Change |
sdk/python/agentfield/vision.py |
Update generate_image_openrouter() to accept and pass image_config properly |
sdk/python/agentfield/media_providers.py |
Update OpenRouterProvider.generate_image() signature with aspect_ratio, image_size params that map to image_config |
Developer Experience
# New models work transparently
result = await app.ai_generate_image(
"A photorealistic sunset",
model="openrouter/openai/gpt-5-image",
)
# Aspect ratio and size control
result = await app.ai_generate_image(
"A landscape painting",
model="openrouter/google/gemini-3.1-flash-image-preview",
image_config={"aspect_ratio": "21:9", "image_size": "4K"},
)
# Super resolution
result = await app.ai_generate_image(
"Enhance this scene",
model="openrouter/sourceful/riverflow-v2-pro",
image_config={"super_resolution_references": ["https://example.com/highres.jpg"]},
)
Dependencies
Acceptance Criteria
Notes for Contributors
Severity: LOW — Enhancement to existing working feature.
The image_config is already partially supported via **kwargs passthrough, but it's not documented or explicitly handled. Making it a first-class parameter improves discoverability.
Summary
Update
OpenRouterProvider.generate_image()andvision.generate_image_openrouter()to support the latest OpenRouter image models and the expandedimage_configoptions (aspect_ratio, image_size, super_resolution_references, font_inputs).Context
OpenRouter has added several new image models since the original integration:
google/gemini-2.5-flash-imagegoogle/gemini-3.1-flash-image-previewgoogle/gemini-3-pro-imagebytedance/seedream-4.5openai/gpt-5-imagesourceful/riverflow-v2-proNew
image_configParameters{ "image_config": { "aspect_ratio": "16:9", "image_size": "2K", "super_resolution_references": ["url1", "url2"], "font_inputs": [{"font_url": "...", "text": "..."}] } }Files
sdk/python/agentfield/vision.pygenerate_image_openrouter()to accept and passimage_configproperlysdk/python/agentfield/media_providers.pyOpenRouterProvider.generate_image()signature withaspect_ratio,image_sizeparams that map toimage_configDeveloper Experience
Dependencies
Acceptance Criteria
image_configparameter properly passed through to OpenRouter APIaspect_ratioandimage_sizeconvenience params map toimage_configpytest sdk/python/passesruff check sdk/python/passesNotes for Contributors
Severity: LOW — Enhancement to existing working feature.
The
image_configis already partially supported via**kwargspassthrough, but it's not documented or explicitly handled. Making it a first-class parameter improves discoverability.