How do I fix Invalid Authentication (401) errors with W&B Inference?
Support:
less than a minute
A 401 Invalid Authentication error means your API key is invalid or your W&B project entity/name is incorrect.
Verify your API key
- Get a new API key at https://wandb.ai/authorize
- Check for extra spaces or missing characters when copying
- Store your API key securely
Check your project configuration
Ensure your project is formatted correctly as <your-team>/<your-project>
:
Python example:
client = openai.OpenAI(
base_url='https://api.inference.wandb.ai/v1',
api_key="<your-api-key>",
project="<your-team>/<your-project>", # Must match your W&B team and project
)
Bash example:
curl https://api.inference.wandb.ai/v1/chat/completions \
-H "Authorization: Bearer <your-api-key>" \
-H "OpenAI-Project: <your-team>/<your-project>"
Common mistakes
- Using personal entity instead of team name
- Misspelling team or project name
- Missing forward slash between team and project
- Using an expired or deleted API key
Still having issues?
- Verify the team and project exist in your W&B account
- Ensure you have access to the specified team
- Try creating a new API key if the current one isn’t working
Feedback
Was this page helpful?
Glad to hear it! If you have more to say, please let us know.
Sorry to hear that. Please tell us how we can improve.