Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project specific API key does not appear to work #8

Open
supcumps opened this issue Oct 8, 2024 · 2 comments
Open

Project specific API key does not appear to work #8

supcumps opened this issue Oct 8, 2024 · 2 comments
Labels
bug Unexpected, undesireable, or erroneous behavior

Comments

@supcumps
Copy link

supcumps commented Oct 8, 2024

No description provided.

@supcumps
Copy link
Author

supcumps commented Oct 8, 2024

Using a sk-proj-B7_95Ibyt........ key causes a runtime error

In Private Shared Sub ListAvailableModels()

23 Dim Ist As JSONItem
Try
Ist = New JSONItem(data)
Catch err As JSONException
Raise New OpenAlException(client)
End Try
ERROR --> * If Ist = Nil Or Not Ist. HasName("data") Then Raise New OpenAlException(Ist)
Ist = Ist.Value("data")

For i As Integer = 0 To Ist.Count - 1
Dim m As New OpenAl. Model (Ist.Child (i))
ModelList.Append(m)
Next

' text-moderation-stable and text-moderation-latest are the two models that
' may be used with the Moderation endpoint, but they are not listed by the
' Models endpoint, so they're added here
ModelList.Append(New OpenAl.Model(New JSONItem(TEXT_MODERATION_L
ModelList.Append(New OpenAl.Model(New JSONItem(TEXT_MODERATION_S

End Sub

Stack

OpenAl.Model.ListAvailableModels
OpenAl.Model.Count
DemoWindow.SetAP|KeyBtn.Action Main Thread +

Name

client
data
Exception
Ist

@charonn0
Copy link
Owner

charonn0 commented Oct 8, 2024

It looks like project scoped API keys can have their permissions limited, including limits on listing the available models (i.e. no access to the /v1/models endpoint). This is a problem since we're assuming that /v1/models will always be accessible to a valid API key. Just about every operation in this wrapper begins by checking the specified model name against the list of available models.

I'll have to think about how to accommodate project scoped keys. In the meantime, try changing the key's permission to allow reading the model list.

@charonn0 charonn0 added the bug Unexpected, undesireable, or erroneous behavior label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected, undesireable, or erroneous behavior
Projects
None yet
Development

No branches or pull requests

2 participants