-
Notifications
You must be signed in to change notification settings - Fork 11.2k
feat: add OpenAI video provider failover #5117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ViperCai
wants to merge
36
commits into
QuantumNous:main
Choose a base branch
from
ViperCai:feature/openai-video-failover
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
3ffc068
feat: add OpenAI video provider failover
ViperCai e90a2c1
feat: add OpenAI video provider failover
ViperCai 42c4d46
docs: record new server access notes
ViperCai 9a3a371
merge: sync with upstream main (78 commits)
ViperCai a3ad449
docs: 2026-05-28 全模型回归验证 + 文档更新
ViperCai 224d358
docs: fix grok-video-api.md old API key
ViperCai ae376ab
feat: add ListenHub image channel
ViperCai d7c2d7b
feat: add SiliconFlow image models
ViperCai 8783484
chore: ignore local generated artifacts
ViperCai 17aba3d
Merge remote-tracking branch 'origin/main' into feature/openai-video-…
ViperCai 61e1ddb
docs: document upstream merge workflow
ViperCai bdea10a
docs: record upstream merge deployment
ViperCai 93ab7a7
docs: improve AI-friendly API usage guide
ViperCai 6135dd1
docs: retain internal test API key
ViperCai e5500a5
fix: stabilize image generation routing
ViperCai 98cb125
docs: clarify model routing
ViperCai 4731254
docs: update image routing guidance
ViperCai 48f8be8
fix: retry image generation on upstream quota errors
ViperCai f24287c
Merge remote-tracking branch 'origin/main' into feature/openai-video-…
ViperCai 0399d58
fix: tolerate empty channel_info when scanning from database
ViperCai dbee0f0
docs: record upstream merge and channel_info fix deployment
ViperCai e46bd6e
fix: classify dash-named gemini 3.x preview models as image generation
ViperCai 5e06210
docs: record listenhub priority drop and gemini dash-name remap to ap…
ViperCai 51d62fc
docs: add multi-channel failover design review and onboarding checklist
ViperCai b38e056
feat: add quota error cooldown and configurable quota keywords
ViperCai 83b8540
docs: record quota cooldown deployment and mark roadmap items done
ViperCai c3eea86
feat: add manxiaobai video provider and model pricing
ViperCai 3b8fb58
fix: detect quota errors relayed with upstream error codes
ViperCai 2c558a2
fix: keep priority bucket indexing stable under quota cooldown
ViperCai b4a01f4
docs: record manxiaobai onboarding and failover verification
ViperCai 909e359
fix: submit manxiaobai video tasks as multipart form
ViperCai fbed8de
fix: proxy video content via upstream auth endpoint when no result url
ViperCai e454011
fix: detect self-referential proxy result url in video content relay
ViperCai b3c2ef9
docs: record manxiaobai activation and full-path verification
ViperCai c10ec53
docs: refresh routing, pricing and verification records across docs
ViperCai 6ccdc9f
feat: 下游平台余额统一查询与总览接口
ViperCai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package common | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/QuantumNous/new-api/constant" | ||
| ) | ||
|
|
||
| func TestIsImageGenerationModelIncludesConfiguredImageModels(t *testing.T) { | ||
| models := []string{ | ||
| "gpt-image-2(线路XF)", | ||
| "gr-image-2", | ||
| "gemini-2.5-flash-image", | ||
| "gemini-2.5-flash-image-preview", | ||
| "gemini-3-pro-image-preview", | ||
| "gemini-3.1-flash-image-preview", | ||
| "nano-banana", | ||
| "nano-banana-hd", | ||
| "nano-banana-pro", | ||
| } | ||
|
|
||
| for _, model := range models { | ||
| t.Run(model, func(t *testing.T) { | ||
| if !IsImageGenerationModel(model) { | ||
| t.Fatalf("IsImageGenerationModel(%q) = false, want true", model) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestImageModelsEnableImageGenerationEndpoint(t *testing.T) { | ||
| endpoints := GetEndpointTypesByChannelType(constant.ChannelTypeOpenAIVideo, "gr-image-2") | ||
| if len(endpoints) == 0 || endpoints[0] != constant.EndpointTypeImageGeneration { | ||
| t.Fatalf("OpenAI video image model endpoints = %#v, want image generation first", endpoints) | ||
| } | ||
|
|
||
| endpoints = GetEndpointTypesByChannelType(constant.ChannelTypeOpenAI, "nano-banana-pro") | ||
| if len(endpoints) == 0 || endpoints[0] != constant.EndpointTypeImageGeneration { | ||
| t.Fatalf("OpenAI image model endpoints = %#v, want image generation first", endpoints) | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over-broad XB-Sora detection can break non-XB video providers.
Classifying any base URL ending with
/v1or/api/v1as XB-Sora will forceX-API-Key+ XB-specific parsing for standard OpenAI-compatible providers that still require Bearer auth.💡 Proposed fix
func isXBSoraModelsAPI(baseURL string) bool { baseURL = strings.ToLower(strings.TrimRight(strings.TrimSpace(baseURL), "/")) return strings.Contains(baseURL, "xb-sora2") || strings.Contains(baseURL, "xbsora2") || strings.Contains(baseURL, "xb-sora") || - strings.Contains(baseURL, "xbsora") || - strings.HasSuffix(baseURL, "/api/v1") || - strings.HasSuffix(baseURL, "/v1") + strings.Contains(baseURL, "xbsora") }🤖 Prompt for AI Agents