Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

Title

Fix: Redact reasoning summaries in ResponsesAPI output when message logging is disabled

Relevant issues

Fixes #15913

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

Problem

When turn_off_message_logging: True was configured, message content was properly redacted but reasoning summaries in ResponsesAPI responses remained visible in observability tools (Langfuse, Datadog, etc.). This leaked sensitive reasoning data even when users explicitly disabled message logging.

Example of leaked data:

{
  "type": "reasoning",
  "summary": [
    {
      "text": "**Delivering a joke** The user wants a random joke...",
      "type": "summary_text"
    }
  ]
}

Solution

Extended the perform_redaction() function in litellm/litellm_core_utils/redact_messages.py to:

  1. Detect reasoning items in ResponsesAPI output array (items with type: "reasoning")
  2. Redact the summary[].text fields within reasoning items
  3. Remove the top-level reasoning field from ResponsesAPIResponse
image

@vercel
Copy link

vercel bot commented Oct 27, 2025

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

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 27, 2025 1:32pm

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

[Bug]: Header LiteLLM-Disable-Message-Redaction doesn't work in Responses API

3 participants