feat: switch default engine to claude_api with base URL support

- Change AGENT_ENGINE_TYPE from claude_code_cli to claude_api in docker-compose
- Add ANTHROPIC_BASE_URL env var support to claude-api-engine
- Add ANTHROPIC_BASE_URL to agent-service environment in docker-compose

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-23 05:45:08 -08:00
parent 9a1ecf10ec
commit 810dcd7def
2 changed files with 6 additions and 3 deletions

View File

@ -126,7 +126,8 @@ services:
- DB_DATABASE=${POSTGRES_DB:-it0}
- REDIS_URL=redis://redis:6379
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- AGENT_ENGINE_TYPE=claude_code_cli
- ANTHROPIC_BASE_URL=${ANTHROPIC_BASE_URL}
- AGENT_ENGINE_TYPE=claude_api
- AGENT_SERVICE_PORT=3002
healthcheck:
test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:3002/',r=>{process.exit(r.statusCode<500?0:1)}).on('error',()=>process.exit(1))\""]

View File

@ -46,7 +46,8 @@ export class ClaudeApiEngine implements AgentEnginePort {
return;
}
const client = new Anthropic({ apiKey });
const baseURL = this.configService.get<string>('ANTHROPIC_BASE_URL');
const client = new Anthropic({ apiKey, ...(baseURL ? { baseURL } : {}) });
const abortController = new AbortController();
this.abortControllers.set(params.sessionId, abortController);
@ -228,7 +229,8 @@ export class ClaudeApiEngine implements AgentEnginePort {
const apiKey = this.configService.get<string>('ANTHROPIC_API_KEY');
if (!apiKey) return false;
const client = new Anthropic({ apiKey });
const baseURL = this.configService.get<string>('ANTHROPIC_BASE_URL');
const client = new Anthropic({ apiKey, ...(baseURL ? { baseURL } : {}) });
// Make a minimal API call to verify connectivity
const response = await client.messages.create({