Add Ramp as a built-in success callback - #23769
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds Confidence Score: 5/5Safe to merge — the change is a self-contained JSON entry and documentation addition with no risk to existing callbacks. The two changed files are additive only: a new key in the JSON config and a new doc page. The existing is_callback_compatible + _generic_api_logger_cache path in logging_callback_manager.py correctly handles new JSON entries without any additional wiring. All remaining findings are P2 (a duplicate snippet in docs). No regressions are possible from these changes. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/integrations/generic_api/generic_api_compatible_callbacks.json | Adds the ramp entry with hardcoded endpoint, bearer auth via RAMP_API_KEY, and success-only event filtering — consistent with existing entries like rubrik and qualifire_eval. |
| docs/my-website/docs/observability/ramp_integration.md | New documentation page for Ramp integration — clear and accurate, but contains a redundant standalone litellm.callbacks = ["ramp"] snippet before the full example that already includes it. |
Sequence Diagram
sequenceDiagram
participant User
participant LiteLLM
participant LoggingCallbackManager
participant GenericAPICallback as generic_api_callback.py
participant RampAPI as Ramp API
User->>LiteLLM: litellm.callbacks = ["ramp"]
LiteLLM->>LoggingCallbackManager: _safe_add_callback_to_list("ramp")
LoggingCallbackManager->>LoggingCallbackManager: _add_custom_callback_generic_api_str("ramp")
LoggingCallbackManager->>GenericAPICallback: is_callback_compatible("ramp")
GenericAPICallback-->>LoggingCallbackManager: True (found in JSON)
LoggingCallbackManager->>GenericAPICallback: GenericAPILogger(callback_name="ramp")
GenericAPICallback->>GenericAPICallback: Load endpoint + headers from JSON, substitute RAMP_API_KEY env var
GenericAPICallback-->>LoggingCallbackManager: GenericAPILogger instance
LoggingCallbackManager->>LoggingCallbackManager: Cache as _generic_api_logger_cache["ramp"]
User->>LiteLLM: litellm.completion(...)
LiteLLM->>GenericAPICallback: async_log_success_event(StandardLoggingPayload)
GenericAPICallback->>RampAPI: POST https://api.ramp.com/developer/v1/ai-usage/litellm
RampAPI-->>GenericAPICallback: 200 OK
Reviews (12): Last reviewed commit: "Add Ramp as a built-in generic API callb..." | Re-trigger Greptile
5570f2a to
38bd543
Compare
9ff31a5 to
64e89b7
Compare
|
@krrishdholakia @Sameerlite Any chance either of you could take a look? Hoping to get this out as fast as possible 🙏 |
|
@kedarthakkar why not just register it like this - https://docs.litellm.ai/docs/contribute_integration/custom_webhook_api? you don't need to add so much code just add to |
64e89b7 to
df96051
Compare
Thanks @krrishdholakia this is way better! Just pushed the changes. |
|
Actually seeing an issue with the new approach: for non-enterprise LiteLLM, we see this silently fail as there's no named |
|
how do i repro @kedarthakkar |
@krrishdholakia To make it easy to repro I put together kedarthakkar#2 and kedarthakkar#3 to replace the Ramp endpoint with a public webhook endpoint. Then run the test below: For the first branch (doesn't work) I get: And for the second branch (works) I get: |
|
@krrish-berri-2 could you take a look at the example above when you get a chance? |
| @@ -33,5 +33,14 @@ | |||
| "X-Qualifire-API-Key": "{{environment_variables.QUALIFIRE_API_KEY}}" | |||
| }, | |||
| "environment_variables": ["QUALIFIRE_API_KEY", "QUALIFIRE_WEBHOOK_URL"] | |||
| }, | |||
| "ramp": { | |||
3e3dd87 to
f6f60a7
Compare
@kedarthakkar can you fix this please? |
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
@krrish-berri-2 Yeah will do. Also did you have a chance to take a look at the example above? I think we still see: Actually seeing an issue with the new approach: for non-enterprise LiteLLM, we see this silently fail as there's no named ramp callback in the _init_custom_logger_compatible_class chain and GenericAPILogger is stubbed with CustomLogger. |
f6f60a7 to
437c71a
Compare
437c71a to
7540be3
Compare
- Add 8 content PRs that merged directly to the release branch outside the listed staging PRs: #23769 (Ramp callback), #25252 (JWT OAuth2 override), #25254 (AWS GovCloud mode), #25258 (batch-limit cleanup), #25334 (router custom_llm_provider), #25345 (Triton embeddings), #25347 (tag-based routing), #25358 (Baseten pricing attribution) - Add @kedarthakkar to new contributors (first-ever PR via #23769) - Update RELEASE_NOTES_GENERATION_INSTRUCTIONS: require walking git log range between release tags in addition to staging PRs, and verify new-contributor status per author rather than trusting the GH release body floor
- Add 8 content PRs that merged directly to the release branch outside the listed staging PRs: #23769 (Ramp callback), #25252 (JWT OAuth2 override), #25254 (AWS GovCloud mode), #25258 (batch-limit cleanup), #25334 (router custom_llm_provider), #25345 (Triton embeddings), #25347 (tag-based routing), #25358 (Baseten pricing attribution) - Add @kedarthakkar to new contributors (first-ever PR via #23769) - Update RELEASE_NOTES_GENERATION_INSTRUCTIONS: require walking git log range between release tags in addition to staging PRs, and verify new-contributor status per author rather than trusting the GH release body floor
- Add 8 content PRs that merged directly to the release branch outside the listed staging PRs: BerriAI#23769 (Ramp callback), BerriAI#25252 (JWT OAuth2 override), BerriAI#25254 (AWS GovCloud mode), BerriAI#25258 (batch-limit cleanup), BerriAI#25334 (router custom_llm_provider), BerriAI#25345 (Triton embeddings), BerriAI#25347 (tag-based routing), BerriAI#25358 (Baseten pricing attribution) - Add @kedarthakkar to new contributors (first-ever PR via BerriAI#23769) - Update RELEASE_NOTES_GENERATION_INSTRUCTIONS: require walking git log range between release tags in addition to staging PRs, and verify new-contributor status per author rather than trusting the GH release body floor
- Add 8 content PRs that merged directly to the release branch outside the listed staging PRs: BerriAI#23769 (Ramp callback), BerriAI#25252 (JWT OAuth2 override), BerriAI#25254 (AWS GovCloud mode), BerriAI#25258 (batch-limit cleanup), BerriAI#25334 (router custom_llm_provider), BerriAI#25345 (Triton embeddings), BerriAI#25347 (tag-based routing), BerriAI#25358 (Baseten pricing attribution) - Add @kedarthakkar to new contributors (first-ever PR via BerriAI#23769) - Update RELEASE_NOTES_GENERATION_INSTRUCTIONS: require walking git log range between release tags in addition to staging PRs, and verify new-contributor status per author rather than trusting the GH release body floor


Summary
"ramp"as a built-inGenericAPILoggercallback so customers can enable AI usage reporting to Ramp with just:RAMP_API_KEYenvironment variable — the endpoint (https://api.ramp.com/developer/v1/ai-usage) is hardcoded.Changes
litellm/__init__.py— Add"ramp"to_custom_logger_compatible_callbacks_literalgeneric_api_compatible_callbacks.json— Add Ramp callback config (endpoint, headers, env vars)custom_logger_registry.py— Register"ramp": GenericAPILoggerclass mappinglitellm_logging.py— Add instantiation in the callback init chainTest plan
RAMP_API_KEYenv var and configurelitellm.success_callback = ["ramp"]rubrik,sumologic)🤖 Generated with Claude Code