Skip to main content
All BYOK endpoints are mounted under /byok and require an authenticated session (authMiddleware). API keys submitted through this router are encrypted at rest using AES-256 before insertion into PostgreSQL and cached in Redis (byok:<userId>) with an 86400s (24-hour) TTL.

Endpoints

1. List Configured Providers

GET /byok Returns all AI providers configured by the authenticated user. API keys are strictly omitted from the response.
Response (200 OK)

2. Register or Update Provider Key

POST /byok Registers a new provider API key or updates an existing one. If a provider for the same user already exists, it updates in-place. If updating without changing the key, masked bullet strings (••••••••) are ignored to prevent accidental overwrites.

Request Body

Request Body
Response (201 Created)

3. Test & Probe Model List

POST /byok/model-list Tests connectivity and queries available models from a provider without persisting the key to the database. Always appends the platform’s free model catalog (goBetterFreeModels).
Request Body
Response (200 OK)

4. Get Active User Model Catalog

GET /byok/model-list Retrieves all available models across all enabled providers configured by the user. If model metadata is missing in the database, queries the provider API and caches the result. Also appends the platform free models.
Response (200 OK)

5. List Provider Summaries

GET /byok/providers Returns a lightweight list of provider connection cards for settings management.

6. Update Provider Settings

PATCH /byok/providers/:providerId
PATCH /byok/providers
Partially updates an existing provider configuration. Whitelisted fields: modelProviderName, customModels, customBaseURL, enabled, availableModels. Invalidates the Redis cache byok:<userId>.
Request Body
Response (200 OK)

7. Delete Provider

DELETE /byok/providers/:providerId Deletes a configured provider by UUID or provider name alias. Clears the user’s cached BYOK record in Redis. Response: 204 No Content