feat(cli): add support for custom base URL in Zed integration

This commit is contained in:
Shreya Keshive
2026-02-25 17:31:08 -05:00
parent 4aec3cdb24
commit c822dc4b32
4 changed files with 104 additions and 7 deletions
+2 -1
View File
@@ -1126,7 +1126,7 @@ export class Config {
return this.contentGenerator;
}
async refreshAuth(authMethod: AuthType, apiKey?: string) {
async refreshAuth(authMethod: AuthType, apiKey?: string, baseUrl?: string) {
// Reset availability service when switching auth
this.modelAvailabilityService.reset();
@@ -1153,6 +1153,7 @@ export class Config {
this,
authMethod,
apiKey,
baseUrl,
);
this.contentGenerator = await createContentGenerator(
newContentGeneratorConfig,
+8 -1
View File
@@ -82,6 +82,7 @@ export function getAuthTypeFromEnv(): AuthType | undefined {
export type ContentGeneratorConfig = {
apiKey?: string;
baseUrl?: string;
vertexai?: boolean;
authType?: AuthType;
proxy?: string;
@@ -91,6 +92,7 @@ export async function createContentGeneratorConfig(
config: Config,
authType: AuthType | undefined,
apiKey?: string,
baseUrl?: string,
): Promise<ContentGeneratorConfig> {
const geminiApiKey =
apiKey ||
@@ -119,6 +121,7 @@ export async function createContentGeneratorConfig(
if (authType === AuthType.USE_GEMINI && geminiApiKey) {
contentGeneratorConfig.apiKey = geminiApiKey;
contentGeneratorConfig.baseUrl = baseUrl;
contentGeneratorConfig.vertexai = false;
return contentGeneratorConfig;
@@ -206,7 +209,11 @@ export async function createContentGenerator(
'x-gemini-api-privileged-user-id': `${installationId}`,
};
}
const httpOptions = { headers };
const httpOptions: { headers: Record<string, string>; baseUrl?: string } =
{ headers };
if (config.baseUrl) {
httpOptions.baseUrl = config.baseUrl;
}
const googleGenAI = new GoogleGenAI({
apiKey: config.apiKey === '' ? undefined : config.apiKey,