> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-wbdocs-1882.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I fix Invalid Authentication (401) errors with W&B Inference?

A 401 Invalid Authentication error means your API key is invalid or your W\&B project entity/name is incorrect.

## Verify your API key

1. Create a new API key at [User Settings](https://wandb.ai/settings).
2. Store your API key securely.

## Check your project configuration

Ensure your project is formatted correctly as `<your-team>/<your-project>`:

**Python example:**

```python theme={null}
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:**

```bash theme={null}
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

***

<Badge stroke shape="pill" color="orange" size="md">[Inference](/support/models/tags/inference)</Badge>
