mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Adds support for enterprise LLM gateways through TOML configuration files,
enabling OpenHands CLI usage in corporate environments with custom API
management solutions.
Features:
- Load gateway configuration from TOML file via --gateway-config flag
- Support for environment variable OPENHANDS_GATEWAY_CONFIG
- Environment variable expansion in config values (${ENV:VAR_NAME})
- Comprehensive example configuration file with documentation
- Clean separation from interactive setup flow
Implementation:
- Added gateway_config.py module for loading and parsing TOML configs
- Thread gateway config through CLI entry to agent initialization
- Apply gateway settings when creating LLM instance
- Update tests to handle new gateway_config_path parameter
- Remove interactive gateway setup to keep UI simple
This enables enterprise customers to configure:
- OAuth2/token authentication with identity providers
- Custom headers for routing and authorization
- Request body parameters for compliance/monitoring
- All without impacting the standard user experience
Note: Requires openhands-sdk>=1.0.0a6 once the SDK PR is merged.
Currently set to >=1.0.0a4 for compatibility.
OpenHands V1 CLI
A lightweight, modern CLI to interact with the OpenHands agent (powered by agent-sdk).
The OpenHands V0 CLI (legacy) is being deprecated.
Quickstart
- Prerequisites: Python 3.12+, curl
- Install uv (package manager):
curl -LsSf https://astral.sh/uv/install.sh | sh # Restart your shell so "uv" is on PATH, or follow the installer hint
Run the CLI locally
make install
# Start the CLI
make run
# or
uv run openhands
Build a standalone executable
# Build (installs PyInstaller if needed)
./build.sh --install-pyinstaller
# The binary will be in dist/
./dist/openhands # macOS/Linux
# dist/openhands.exe # Windows
Enterprise Gateway Support
For enterprise users with custom LLM gateways, you can provide a gateway configuration file to handle authentication and custom headers/parameters.
Using Gateway Configuration
# Using command line flag
uv run openhands --gateway-config ~/mycompany-gateway.toml
# Or using environment variable
export OPENHANDS_GATEWAY_CONFIG=~/mycompany-gateway.toml
uv run openhands
See examples/gateway-config-example.toml for a complete configuration example with comments.
Key Features
- OAuth2/Token Exchange: Automatically handles token acquisition and refresh
- Custom Headers: Add headers required by your gateway
- Environment Variables: Use
${ENV:VAR_NAME}syntax for sensitive values - Extra Body Parameters: Include additional fields in LLM request bodies
- TOML Format: Clean, readable configuration with comments