Skip to content

Unexpected Behavior When Using openai.ChatCompletion.create() with Custom user ID #2401

@Anipaleja

Description

@Anipaleja

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When passing a custom user value to openai.ChatCompletion.create(), the request completes successfully, but there is no indication that the value is being acknowledged, logged, or used in any visible monitoring system. The documentation states that the user field is used for abuse monitoring, but from the client perspective, it is impossible to confirm whether this information is being handled or ignored.

This makes it difficult to audit usage or confirm compliance with OpenAI’s best practices.

To Reproduce

  • Use the latest version of openai Python package.
  • Run the code:
import openai

openai.api_key = "your-key-here"

response = openai.ChatCompletion.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Hello"}],
    user="my_test_user_001"
)
print(response)
  • Observe that the request works, but there is no way to verify the user field was registered or tracked.

Code snippets

import openai

openai.api_key = "api_key"

response = openai.ChatCompletion.create(
    model="gpt-4",
    messages=[
        {"role": "user", "content": "Hello!"}
    ],
    user="test_user_123"
)

print(response)

#This snippet Demonstrates correct usage of the user parameter and shows the lack of any visible effect or confirmation that the user ID was acknowledged in the response.

OS

macOS

Python version

Python v3.11.3

Library version

openai v1.30.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions