Skip to content

[Bug]: trtllm-serve /v1/chat/completions rejects the standard OpenAI field safety_identifier with 400 #20962

Open

Description

@Sonica-B

System Info

TensorRT-LLM main @ 61dba71, trtllm-serve OpenAI-compatible server (tensorrt_llm/serve/openai_protocol.py). This is a request-schema bug, so it does not depend on the model or GPU. I reproduced it at the schema level on CPU (Python 3.11, pydantic 2.14.1); no GPU involved.

Reproduction

curl -s localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
  "model": "Qwen/Qwen3-0.6B",
  "messages": [{"role": "user", "content": "hi"}],
  "safety_identifier": "user-7f3a9c"
}'

or with the OpenAI Python client: client.chat.completions.create(..., safety_identifier="user-7f3a9c").

At the schema level:

from tensorrt_llm.serve.openai_protocol import ChatCompletionRequest

ChatCompletionRequest.model_validate_json(
    '{"model": "m", "messages": [{"role": "user", "content": "hi"}], "safety_identifier": "user-7f3a9c"}')

Expected behavior

The request is served. safety_identifier is part of OpenAI's Chat Completions request body. The OpenAI SDK documents user as "being replaced by safety_identifier and prompt_cache_key", so clients migrating off user send it on every request.

actual behavior

1 validation error for ChatCompletionRequest
{'type': 'extra_forbidden', 'loc': ('safety_identifier',), 'msg': 'Extra inputs are not permitted', 'input': 'user-7f3a9c'}

ChatCompletionRequest inherits extra="forbid" from OpenAIBaseModel and declares user but not safety_identifier.

additional notes

This is the counterpart of #20367 (prompt_cache_key, fix in review in #20368) for the other field that replaces user. user is accepted and ignored, and safety_identifier can be handled the same way: the server does no end-user abuse detection. I have a fix with a CPU unit test and the API-stability reference row ready, and will open the PR right after this issue.

Activity

  1. added
    OpenAI API
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OpenAI API

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions