API key permissions not working correctly
I am organisation owner/admin. In https://platform.openai.com/settings/organization/api-keys I created a new key, gave it permissions I require, but the permissions do not work.
Requests from the new key I created with the correct permissions fail every time with an insufficient permissions error (detail below).
We have an old key which actually has less expansive permissions which works with the exact same request script. Screenshots:
New key permissions which don’t work:
Old working key permissions:
When I run this test script with the old key, I get the expected response:
from openai import OpenAI
import os
# OpenAI API test
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"),
)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say it's working!!!!",
}
],
model="gpt-4o-mini",
temperature=1
)
chat_completion_message = chat_completion.choices[0].message.content
print(chat_completion_message)
When I run the exact same prompt with the new key, despite it having the exact same permissions for that endpoint, I get this error:
AuthenticationError: Error code: 401 - {‘error’: {‘message’: “You have insufficient permissions for this operation. Missing scopes: model.request. Check that you have the correct role in your organization (Reader, Writer, Owner) and project (Member, Owner), and if you’re using a restricted API key, that it has the necessary scopes.”, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
Discussion in the ATmosphere