Skip to content

fix: Set standard_logging_object for pass-through endpoints - #19887

Merged
2 commits merged into
BerriAI:litellm_oss_staging_01_31_2026from
neubig:fix/standard-logging-payload-none
Jan 31, 2026
Merged

2 commits merged into
BerriAI:litellm_oss_staging_01_31_2026from
neubig:fix/standard-logging-payload-none

Conversation

@neubig

@neubig neubig commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the ValueError: standard_logging_payload is required error that occurs when using pass-through endpoints like vLLM classify.

Root Cause

Pass-through endpoints were not setting standard_logging_object because _get_assembled_streaming_response returns None for non-ModelResponse results (e.g., StandardPassThroughResponseObject).

This caused model_max_budget_limiter.async_log_success_event to raise ValueError('standard_logging_payload is required').

The Fix

Added an elif branch in async_success_handler that mirrors the non-pass-through code path as closely as possible:

elif self.call_type == "pass_through_endpoint":
    # For pass-through endpoints, set standard_logging_object even when
    # complete_streaming_response is None (e.g., vLLM classify endpoints)
    print_verbose(
        "Async success callbacks: Got a pass-through endpoint response"
    )

    # Set async_complete_streaming_response to prevent re-processing
    self.model_call_details["async_complete_streaming_response"] = result

    # For pass-through endpoints, cost calculation is not possible since
    # StandardPassThroughResponseObject doesn't have standard usage info.
    # Set response_cost to None to be consistent with the error handling
    # in the non-pass-through code path.
    self.model_call_details["response_cost"] = None

    ## STANDARDIZED LOGGING PAYLOAD
    self.model_call_details[
        "standard_logging_object"
    ] = get_standard_logging_object_payload(
        kwargs=self.model_call_details,
        init_response_obj=result,
        start_time=start_time,
        end_time=end_time,
        logging_obj=self,
        status="success",
        standard_built_in_tools_params=self.standard_built_in_tools_params,
    )

    # Emit standard logging payload for debugging (consistent with non-pass-through)
    if (
        standard_logging_payload := self.model_call_details.get(
            "standard_logging_object"
        )
    ) is not None:
        emit_standard_logging_payload(standard_logging_payload)

Consistency with Non-Pass-Through Code Path

The fix mirrors the non-pass-through code path:

Step Non-Pass-Through Pass-Through
1. Debug logging print_verbose("Got a complete streaming response") print_verbose("Got a pass-through endpoint response")
2. Prevent re-processing async_complete_streaming_response = complete_streaming_response async_complete_streaming_response = result
3. Cost calculation response_cost = _response_cost_calculator() or None on error response_cost = None (not possible for pass-through)
4. Standard logging standard_logging_object = get_standard_logging_object_payload() Same
5. Emit payload emit_standard_logging_payload() Same

Cost calculation is set to None for pass-through endpoints because StandardPassThroughResponseObject doesn't have standard usage info that _response_cost_calculator() expects.

Changes

  1. litellm/litellm_core_utils/litellm_logging.py: Added elif branch that mirrors non-pass-through code path
  2. tests/test_litellm/litellm_core_utils/test_litellm_logging.py: Added regression tests:
    • test_async_success_handler_sets_standard_logging_object_for_pass_through_endpoints
    • test_async_success_handler_sets_standard_logging_object_for_streaming_pass_through
    • test_async_success_handler_prevents_reprocessing_for_pass_through_endpoints

Testing

  • Added unit tests that verify:
    1. standard_logging_object is set for non-streaming pass-through endpoints
    2. standard_logging_object is set for streaming pass-through endpoints
    3. async_complete_streaming_response prevents re-processing
    4. response_cost is set to None (consistent with error handling)
  • All tests pass locally

Related Issues

  • Fixes the error reported in All-Hands-AI/infra#897

@vercel

vercel Bot commented Jan 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Error Error Jan 31, 2026 11:34pm

Request Review

@neubig
neubig marked this pull request as draft January 27, 2026 22:14
@neubig neubig changed the title fix: Handle missing standard_logging_object gracefully in model_max_budget_limiter fix: Set standard_logging_object for pass-through endpoints Jan 27, 2026
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from bc9f62d to ec22a7a Compare January 27, 2026 23:14
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from ec22a7a to 101ea25 Compare January 27, 2026 23:17
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from 101ea25 to be6f572 Compare January 27, 2026 23:23
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from be6f572 to 6db2b74 Compare January 27, 2026 23:25
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from 6db2b74 to 8357c15 Compare January 27, 2026 23:27
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from 8357c15 to 4cb3746 Compare January 27, 2026 23:31
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from 4cb3746 to 2150bb6 Compare January 27, 2026 23:56
Pass-through endpoints (like vLLM classify) were not setting
standard_logging_object because _get_assembled_streaming_response
returns None for non-ModelResponse results.

This caused model_max_budget_limiter.async_log_success_event to raise
ValueError('standard_logging_payload is required').

The fix adds an elif branch in async_success_handler that mirrors the
non-pass-through code path.

Co-authored-by: openhands <openhands@all-hands.dev>
@neubig
neubig force-pushed the fix/standard-logging-payload-none branch from 2150bb6 to 72ca9f2 Compare January 28, 2026 00:04
@neubig
neubig marked this pull request as ready for review January 28, 2026 01:02
@ghost
ghost changed the base branch from main to litellm_oss_staging_01_31_2026 January 31, 2026 23:32
@ghost
ghost merged commit 22dd7c2 into BerriAI:litellm_oss_staging_01_31_2026 Jan 31, 2026
2 checks passed
Sameerlite pushed a commit that referenced this pull request Feb 2, 2026
Pass-through endpoints (like vLLM classify) were not setting
standard_logging_object because _get_assembled_streaming_response
returns None for non-ModelResponse results.

This caused model_max_budget_limiter.async_log_success_event to raise
ValueError('standard_logging_payload is required').

The fix adds an elif branch in async_success_handler that mirrors the
non-pass-through code path.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
ishaan-jaff added a commit that referenced this pull request Feb 21, 2026
…uccess_handler

Two places in the logging pipeline were overwriting response_cost that
pass-through handlers (Gemini/Vertex) had already calculated:

1. _process_hidden_params_and_response_cost fell through to
   _response_cost_calculator which returns None for pass-through calls
2. async_success_handler pass-through branch unconditionally set
   response_cost = None (introduced in PR #19887)

Now both places check if response_cost is already set before overwriting.
ishaan-jaff added a commit that referenced this pull request Feb 21, 2026
* fix(logging): preserve pass-through endpoint response_cost in async_success_handler

Two places in the logging pipeline were overwriting response_cost that
pass-through handlers (Gemini/Vertex) had already calculated:

1. _process_hidden_params_and_response_cost fell through to
   _response_cost_calculator which returns None for pass-through calls
2. async_success_handler pass-through branch unconditionally set
   response_cost = None (introduced in PR #19887)

Now both places check if response_cost is already set before overwriting.

* test: add regression test for pass-through endpoint response_cost preservation
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…19887)

Pass-through endpoints (like vLLM classify) were not setting
standard_logging_object because _get_assembled_streaming_response
returns None for non-ModelResponse results.

This caused model_max_budget_limiter.async_log_success_event to raise
ValueError('standard_logging_payload is required').

The fix adds an elif branch in async_success_handler that mirrors the
non-pass-through code path.

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…1844)

* fix(logging): preserve pass-through endpoint response_cost in async_success_handler

Two places in the logging pipeline were overwriting response_cost that
pass-through handlers (Gemini/Vertex) had already calculated:

1. _process_hidden_params_and_response_cost fell through to
   _response_cost_calculator which returns None for pass-through calls
2. async_success_handler pass-through branch unconditionally set
   response_cost = None (introduced in PR BerriAI#19887)

Now both places check if response_cost is already set before overwriting.

* test: add regression test for pass-through endpoint response_cost preservation
This pull request was closed.

This branch had an error being deployed

1 failed deployment
Preview — d2ced227 Deployed Jan 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants