Skip to content

AI Providers

Manage AI provider configuration and bring-your-own-key (BYOK) API keys for drift analysis.

Base path: /api/auth (AI provider settings are managed under auth routes)

Authentication: Bearer token required on all routes

Provider Settings

Get AI Provider Settings

GET /api/auth/ai-provider

Get the current user's AI provider configuration.

Response

json
{
  "success": true,
  "data": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-5-20250929",
    "hasCustomKey": true
  }
}

Example

bash
curl -H "Authorization: Bearer TOKEN" \
  https://api.controlinfra.com/api/auth/ai-provider

Update AI Provider Settings

PUT /api/auth/ai-provider

Update AI provider and model preferences.

Request Body

FieldTypeRequiredDescription
providerstringYesAI provider (anthropic, openai)
modelstringNoModel to use

Example

bash
curl -X PUT https://api.controlinfra.com/api/auth/ai-provider \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}'

Anthropic API Key (BYOK)

Get Anthropic Key Status

GET /api/auth/anthropic-api-key

Check if the user has a stored Anthropic API key.

Response

json
{
  "success": true,
  "data": {
    "hasKey": true,
    "keyPrefix": "sk-ant-****"
  }
}

Save Anthropic Key

POST /api/auth/anthropic-api-key

Store an Anthropic API key for BYOK usage.

Request Body

FieldTypeRequiredDescription
apiKeystringYesAnthropic API key

Verify Anthropic Key

POST /api/auth/anthropic-api-key/verify

Verify that the stored Anthropic API key is valid and working.

Response

json
{
  "success": true,
  "data": {
    "valid": true,
    "model": "claude-sonnet-4-5-20250929"
  }
}

Delete Anthropic Key

DELETE /api/auth/anthropic-api-key

Remove the stored Anthropic API key.

OpenAI API Key (BYOK)

Get OpenAI Key Status

GET /api/auth/openai-api-key

Check if the user has a stored OpenAI API key.

Save OpenAI Key

POST /api/auth/openai-api-key

Store an OpenAI API key for BYOK usage.

Request Body

FieldTypeRequiredDescription
apiKeystringYesOpenAI API key

Verify OpenAI Key

POST /api/auth/openai-api-key/verify

Verify that the stored OpenAI API key is valid.

Delete OpenAI Key

DELETE /api/auth/openai-api-key

Remove the stored OpenAI API key.