Add optional animated GIF output to image generation (#59073)

## What changed

- Gate GIF output behind `features.image_generation_animation`, disabled by default.
- Accept `gif` options for generation and editing, with optional `frame_count` and `frame_duration_ms` controls. Use `gif: {}` for API defaults.
- Preserve animated output with `.gif` filenames and `image/gif` data URLs while providing a still preview to the model.
- Add guidance for simple animations and spritesheet-based GIF edits.

## Testing

Add integration coverage for GIF generation and editing, explicit frame controls and API defaults, saved animation bytes, and still-preview replay across follow-up turns.

GitOrigin-RevId: 08afa0316ae3675921652157836191a649f563cf
This commit is contained in:
Gan Tu
2026-11-03 06:24:24 +00:00
committed by copyberry
parent 29eed28082
commit f9e7b19df8
14 changed files with 548 additions and 43 deletions
+13
View File
@@ -384,6 +384,8 @@ pub enum Feature {
ExternalMigration,
/// Enable extension-backed image generation.
ImageGeneration,
/// Allow the image-generation tool to request a backend-assembled GIF.
ImageGenerationAnimation,
/// Omit inline image and audio content from app-server item notifications.
OmitAppServerNotificationMedia,
/// Tell the model when a prompt image was resized and include its dimensions.
@@ -632,6 +634,11 @@ impl Features {
self.enabled.contains(&f)
}
/// Whether to advertise GIF output in the image-generation tool.
pub fn image_generation_animation_enabled(&self) -> bool {
self.enabled(Feature::ImageGenerationAnimation)
}
/// Whether a routing tier is enabled, independently of model catalog support.
pub fn service_tier_enabled(&self, service_tier: &str) -> bool {
match service_tier {
@@ -1962,6 +1969,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::ImageGenerationAnimation,
key: "image_generation_animation",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::OmitAppServerNotificationMedia,
key: "omit_app_server_notification_media",