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
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