-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Problem
Currently, ops0-cli is hardcoded to use https://api.anthropic.com as the API endpoint. This limits users who want to:
- Use proxy servers or custom gateways for API access
- Connect to Claude-compatible API services (e.g., third-party providers)
- Work in enterprise environments with custom endpoints or air-gapped setups
- Use regional API endpoints for better latency or compliance
Proposed Solution
Add support for OPS0_API_BASE_URL environment variable to allow custom API server configuration.
Environment Variable
export OPS0_API_BASE_URL=https://custom-api.example.comNaming Rationale
- Uses
OPS0_prefix to match existing convention (OPS0_AI_MODEL,OPS0_MAX_TOKENS) API_BASE_URLclearly indicates it is the base URL for API calls- Not tied to specific provider name (more flexible than
ANTHROPIC_API_SERVER)
Benefits
- Flexibility: Enables use of Claude-compatible services and custom endpoints
- Enterprise Support: Works with corporate proxies and custom gateways
- Backward Compatibility: Defaults to official Anthropic API when not set
- Consistency: Follows existing naming convention for environment variables
Implementation Details
Changes Required
- Add
APIBaseURLfield toClaudeConfigstruct indefinitions.go - Update
callClaude()function inllms.goto use configurable endpoint - Read
OPS0_API_BASE_URLenvironment variable in all config creation points - Default to
https://api.anthropic.comwhen variable is not set
Example Usage
# Use default Anthropic API
export ANTHROPIC_API_KEY=sk-xxx
ops0 -m "list docker containers" -ai
# Use custom API endpoint
export ANTHROPIC_API_KEY=sk-xxx
export OPS0_API_BASE_URL=https://api.custom-provider.com
export OPS0_AI_MODEL=custom-model-name
ops0 -m "list docker containers" -aiTesting
Tested with:
- Default Anthropic API (backward compatibility)
- Custom Claude-compatible API service
- Various model configurations
- All supported platforms (macOS, Linux x86_64, Linux ARM64, Windows)
Related
This feature complements the existing OPS0_AI_MODEL environment variable, providing full flexibility for API configuration.
Implementation Ready
I have a complete implementation ready that:
- ✅ Maintains 100% backward compatibility
- ✅ Follows existing code patterns and naming conventions
- ✅ Includes comprehensive testing across platforms
- ✅ Works with real Claude-compatible API services
Happy to submit a PR once this issue is created and discussed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels