feat(settings): refactor agent auth modes and add model provider authentication

- Split env vars and config file persistence into separate save operations
- Add model_provider_id field to agent_setting for tracking selected provider
- Add "Model Provider" auth mode for Claude Code, Codex CLI, and Gemini CLI
- Add "Custom Endpoint" auth mode for Claude Code (previously only official subscription)
- Unify auth mode labels across all three agents (official subscription / custom endpoint / model provider)
- When model provider is selected, fill api_url and api_key into env and config automatically
- Resolve model provider credentials at ACP connect time as a backend fallback
- Clear provider deletion cascades to agent_setting.model_provider_id
- Claude Code writes API credentials to config.env (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN)
- Codex: switching auth modes patches config.toml instead of clearing it
- Add i18n keys for new auth modes in all 10 supported languages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-06 22:10:18 +08:00
parent d28c54a038
commit b64976e4d6
24 changed files with 1269 additions and 276 deletions

View File

@@ -565,7 +565,18 @@
"gatewayTokenHint": "Use token-file instead of plain token when possible; configure via openclaw CLI.",
"sessionKeyHint": "Optional. Specify gateway session key; leave empty to auto-assign isolated session."
},
"authModeOfficialSubscription": "Official Subscription",
"authModeCustomEndpoint": "Custom Endpoint",
"authModeCustomEndpointHint": "Manually configure API URL and API Key for a custom endpoint.",
"authModeModelProvider": "Model Provider",
"modelProvider": "Model Provider",
"modelProviderHint": "Use API URL and API Key from a configured model provider.",
"selectModelProvider": "Select Model Provider",
"noModelProviderAvailable": "No model provider configured for this agent. Go to Model Provider Settings to add one.",
"claude": {
"authMode": "Auth Mode",
"officialSubscription": "Official Subscription",
"officialSubscriptionHint": "Use official Anthropic subscription, no API Key required.",
"mainModel": "Main Model",
"reasoningModel": "Reasoning Model (thinking)",
"haikuDefaultModel": "Default Haiku Model",
@@ -624,7 +635,8 @@
"configSavedHint": "Existing sessions need to be reopened to take effect",
"saveConfigManagementFailed": "Failed to save config management",
"clineSaved": "Cline config saved",
"saveClineFailed": "Failed to save Cline config"
"saveClineFailed": "Failed to save Cline config",
"modelProviderRequired": "Please select a model provider before saving."
},
"version": {
"statusLabel": "Version Status",