프로젝트

일반

사용자정보

Actions

업무 #395

진행중
RL RL

업무 #394: Claude API 홍콩 지역 접속 제한으로 채팅 사용 불가

Anthropic API Lambda 프록시 서버 구축 (infra)

업무 #395: Anthropic API Lambda 프록시 서버 구축 (infra)

Ryan Lee이(가) 약 7시간 전에 추가함.

상태:
진행
우선순위:
보통
담당자:
목표버전:
시작일:
2026/04/20
완료일:
진척도:

100%

추정시간:

설명

작업 내용

Claude API 를 클라이언트에서 직접 호출하지 않도록 AWS Lambda 기반의 얇은 프록시 서버를 신규 구축한다.

  • 런타임: Node 20, 단일 핸들러 index.mjs
  • 함수명: alphea-anthropic-proxy (ap-northeast-2)
  • Function URL (AuthType=NONE) + 커스텀 헤더 x-api-secret 인증
  • 내부는 messages.stream() + finalMessage() 조합으로 Anthropic SDK 10분 타임아웃 우회
  • 시스템 프롬프트(docs/AXI_instructions.md) 는 빌드 시 zip 에 동봉
  • 프롬프트 캐싱(cache_control: ephemeral) 적용
  • build.sh 로 프롬프트 복사 → npm ci --omit=dev → zip 패키징 자동화

수용 기준

  • alphea-anthropic-proxy 함수가 ap-northeast-2 리전에 Active 상태로 존재
  • Function URL 이 POST / + x-api-secret 으로 200 응답
  • 잘못된 시크릿은 401 반환
  • 2회차 동일 요청에서 usage.cacheReadInputTokens > 0 (프롬프트 캐시 동작)
  • 장시간(10분+) 응답 요청이 타임아웃 없이 완료

관련 파일

  • infra/lambda/anthropic-proxy/index.mjs
  • infra/lambda/anthropic-proxy/package.json
  • infra/lambda/anthropic-proxy/package-lock.json
  • infra/lambda/anthropic-proxy/build.sh
  • infra/lambda/anthropic-proxy/trust-policy.json
  • infra/lambda/anthropic-proxy/README.md

의존성

없음. 최초 배포 시 IAM 역할(alphea-lambda-exec) 생성 및 Function URL lambda:InvokeFunction + lambda:InvokeFunctionUrl 권한 2종 필요 (2025-10 AWS 변경 반영).

커밋 메시지 (예)

feat(infra): Anthropic API Lambda 프록시 서버 구축 fixes #<N_A>

Actions

내보내기 PDF Atom