copilot-api-plus 1.2.43 → 1.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -2071,6 +2071,15 @@ async function tryDowngradeReasoningEffort(errMsg, retryContext, accountId) {
2071
2071
  }
2072
2072
  }
2073
2073
  /**
2074
+ * Whether a 400 error is caused by the request itself (model unavailable,
2075
+ * invalid params, etc.) rather than the account. These should NOT trigger
2076
+ * account disabling or rotation — rotating to another account would just
2077
+ * waste credits hitting the same error.
2078
+ */
2079
+ function isNonAccountError(errMsg) {
2080
+ return errMsg.includes("model_not_supported") || errMsg.includes("The requested model is not supported") || errMsg.includes("invalid_request_body") || errMsg.includes("invalid_request_error") || errMsg.includes("invalid_reasoning_effort") || errMsg.includes("reasoning_effort") || errMsg.includes("tool_choice");
2081
+ }
2082
+ /**
2074
2083
  * Handle an HTTP error from a multi-account request attempt.
2075
2084
  *
2076
2085
  * For 401 errors, attempts token refresh and retry.
@@ -2093,7 +2102,14 @@ async function handleMultiAccountHttpError(error, account, retryContext) {
2093
2102
  accountManager.markAccountStatus(account.id, "error", `HTTP ${error.response.status}`);
2094
2103
  return null;
2095
2104
  }
2096
- if (error.response.status === 400) return tryDowngradeReasoningEffort(error.message, retryContext, account.id);
2105
+ if (error.response.status === 400) {
2106
+ const downgraded = await tryDowngradeReasoningEffort(error.message, retryContext, account.id);
2107
+ if (downgraded !== null) return downgraded;
2108
+ if (isNonAccountError(error.message)) {
2109
+ error.__nonAccountError = true;
2110
+ return null;
2111
+ }
2112
+ }
2097
2113
  accountManager.markAccountStatus(account.id, "error", `HTTP ${error.response.status}`);
2098
2114
  return null;
2099
2115
  }
@@ -2152,6 +2168,7 @@ async function createWithMultiAccount(payload) {
2152
2168
  tokenSource
2153
2169
  });
2154
2170
  if (retryResult) return retryResult;
2171
+ if (error.__nonAccountError) throw error;
2155
2172
  } else accountManager.markAccountStatus(account.id, "error", error.message);
2156
2173
  consola.warn(`Account ${account.label} failed (attempt ${attempt + 1}), trying next...`);
2157
2174
  }