diff --git a/src/server/modules/proxy/proxy.controller.ts b/src/server/modules/proxy/proxy.controller.ts index ac94d32..744a6e7 100644 --- a/src/server/modules/proxy/proxy.controller.ts +++ b/src/server/modules/proxy/proxy.controller.ts @@ -44,6 +44,24 @@ export class ProxyController { @Post('chat/completions') async chatCompletions(@Body() body: OpenAIChatRequest, @Res() res: FastifyReply) { try { + // Claude Code CLI compatibility: + // Claude CLI uses OpenAI-style /v1/chat/completions + if (body.model?.startsWith('claude-')) { + const result = await this.proxyService.handleAnthropicMessages( + body as unknown as AnthropicChatRequest, + ); + + if (body.stream && result instanceof Observable) { + res.header('Content-Type', 'text/event-stream'); + res.header('Cache-Control', 'no-cache'); + res.header('Connection', 'keep-alive'); + res.send(result); + } else { + res.status(HttpStatus.OK).send(result); + } + return; + } + const result = await this.proxyService.handleChatCompletions(body); if (body.stream && result instanceof Observable) {