The moderations endpoint is not working when using a project API key. It seems like the endpoint works as expected if the API key is scoped Default project.
This example request results in 500:
curl .../v1/moderations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"input": [
{
"type": "text",
"text": "This is my text I want to test..."
}
],
"model": "omni-moderation-latest"
}'
And the one from the docs results in the same 500:
curl ..../v1/moderations \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "omni-moderation-latest",
"input": "...text to classify goes here..."
}'
Response is http status 500 and body:
{
"error": {
"message": "Unexpected error",
"type": "server_error",
"param": null,
"code": null
}
}
Both these calls work fine using an API key from the Default project.