Skip to content

Commit 43a1b6b

Browse files
authored
Add ExtendVideo RPC and reference_images for Video Generation (#41)
- Add `ExtendVideo` RPC for extending existing videos with continuation content, accepting a prompt, source video, model, and optional duration (1-10s). - Add repeated `reference_images` field to `GenerateVideoRequest` for reference-to-video (R2V) generation. - Add `progress` field to `VideoResponse` for tracking completion percentage (0-100) across `PENDING`, `DONE`, and `FAILED` states. - Remove unused `VideoOutput` message.
1 parent 2b1a1fc commit 43a1b6b

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

proto/xai/api/v1/video.proto

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ service Video {
6565
// request_id that can be used to poll for the result using GetDeferredVideo.
6666
rpc GenerateVideo(GenerateVideoRequest) returns (StartDeferredResponse) {}
6767

68-
// Gets the result of a video generation started by calling `GenerateVideo`.
69-
rpc GetDeferredVideo(GetDeferredVideoRequest) returns (GetDeferredVideoResponse) {}
70-
}
68+
// Extend an existing video by generating continuation content.
69+
//
70+
// This is an asynchronous operation. The method returns immediately with a
71+
// request_id that can be used to poll for the result using GetDeferredVideo.
72+
rpc ExtendVideo(ExtendVideoRequest) returns (StartDeferredResponse) {}
7173

72-
// Output destination for generated video.
73-
message VideoOutput {
74-
// Signed URL to upload the generated video via HTTP PUT.
75-
string upload_url = 1;
74+
// Gets the result of a video generation started by calling `GenerateVideo` or
75+
// `ExtendVideo`.
76+
rpc GetDeferredVideo(GetDeferredVideoRequest) returns (GetDeferredVideoResponse) {}
7677
}
7778

7879
// Request message for generating a video.
@@ -104,6 +105,11 @@ message GenerateVideoRequest {
104105
// Optional resolution for video generation.
105106
// Defaults to 480p if not specified.
106107
optional VideoResolution resolution = 8;
108+
109+
// Optional reference images for reference-to-video (R2V) generation.
110+
// When provided (and `image` is not set), generates video using these images
111+
// as style/content references.
112+
repeated ImageUrlContent reference_images = 13;
107113
}
108114

109115
// Request for retrieving deferred video generation results.
@@ -120,13 +126,20 @@ message VideoResponse {
120126
// The model used to generate the video (ignoring aliases).
121127
string model = 2;
122128

123-
// The usage of the request.
129+
// Billing and cost information for this request.
124130
SamplingUsage usage = 3;
125131

126132
// Structured error describing why video generation failed.
127133
// Only present when the background generation encountered a failure
128134
// (either client error 4xx or server error 5xx).
129135
optional VideoError error = 6;
136+
137+
// Approximate completion percentage for the video generation task (0-100).
138+
// - When status is `PENDING`: progress is between 0-99, indicating current
139+
// completion.
140+
// - When status is `DONE`: progress is 100.
141+
// - When status is `FAILED`: progress is 0.
142+
int32 progress = 7;
130143
}
131144

132145
// Contains all data related to a generated video.
@@ -149,7 +162,8 @@ message GetDeferredVideoResponse {
149162
// Current status of the request.
150163
DeferredStatus status = 1;
151164

152-
// Response. Only present if `status=DONE`
165+
// Response. Only present if `status=DONE` or `status=FAILED`.
166+
// When failed, the `error` field in VideoResponse describes the failure.
153167
optional VideoResponse response = 2;
154168
}
155169

@@ -160,3 +174,21 @@ message VideoError {
160174
// Human-readable error message describing the failure.
161175
string message = 2;
162176
}
177+
178+
// Request message for extending an existing video.
179+
message ExtendVideoRequest {
180+
// Prompt describing what should happen next in the video.
181+
string prompt = 1;
182+
183+
// Input video to extend. The extension continues from the end of this video.
184+
// Supports URL or base64-encoded video data.
185+
// Input video must be between 2 and 30 seconds long.
186+
VideoUrlContent video = 2;
187+
188+
// Name or alias of the video generation model to be used.
189+
string model = 3;
190+
191+
// Duration of the extension segment to generate in seconds (1-10).
192+
// Defaults to 6 seconds if not specified.
193+
optional int32 duration = 4;
194+
}

0 commit comments

Comments
 (0)