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

# VoidAI API Authentication

> Authenticate VoidAI requests with a Bearer API key or x-api-key header, understand public model endpoints, and protect server-side credentials.

Most VoidAI API endpoints require a key or supported OAuth access token. The public model catalog at `GET /v1/models` and `GET /v1/models/{id}` does not require authentication.

## Bearer authentication

Create a key in the [dashboard](https://voidai.app/dashboard). VoidAI API keys begin with `sk-voidai-`. Store yours in `VOIDAI_API_KEY` on your server.

```bash theme={null}
curl https://api.voidai.app/v1/credits \
  -H "Authorization: Bearer $VOIDAI_API_KEY"
```

Authorized OAuth integrations can use their VoidAI OAuth access token with the same Bearer header. An OAuth token is not an API key; use the credential issued for your integration.

## Anthropic-style header

The gateway also accepts `x-api-key` when no `Authorization` header is supplied:

```bash theme={null}
curl https://api.voidai.app/v1/messages/count_tokens \
  -H "x-api-key: $VOIDAI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"Hello"}]}'
```

If both headers are present, `Authorization` takes precedence. An invalid Authorization header is not rescued by a valid `x-api-key` header.

## Access checks

A valid credential does not grant access to every model. Account status, configured IP restrictions, balance, plan eligibility, and model-specific grants can affect a request. Claude models require additional account access; see the [Claude usage disclosure](/api-reference/messages/create#claude-access-and-usage-checks).

Keep credentials out of client-side code, source control, and logs. Manage or replace keys through your dashboard, and use separate credentials for separate integrations. See [error handling](/guides/errors) when a request is rejected.


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