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}}
Given the initial error response mentioned an option which isn’t under the heading ‘model capabilities’, I suspect this works because initially setting model capabilitites to ‘request’ sets that hidden item to ‘request’, so that when you turn off the ones you don’t want and model capabilities goes back to ‘mixed’, you have changed the problematic item even though the UI looks exactly the same after the change as it did in my initial screenshot of the broken config.
Specifically, I think model.request is the hidden item given that’s what the error message said this key didn’t have permissions for until I changed ‘model capabilities’ to request, then turned off the ones I don’t want.
For the avoidance of doubt, the UI looks exactly the same now as it did when the config was broken. It’s just the hidden item that has changed.
thank you. There’s never just 1 cockroach so if they find that model.request is in fact secretly toggled on by setting model capabilities to “request”, they should check for other items which may unintentially be set to request by that action. You wouldn’t want keys being allocated permissions the user didn’t ask for…