fix: reuse relay key across video endpoint fallback
This commit is contained in:
1 parent
7a996755b2
commit
6095a9e1cc
1 file changed
+6
-4
+6
-4
@@ -121,14 +121,15 @@ public class AsyncProviderClient {
|
||||
// The standard OpenAI video endpoint is multipart even when no
|
||||
// reference file is supplied. JSON requests are rejected by the
|
||||
// official API and by relays that proxy it faithfully.
|
||||
String apiKey = provider.nextApiKey();
|
||||
try {
|
||||
return requestMultipart("POST", base + "/videos", provider.nextApiKey(), body,
|
||||
return requestMultipart("POST", base + "/videos", apiKey, body,
|
||||
media == null ? null : "input_reference", media, "上游视频任务创建失败");
|
||||
} catch (ApiException first) {
|
||||
// A few older relays retained /videos/generations. Retry only
|
||||
// on a route miss; authentication/credit errors are returned.
|
||||
if (!isNotFound(first)) throw first;
|
||||
return requestMultipart("POST", base + "/videos/generations", provider.nextApiKey(), body,
|
||||
return requestMultipart("POST", base + "/videos/generations", apiKey, body,
|
||||
media == null ? null : "input_reference", media, "上游视频任务创建失败");
|
||||
}
|
||||
}
|
||||
@@ -168,11 +169,12 @@ public class AsyncProviderClient {
|
||||
|
||||
private Map<String,Object> pollOpenAiCompatible(Provider provider, String providerTaskId) {
|
||||
String base = trim(provider.baseUrl());
|
||||
String apiKey = provider.nextApiKey();
|
||||
try {
|
||||
return request("GET", base + "/videos/" + encode(providerTaskId), provider.nextApiKey(), null, "上游异步任务查询失败");
|
||||
return request("GET", base + "/videos/" + encode(providerTaskId), apiKey, null, "上游异步任务查询失败");
|
||||
} catch (ApiException first) {
|
||||
if (!isNotFound(first)) throw first;
|
||||
return request("GET", base + "/videos/generations/" + encode(providerTaskId), provider.nextApiKey(), null, "上游异步任务查询失败");
|
||||
return request("GET", base + "/videos/generations/" + encode(providerTaskId), apiKey, null, "上游异步任务查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user