Actions
업무 #395
진행중
RL
RL
업무 #394: Claude API 홍콩 지역 접속 제한으로 채팅 사용 불가
Anthropic API Lambda 프록시 서버 구축 (infra)
업무 #395:
Anthropic API Lambda 프록시 서버 구축 (infra)
설명
작업 내용¶
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.mjsinfra/lambda/anthropic-proxy/package.jsoninfra/lambda/anthropic-proxy/package-lock.jsoninfra/lambda/anthropic-proxy/build.shinfra/lambda/anthropic-proxy/trust-policy.jsoninfra/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