replicate/replicate-python

Return 404 error instead of 401 Unauthorized

imcyee opened this issue · 1 comments

I have a private model that return URL of generated image. It is returning 404 whenever I request it because I forgot to include Authorization header. It will be more helpful, if it returns 401 instead of 404. Might save someone's time.

mattt commented

Replicate's API now sends a 401 if you don't include an Authorization header and a 422 if you can't access the requested resource with the provided token.

$ curl -X POST -d '{"version": "invalid" }' "https://api.replicate.com/v1/predictions"
{"title":"Unauthenticated","detail":"You did not pass an authentication token","status":401}

$ curl -X POST -H "Authorization: Token invalid" -d '{"version": "invalid" }' "https://api.replicate.com/v1/predictions"
{"title":"Invalid version or not permitted","detail":"The specified version does not exist (or perhaps you don't have permission to use it?)","status":422}