config.yml, and a short-lived JWT token obtained by logging in through the auth API. Both methods use the same Authorization: Bearer header pattern, making them compatible with standard OpenAI SDKs without any special client configuration.
Authentication methods
Method 1: Access key
Whenserver.access_key_enabled is true in your config.yml, you can authenticate by passing the configured access_key value directly. The key can be sent in either of two headers:
string
Bearer token header. Pass
Bearer <your-access-key> as the value.string
Alternative header for clients that cannot set a custom
Authorization value. Pass the raw key with no Bearer prefix.config.yml:
config.yml
curl with the Authorization header:
X-Access-Key header:
Method 2: JWT token
User accounts created throughPOST /api/auth/register can obtain a JWT token by logging in. Pass the token as a Bearer credential on subsequent requests. Tokens are short-lived; use the refresh token to obtain a new access token without re-authenticating.
string
required
Bearer <jwt-token> where the token is the access_token value returned by POST /api/auth/login.access_token:
Public endpoints
The following endpoints do not require authentication and can be called without any credentials:Python SDK example
Because MonoRelay is OpenAI-compatible, you can use the officialopenai Python library by pointing it at your MonoRelay instance. Pass your access key or JWT token as the api_key argument.
api_key value with the access_token string returned by POST /api/auth/login.
Error responses
If both
access_key_enabled is false and no valid JWT is present, all protected endpoints return 401 Unauthorized. Ensure at least one authentication method is configured before making API calls.