diff --git a/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncProviderClient.java b/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncProviderClient.java index 1120878..f4575cc 100644 --- a/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncProviderClient.java +++ b/control-plane-java/src/main/java/com/moyi/controlplane/task/AsyncProviderClient.java @@ -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 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, "上游异步任务查询失败"); } }