Studio: add the OpenAI videos API on /v1/videos - #9891
Conversation
acbf47e to
377b26e
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a215130ce5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| raise HTTPException(status_code = 503, detail = _NO_VIDEO_MODEL_MSG) | ||
| from core.inference.video_minimax_h3 import H3_TASK_REFERENCES | ||
|
|
||
| ref2va = status.get("h3_task") == H3_TASK_REFERENCES |
There was a problem hiding this comment.
Classify references after reserving the model
When model is omitted or auto-switching is disabled, a direct model load can commit between this status() snapshot and begin_generate(). The reference is then routed according to the old H3 partition: a keyframe-to-Ref2VA change passes it as first_frame, while the reverse passes it in reference_images. Although begin_generate() deliberately reserves and validates against the new state, either case is rejected as unsupported conditioning even though the newly resident partition could accept the same image in the other field. Resolve the conditioning mode from the state actually reserved by begin_generate() rather than this earlier snapshot.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 871b7e8. The route now passes input_reference to begin_generate without deciding between keyframe and Ref2VA conditioning. begin_generate classifies it inside the exact resident-state retry loop, so a partition swap cannot send the image through stale conditioning. Added a deterministic keyframe-to-Ref2VA reservation race test.
|
@codex review |
for more information, see https://pre-commit.ci
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3dce83cab7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "/api/inference/videos": VIDEO, | ||
| "/v1/videos": VIDEO, |
There was a problem hiding this comment.
Track admitted keyless video requests in the media drain
When keyless API access admits POST /v1/videos without an Authorization header, LlamaKeepWarmMiddleware explicitly clears media_owner, so these new path entries do not increment the VIDEO tracker. However, maybe_auto_switch_media_model() always calls drain() as though the current request were counted, and drain() subtracts one from the tracker. If another authenticated video request has crossed the admission gate but has not yet called begin_generate(), a concurrent keyless auto-switch can therefore discount that other request, evict its resident model, and make it generate against the replacement. Track admitted keyless requests after authentication or pass whether the current request was actually counted into the drain logic.
Useful? React with 👍 / 👎.
for more information, see https://pre-commit.ci
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Etherll
left a comment
There was a problem hiding this comment.
tested this end to end in colab , lgtm !
Studio can generate video, but only through its own routes. Tools built on the OpenAI SDK could not use it.
This adds the OpenAI videos endpoints: POST /v1/videos to start a clip, GET /v1/videos/{id} to check on it, GET /v1/videos/{id}/content to download the MP4, GET /v1/videos to list clips, and DELETE /v1/videos/{id} to remove one. client.videos.create, poll, download_content, list and delete all work as they do against OpenAI.
The id handed back when a job starts is also the id the finished clip is saved under, so one id is enough to check progress, download the file, and delete it later. Clips made from the Video page show up in the list too. The size and seconds options map onto what the loaded model supports; sizes it cannot render are refused with a clear message. A reference image can be sent to models that accept one.
Includes fixes found while testing: no host paths in the model field, images uploaded without a proper content type are recognised by their bytes, uploads sent without a content length are accepted up to the normal size cap, and very short durations produce a real clip rather than a single frame.