diff --git a/packages/services/conversation-service/src/infrastructure/claude/claude-agent.service.ts b/packages/services/conversation-service/src/infrastructure/claude/claude-agent.service.ts index 5bb739b..cf46ea2 100644 --- a/packages/services/conversation-service/src/infrastructure/claude/claude-agent.service.ts +++ b/packages/services/conversation-service/src/infrastructure/claude/claude-agent.service.ts @@ -34,13 +34,20 @@ export class ClaudeAgentService implements OnModuleInit { onModuleInit() { const baseUrl = this.configService.get('ANTHROPIC_BASE_URL'); + const isProxyUrl = baseUrl && (baseUrl.includes('67.223.119.33') || baseUrl.match(/^\d+\.\d+\.\d+\.\d+/)); + + // If using IP-based proxy, disable TLS certificate verification + if (isProxyUrl) { + console.log(`Using Anthropic proxy (TLS verification disabled): ${baseUrl}`); + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } this.client = new Anthropic({ apiKey: this.configService.get('ANTHROPIC_API_KEY'), baseURL: baseUrl || undefined, }); - if (baseUrl) { + if (baseUrl && !isProxyUrl) { console.log(`Using Anthropic API base URL: ${baseUrl}`); }