Skip to content

Documentation & Configuration Support for Corporate Proxies and Custom LLM Gateways #15543

@coygeek

Description

@coygeek

What would you like to be added?

I would like to request two related enhancements focused on enterprise environment configuration:

  1. Explicit Documentation for Proxies: Add a dedicated section to the documentation (e.g., docs/configuration/network.md) detailing how to configure the CLI behind corporate proxies. This should verify and document support for standard environment variables (HTTPS_PROXY, HTTP_PROXY, NO_PROXY) and how they interact with the CLI's internal fetch implementation (Undici).
  2. Support & Documentation for Custom LLM Gateways: Add configuration support (via settings.json or Environment Variable like GEMINI_API_BASE_URL) to override the default API endpoint.
    • Currently, packages/core/src/core/contentGenerator.ts initializes GoogleGenAI without an option to override the baseUrl.
    • This is required to route traffic through enterprise LLM Gateways (e.g., LiteLLM, Kong, Portkey) which mimic the Gemini API signature but run on custom domains.

Why is this needed?

  • Enterprise Adoption: Most enterprise developers operate behind strict corporate firewalls and proxies (e.g., Zscaler). Without clear documentation on how to configure the CLI for these network topologies, adoption is blocked.
  • Governance & Compliance: Large organizations often mandate the use of LLM Gateways to centralize API key management, log prompts for compliance, and enforce rate limits. The CLI currently defaults strictly to Google's public endpoints (generativelanguage.googleapis.com), bypassing these required internal gateways.
  • Debugging: Identifying network issues in restrictive environments is difficult without explicit configuration options.

Additional context

  • Current Proxy Logic: I noticed in packages/core/src/config/config.ts that proxy is populated via environment variables:

    proxy:
      process.env['HTTPS_PROXY'] ||
      process.env['https_proxy'] ||
      process.env['HTTP_PROXY'] ||
      process.env['http_proxy'],

    And subsequently set in packages/core/src/utils/fetch.ts using undici's setGlobalDispatcher. Documentation just needs to surface this behavior clearly to users.

  • Missing Gateway Logic: In packages/core/src/core/contentGenerator.ts, the GoogleGenAI client is initialized as follows:

    const googleGenAI = new GoogleGenAI({
      apiKey: config.apiKey === '' ? undefined : config.apiKey,
      vertexai: config.vertexai,
      httpOptions,
      // Missing: baseUrl or similar override
    });

    Adding support for a custom baseUrl here would enable compatibility with self-hosted gateways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/enterpriseIssues related to Telemetry, Policy, Quota / Licensing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions