fix(litellm): ensure API key retry prompts for new key

- Clear CLI-provided API key and token options when retrying
- Forces fresh prompt instead of reusing old credentials
- Consistent behavior with base URL retry

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Charles-Henri ROBICHE 2026-01-29 10:32:10 +01:00
parent f901884913
commit aa0d7563ff
No known key found for this signature in database

View File

@ -804,11 +804,18 @@ export async function applyAuthChoiceApiProviders(
}
if (action === "retry-apikey") {
// Re-prompt for API key and retry
apiKey = await promptForApiKey();
await setLitellmApiKey(apiKey, params.agentDir);
// Retry fetch by recursively calling this function
return await applyAuthChoiceApiProviders({ ...params, authChoice: "litellm-api-key" });
// Re-prompt for API key and retry the entire flow
// Clear the CLI-provided options to force prompting
const newParams = {
...params,
authChoice: "litellm-api-key" as const,
opts: {
...params.opts,
litellmApiKey: undefined, // Clear the CLI-provided API key so we can prompt
token: undefined, // Also clear token if it was used
},
};
return await applyAuthChoiceApiProviders(newParams);
}
if (action === "retry-baseurl") {