fix: use LLM for unique video extension prompts; remove tokens on 400 email-domain-rejected#375
Open
crowwdev wants to merge 5 commits intochenyme:mainfrom
Open
Conversation
jiangmuran
added a commit
to jiangmuran/grok2api_pro
that referenced
this pull request
Mar 21, 2026
…s and auto-remove email-domain-rejected tokens - Video extension: Each extension round now gets a unique LLM-generated continuation prompt instead of reusing the original prompt, preventing repeated scenes in long videos - Token management: When a token refresh returns 400 with 'email-domain-rejected', the token is immediately removed from the pool - Modified files: video.py, video_extend.py, manager.py Upstream PR: chenyme#375
piexian
added a commit
to piexian/grok2api
that referenced
this pull request
Mar 22, 2026
上游来源与合并方式: - chenyme#366 chenyme#366 :手工移植 usage 估算与 responses usage 映射,按当前主线重接 chat/responses 接口,没有直接套用原 patch。 - chenyme#374 chenyme#374 :参考原始思路改为 app-chat 单链路接入,移除已不存在的 ws 回退,并补齐 request_overrides。 - chenyme#375 chenyme#375 :参考原始思路重写视频续写与 token 清理,不使用 localhost 自调用,直接复用现有 app-chat 请求链路,并处理 email-domain-rejected。 - chenyme#336 chenyme#336 :手工合并多图参考视频支持,保持旧 image_reference/image_url 兼容,仅在多图或 @图N 场景启用新链路。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Title
fix: use LLM for unique video extension prompts; remove tokens on 400 email-domain-rejected
Summary
Two independent fixes:
Video extension scene repetition — Each extension round now gets a unique LLM-generated continuation prompt instead of reusing the original prompt, preventing repeated scenes in long videos.
Auto-remove banned tokens — When a token refresh returns
400withemail-domain-rejectedin the response body, the token is immediately removed from the pool.Changes
app/services/grok/services/video.py_generate_continuation_prompt()usingcurl_cffi.requests.AsyncSession(no new dependencies)app.api_keyfrom config and setsAuthorizationheader if configured"stream": Falseexplicitly in the LLM requestgrok-3-fastmodel withtemperature=0.8,max_tokens=60_stream_chain()and_collect_chain()call LLM for each extension round (plan.is_extension == True)app/services/grok/services/video_extend.py_generate_continuation_promptfromvideo.pyapp/services/token/manager.pyrecord_fail(): whenstatus_code == 400and reason containsemail-domain-rejected, token is immediately removed from pool_refresh_one(): same check during cooling token refresh — 400 +email-domain-rejectedremoves token from pool instantlyVerification
email-domain-rejecteddisappear from pool immediately after next refresh cycle