Skip to content

feat(cli): Add --proxy support for network requests #1553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

LordVersA
Copy link

This commit introduces the '--proxy' command-line flag to allow users to specify a proxy server for all outbound network requests made by the Codex CLI.

Key changes:

  • Added the '--proxy' flag to 'codex-cli/src/cli.tsx'.
  • Updated 'codex-cli/src/utils/config.ts' to include the 'proxy' option in the application and stored configurations.
  • Refactored 'codex-cli/src/utils/agent/agent-loop.ts' to:
    • Accept the proxy URL via the constructor.
    • Use the provided proxy, falling back to the 'HTTPS_PROXY' environment variable if the flag is not set.
    • Centralize OpenAI client creation in a helper function to reduce code duplication.
  • Updated 'README.md' to document the new '--proxy' flag.

This change enhances the CLI's flexibility, enabling its use in restricted network environments where a proxy is required for internet access.

This commit introduces the '--proxy' command-line flag to allow users to specify a proxy server for all outbound network requests made by the Codex CLI.

Key changes:
- Added the '--proxy' flag to 'codex-cli/src/cli.tsx'.
- Updated 'codex-cli/src/utils/config.ts' to include the 'proxy' option in the application and stored configurations.
- Refactored 'codex-cli/src/utils/agent/agent-loop.ts' to:
  - Accept the proxy URL via the constructor.
  - Use the provided proxy, falling back to the 'HTTPS_PROXY' environment variable if the flag is not set.
  - Centralize OpenAI client creation in a helper function to reduce code duplication.
- Updated 'README.md' to document the new '--proxy' flag.

This change enhances the CLI's flexibility, enabling its use in restricted network environments where a proxy is required for internet access.
Copy link

github-actions bot commented Jul 12, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@LordVersA
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jul 12, 2025
@gui-baeta
Copy link

This is awesome. This is very useful!

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.

2 participants