Skip to content

Studio: add the OpenAI videos API on /v1/videos - #9891

Merged
Etherll merged 31 commits into
unslothai:mainfrom
NilayYadav:openai-videos-api
Aug 28, 2026
Merged

Etherll merged 31 commits into
unslothai:mainfrom
NilayYadav:openai-videos-api

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

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.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 27, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 27, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@Etherll Etherll self-assigned this Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 28, 2026
@Etherll

Etherll commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread studio/backend/routes/video.py Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Etherll

Etherll commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 871b7e8ac0

ℹ️ 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".

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-28T22:11:21.997720Z 3903200 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +207 to +208
"/api/inference/videos": VIDEO,
"/v1/videos": VIDEO,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Etherll

Etherll commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 3903200bc6

ℹ️ 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".

@Etherll Etherll left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested this end to end in colab , lgtm !

@Etherll
Etherll merged commit 7872208 into unslothai:main Aug 28, 2026
45 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants