# Authentication

All Commonstack API requests require an API key. You can generate one from your dashboard at [commonstack.ai](https://commonstack.ai).

### **Base URL**

```
https://api.commonstack.ai/v1
```

### **Auth header**

Use the `Authorization` header with your API key:

```
Authorization: Bearer YOUR_API_KEY
```

### **Example**

```bash
curl https://api.commonstack.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4.1",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

### **Using the Anthropic SDK**

If you prefer to use the Anthropic SDK, see the [anthropic-sdk-compatibility](https://docs.commonstack.ai/user-guide/anthropic-sdk-compatibility "mention") page for setup instructions.

{% hint style="info" %}

#### **Notes**

* The same API key works for all models across all providers.
* Keep your API key secure. Do not expose it in client-side code or public repositories.
* You can create multiple keys with different expiry dates and usage limits from your [dashboard](https://commonstack.ai). See [account-and-api-keys](https://docs.commonstack.ai/platform/account-and-api-keys "mention").
  {% endhint %}
