feat: add Claude API provider profiles for alternative endpoints

Add support for managing multiple Claude-compatible API endpoints
(z.AI GLM, AWS Bedrock, etc.) through provider profiles in settings.

Features:
- New ClaudeApiProfile type with base URL, API key, model mappings
- Pre-configured z.AI GLM template with correct model names
- Profile selector in Settings > Claude > API Profiles
- Clean switching between profiles and direct Anthropic API
- Immediate persistence to prevent data loss on restart

Profile support added to all execution paths:
- Agent service (chat)
- Ideation service
- Auto-mode service (feature agents, enhancements)
- Simple query service (title generation, descriptions, etc.)
- Backlog planning, commit messages, spec generation
- GitHub issue validation, suggestions

Environment variables set when profile is active:
- ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN/API_KEY
- ANTHROPIC_DEFAULT_HAIKU/SONNET/OPUS_MODEL
- API_TIMEOUT_MS, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
This commit is contained in:
Stefan de Vogelaere
2026-01-18 13:50:41 +01:00
parent 044c3d50d1
commit 53298106e9
25 changed files with 1080 additions and 136 deletions

View File

@@ -63,6 +63,7 @@ import {
filterClaudeMdFromContext,
getMCPServersFromSettings,
getPromptCustomization,
getActiveClaudeApiProfile,
} from '../lib/settings-helpers.js';
import { getNotificationService } from './notification-service.js';
@@ -1708,6 +1709,9 @@ Format your response as a structured markdown document.`;
thinkingLevel: analysisThinkingLevel,
});
// Get active Claude API profile for alternative endpoint configuration
const claudeApiProfile = await getActiveClaudeApiProfile(this.settingsService, '[AutoMode]');
const options: ExecuteOptions = {
prompt,
model: sdkOptions.model ?? analysisModel,
@@ -1717,6 +1721,7 @@ Format your response as a structured markdown document.`;
abortController,
settingSources: sdkOptions.settingSources,
thinkingLevel: analysisThinkingLevel, // Pass thinking level
claudeApiProfile, // Pass active Claude API profile for alternative endpoint configuration
};
const stream = provider.executeQuery(options);
@@ -2536,6 +2541,9 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
);
}
// Get active Claude API profile for alternative endpoint configuration
const claudeApiProfile = await getActiveClaudeApiProfile(this.settingsService, '[AutoMode]');
const executeOptions: ExecuteOptions = {
prompt: promptContent,
model: bareModel,
@@ -2547,6 +2555,7 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
settingSources: sdkOptions.settingSources,
mcpServers: Object.keys(mcpServers).length > 0 ? mcpServers : undefined, // Pass MCP servers configuration
thinkingLevel: options?.thinkingLevel, // Pass thinking level for extended thinking
claudeApiProfile, // Pass active Claude API profile for alternative endpoint configuration
};
// Execute via provider
@@ -2849,6 +2858,7 @@ After generating the revised spec, output:
allowedTools: allowedTools,
abortController,
mcpServers: Object.keys(mcpServers).length > 0 ? mcpServers : undefined,
claudeApiProfile, // Pass active Claude API profile for alternative endpoint configuration
});
let revisionText = '';
@@ -2994,6 +3004,7 @@ After generating the revised spec, output:
allowedTools: allowedTools,
abortController,
mcpServers: Object.keys(mcpServers).length > 0 ? mcpServers : undefined,
claudeApiProfile, // Pass active Claude API profile for alternative endpoint configuration
});
let taskOutput = '';
@@ -3088,6 +3099,7 @@ After generating the revised spec, output:
allowedTools: allowedTools,
abortController,
mcpServers: Object.keys(mcpServers).length > 0 ? mcpServers : undefined,
claudeApiProfile, // Pass active Claude API profile for alternative endpoint configuration
});
for await (const msg of continuationStream) {