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