S3 및 GCS 캐시
S3 및 GCS 캐시 (S3 and GCS Cache)
객체 스토리지는 지연을 내구성과 비용과 맞바꿔요. 버킷은 모든 조회에서 Redis보다 훨씬 느리지만, 저렴하고 모든 복제본이 공유하며 재시작 후에도 유지돼요. 캐시 히트를 절약할 가치가 있고 조회에 수백 밀리초가 걸려도 문제 없을 때 사용하세요.
출처: 문서
본문
S3
1단계: config.yaml에 캐시 추가
model_list:
- model_name: gpt-5.6-luna
litellm_params:
model: gpt-5.6-luna
- model_name: text-embedding-ada-002
litellm_params:
model: text-embedding-ada-002
litellm_settings:
set_verbose: True
cache: True # set cache responses to True
cache_params: # set cache params for s3
type: s3
s3_bucket_name: cache-bucket-litellm # AWS Bucket Name for S3
s3_region_name: us-west-2 # AWS Region Name for S3
s3_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # us os.environ/<variable name> to pass environment variables. This is AWS Access Key ID for S3
s3_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for S3
s3_endpoint_url: https://s3.amazonaws.com # [OPTIONAL] S3 endpoint URL, if you want to use Backblaze/cloudflare s3 buckets
2단계: 콘피그로 프록시 실행
$ litellm --config /path/to/config.yaml
GCS
1단계: config.yaml에 캐시 추가
model_list:
- model_name: gpt-5.6-luna
litellm_params:
model: gpt-5.6-luna
- model_name: text-embedding-ada-002
litellm_params:
model: text-embedding-ada-002
litellm_settings:
set_verbose: True
cache: True # set cache responses to True
cache_params: # set cache params for gcs
type: gcs
gcs_bucket_name: cache-bucket-litellm # GCS Bucket Name for caching
gcs_path_service_account: os.environ/GCS_PATH_SERVICE_ACCOUNT # use os.environ/<variable name> to pass environment variables. This is the path to your GCS service account JSON file
gcs_path: cache/ # [OPTIONAL] GCS path prefix for cache objects
2단계: .env에 GCS 자격 증명 추가
.env 파일에 GCS 환경 변수를 설정하세요:
GCS_BUCKET_NAME="your-gcs-bucket-name"
GCS_PATH_SERVICE_ACCOUNT="/path/to/service-account.json"
3단계: 콘피그로 프록시 실행
$ litellm --config /path/to/config.yaml