> ## Documentation Index
> Fetch the complete documentation index at: https://docs.obiguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Access Keys

> Access keys are the credentials your applications send to the Obiguard gateway. Your AI provider credentials stay stored in Obiguard.

An **access key** (it starts with `ak`) is what your application sends to the Obiguard gateway to authenticate. Access keys are created per agent or project, and replace the virtual keys used in earlier versions of Obiguard.

Your AI provider credentials (for example your OpenAI or Anthropic API key) are called **provider credentials**. They are stored encrypted in Obiguard and are never sent to, or visible to, the applications that call the gateway.

> [!WARNING]
>
> Virtual keys are deprecated. The gateway rejects keys that start with `sk-obg` or `vk-obg`. Replace them with an access key.

## Creating an access key

1. Open the **Access keys** page in the Obiguard dashboard.
2. Create a new access key for the agent or project that will make the requests.
3. Copy the key and store it securely, for example in an environment variable such as `OBIGUARD_API_KEY`.

> [!NOTE]
>
> Tip: Create a separate access key for each agent or project so that each integration can be managed independently.

## How are provider credentials stored?

Your provider credentials are encrypted and stored in secure vaults, accessible only during a request. Decryption happens solely within isolated workers and only when required.

Because callers only ever hold an access key, your original provider credentials cannot be derived or reconstructed from it.

## Using access keys

### Using the Obiguard SDK

Pass the access key as `obiguard_api_key` when you initialize the Obiguard Python SDK.

**Python SDK**

```python theme={null}
from obiguard import Obiguard

client = Obiguard(
  provider='openai',
  base_url='https://gateway.obiguard.ai/v1',
  obiguard_api_key='ak***',  # Your Obiguard access key here
)
```

### Using the OpenAI SDK

Pass the access key in the Obiguard headers of the OpenAI client.

**OpenAI Python**

```python theme={null}
from openai import OpenAI
from obiguard import createHeaders

client = OpenAI(
  base_url='https://gateway.obiguard.ai/v1',
  api_key='dummy',  # Not used; the provider credential is stored in Obiguard
  default_headers=createHeaders(
    provider="openai",
    obiguard_api_key="ak***",  # Your Obiguard access key here
  )
)
```

### Using cURL

Send the access key in the `x-obiguard-api-key` header of your request.

**cURL**

```curl theme={null}
curl https://gateway.obiguard.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "x-obiguard-api-key: ak***" \
-d '{
  "model": "Qwen/Qwen2.5-32B-Instruct",
  "messages": [{
    "role": "user",
    "content": "Hello!"
  }]
}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.