User body parameter not read when connecting to the chat completions API

I’m trying to tag my requests to the completion API with a user id so that I can then access usage on a per user basis from the usage API. However, even when I include the user body parameter, on the usage dashboard, it only lists my email as the user.

const completion = await openai.chat.completions.create({
      model: "gpt-4o-mini",
      messages: messages,
      max_tokens: 16384,
      user: "testuser-123",
    });

Also when connecting to the usage API, if I pass “testuser-123” as a query parameter to user_ids, I get the error:

Failed to fetch usage: Invalid user_ids testuser-123 provided.

const usageResponse = await fetch(
      `https://api.openai.com/v1/organization/usage/completions?start_time=${start_time}&user_ids=testuser-123`,
      {
        method: "GET",
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${adminKey}`,
        },
      }
    );

Is tracking usage per user supported, or is this something I need to implement myself?

Kind Regards,
Rhys

1 Like

user as a parameter is an idea only used for safety systems. The idea is that if you are sending a unique user ID, they could tell you what ID is causing you problems or see that you are a multi-user developer.

It is 3+ years old, and I doubt anybody has ever had such an interaction with OpenAI. The latest Responses API description, so we know they just looked at it again, only gives benefit to OpenAI:

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

It is not employed in any exposed utility or interface.

1 Like