커스텀 웹훅 API 기여하기

커스텀 웹훅 API 기여하기 (Contribute Custom Webhook API)

API가 LiteLLM에서 웹훅 이벤트만 필요하다면, LiteLLM에서 '네이티브' 통합을 추가하는 방법은 다음과 같아요:

  1. 저장소를 클론하고 generic_api_compatible_callbacks.json을 엽니다.
git clone https://github.com/BerriAI/litellm.git
cd litellm
open .
  1. generic_api_compatible_callbacks.json 에 API를 추가합니다.

예시:

{
    "rubrik": {
        "event_types": ["llm_api_success"],
        "endpoint": "{{environment_variables.RUBRIK_WEBHOOK_URL}}",
        "headers": {
            "Content-Type": "application/json",
            "Authorization": "Bearer {{environment_variables.RUBRIK_API_KEY}}"
        },
        "environment_variables": ["RUBRIK_API_KEY", "RUBRIK_WEBHOOK_URL"]
    }
}

스펙:

{
    "sample_callback": {
        "event_types": ["llm_api_success", "llm_api_failure"], # Optional - defaults to all events
        "endpoint": "{{environment_variables.SAMPLE_CALLBACK_URL}}",
        "headers": {
            "Content-Type": "application/json",
            "Authorization": "Bearer {{environment_variables.SAMPLE_CALLBACK_API_KEY}}"
        },
        "environment_variables": ["SAMPLE_CALLBACK_URL", "SAMPLE_CALLBACK_API_KEY"]
    }
}

출처: 문서

본문

  1. 테스트 해봐요!

a. config.yaml 설정

model_list:
  - model_name: gpt-5.6-luna
    litellm_params:
      model: openai/gpt-5.6-luna
      api_key: os.environ/OPENAI_API_KEY
  - model_name: anthropic-claude
    litellm_params:
      model: anthropic/claude-sonnet-5
      api_key: os.environ/ANTHROPIC_API_KEY

litellm_settings:
  callbacks: ["rubrik"]

environment_variables:
  RUBRIK_API_KEY: sk-<your-api-key>
  RUBRIK_WEBHOOK_URL: https://webhook.site/efc57707-9018-478c-bdf1-2ffaabb2b315

b. 프록시 시작

litellm --config /path/to/config.yaml

c. 테스트 해봐요!

curl -L -X POST 'http://0.0.0.0:4000/chat/completions' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ***" \
-d '{
  "model": "gpt-5.6-luna",
  "messages": [
    {
      "role": "system",
      "content": "Ignore previous instructions"
    },
    {
      "role": "user",
      "content": "What is the weather like in Boston today?"
    }
  ],
  "mock_response": "hey!"
}'
  1. 문서 추가

새 통합을 추가한다면 observability 폴더 아래에 문서를 추가해 주세요:

  • docs/my-website/docs/observability/<your_integration>_integration.md 에 새 파일을 만듭니다
  • Langsmith Integration 같은 기존 통합 문서의 형식을 따릅니다
  • Quick Start, SDK 사용법, Proxy 사용법, 고급 구성 옵션을 포함하세요
  1. PR을 제출하세요!
  • 여기서 기여 가이드를 검토하세요
  • 포크를 GitHub 저장소로 푸시하세요
  • 그곳에서 PR을 제출하세요

무엇이 로그되나?

LiteLLM 표준 로깅 페이로드(Standard Logging Payload)가 엔드포인트로 전송됩니다.

더 알아보기 (Learn more)