litellm - ✅(Solved) Fix ChatGPT provider rejects system-role payloads in chat/responses paths [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#22968Fetched 2026-04-08 00:39:10
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

With ChatGPT-backed models (device-code auth), requests can fail with:

ChatgptException - {"detail":"System messages are not allowed"}

Root Cause

With ChatGPT-backed models (device-code auth), requests can fail with:

ChatgptException - {"detail":"System messages are not allowed"}

PR fix notes

PR #22967: fix(chatgpt): normalize system-role payloads for chat/responses

Description (problem / solution / changelog)

Summary

Normalize system role payloads for ChatGPT provider paths to avoid backend failures ({"detail":"System messages are not allowed"}).

Changes

  • litellm/llms/chatgpt/chat/transformation.py
    • convert role=system -> role=user in _transform_messages
  • litellm/llms/chatgpt/responses/transformation.py
    • recursively normalize request["input"] system roles before request dispatch

Repro

Using ChatGPT device-code backend with model aliases, calls containing system-role messages fail before this patch and succeed after it.

Why

Some ChatGPT backend endpoints reject system-role messages entirely; provider-level normalization makes behavior consistent for both chat completions and responses paths.

Changed files

  • litellm/llms/chatgpt/chat/transformation.py (modified, +11/-0)
  • litellm/llms/chatgpt/responses/transformation.py (modified, +14/-0)
RAW_BUFFERClick to expand / collapse

Summary

With ChatGPT-backed models (device-code auth), requests can fail with:

ChatgptException - {"detail":"System messages are not allowed"}

Affected paths

  • /v1/chat/completions
  • /v1/responses

Expected

Provider should normalize role=system payloads (or equivalent safe fallback) consistently for ChatGPT backend calls.

PR

Fix submitted here:

extent analysis

Fix Plan

The fix involves normalizing role=system payloads for ChatGPT backend calls.

Steps to Implement the Fix

  • Update the payload normalization logic to handle role=system cases.
  • Ensure the normalization is applied consistently across all affected paths (/v1/chat/completions and /v1/responses).
  • Use a safe fallback when necessary to prevent ChatgptException.

Example Code Changes

def normalize_payload(payload):
    if payload.get('role') == 'system':
        # Apply normalization or use a safe fallback
        payload['role'] = 'user'  # Example fallback
    return payload

# Example usage in the affected paths
def chat_completions(payload):
    normalized_payload = normalize_payload(payload)
    # Proceed with the normalized payload for ChatGPT backend calls

def responses(payload):
    normalized_payload = normalize_payload(payload)
    # Proceed with the normalized payload for ChatGPT backend calls

Verification

To verify the fix, test the affected paths with role=system payloads and ensure that the ChatgptException is no longer raised.

Extra Tips

  • Review the GitHub PR (https://github.com/BerriAI/litellm/pull/22967) for the exact implementation details and discussions.
  • Consider adding tests to cover the normalization logic and ensure it works as expected for different input scenarios.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING