Skip to content

feat(web): add HTTP proxy support via environment variables (#913)#1479

Open
huboqiang wants to merge 1 commit intoMoonshotAI:mainfrom
huboqiang:fix-http-proxy-support
Open

feat(web): add HTTP proxy support via environment variables (#913)#1479
huboqiang wants to merge 1 commit intoMoonshotAI:mainfrom
huboqiang:fix-http-proxy-support

Conversation

@huboqiang
Copy link

@huboqiang huboqiang commented Mar 17, 2026


Related Issue

Closes #913

Description

In environments that require HTTP/HTTPS proxy access (e.g., corporate networks or restricted regions), Kimi CLI previously could not
connect to the API because aiohttp.ClientSession was created without proxy configuration.

This PR adds support for standard proxy environment variables, allowing users to configure proxy settings without modifying code or
configuration files:

  • Automatic proxy detection: Reads HTTPS_PROXY/https_proxy/HTTP_PROXY/http_proxy environment variables
  • Priority-based selection: HTTPS_PROXY > https_proxy > HTTP_PROXY > http_proxy, ensuring the most specific setting takes precedence
  • Backward compatible: When no proxy variables are set, behavior remains unchanged

Changes

  • src/kimi_cli/utils/aiohttp.py: Added proxy environment variable detection and proxy parameter to ClientSession
  • tests/utils/test_aiohttp.py: Added 8 test cases covering no-proxy, 4 env var variants, 2 priority scenarios, and SSL connector
    configuration
  • CHANGELOG.md: Added entry for HTTP proxy support
  • docs/en/configuration/env-vars.md: Added Network proxy section with usage examples
  • docs/zh/configuration/env-vars.md: Added 网络代理章节(中文翻译)
  • docs/en/release-notes/changelog.md: Synced changelog update
  • docs/zh/release-notes/changelog.md: Synced changelog update (中文翻译)

Checklist

  • I have read the CONTRIBUTING document.

  • I have linked the related issue, if any.

  • I have added tests that prove my fix is effective or that my feature works.

  • I have run make gen-changelog to update the changelog.

  • I have run make gen-docs to update the user documentation.



Open with Devin

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@huboqiang huboqiang force-pushed the fix-http-proxy-support branch from 334d7a2 to 7790072 Compare March 17, 2026 12:43
…AI#913)

Support HTTP/HTTPS proxy configuration through standard environment

variables: HTTPS_PROXY, https_proxy, HTTP_PROXY, http_proxy.

This enables Kimi CLI to work properly in environments that require

proxy access to reach the API.

Fixes MoonshotAI#913

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support http & socks proxy true

1 participant