How to Handle 401 or 403 Errors?
A 401 error is usually caused by authentication failure, while a 403 error usually means authentication succeeded but the user does not have permission. For both, first check the Token, then check user, model, and group permissions.
401 Checks
- Is the
Authorizationrequest header missing? - Is the
Bearer sk-...format being used? - Was the Token copied incorrectly, deleted, disabled, or expired?
- Is the client still using an old Key?
403 Checks
- Does the current user group have permission to call the model?
- Does the Token restrict the model, quota, or IP?
- Is the model available to the user?
- Has the administrator disabled the account or channel?
Resolution
Use the same Token to call GET /v1/models. If the model list request also fails, resolve the Token issue first. If the model list request succeeds but the call fails, continue checking model permissions and the channel.
