Skip to main content

LLM Configuration

Superadmin endpoints for managing AI/LLM provider configuration — create, update, delete, and test LLM credentials.

Base Path

/llm-config

Authentication

All endpoints require superadmin access.

Instance Scoping

All endpoints accept an optional X-Instance-Id header:

  • With header: Manages the config for a specific tenant instance
  • Without header: Manages the control-plane (global) config

Endpoints

Get AI Configuration

GET /llm-config/

Return the current AI configuration with a masked API key.

Response 200 OK

{
"id": "...",
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"api_key_masked": "sk-ant-...XXXX",
"instance_id": null,
"created_at": "2026-02-27T10:00:00Z",
"updated_at": "2026-02-27T15:00:00Z"
}

Returns null if no configuration exists.


Create AI Configuration

POST /llm-config/

Request Body

{
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"api_key": "sk-ant-..."
}
FieldTypeRequiredDescription
providerstringYesLLM provider: anthropic, openai, etc.
modelstringYesModel identifier
api_keystringYesProvider API key (stored encrypted)

Response 201 Created

Error Responses

StatusDescription
409Configuration already exists for this scope

Update AI Configuration

PATCH /llm-config/

Update any combination of provider, model, or API key.

Request Body

{
"model": "claude-sonnet-4-20250514",
"api_key": "sk-ant-new-key..."
}

All fields are optional — only provided fields are updated.

Error Responses

StatusDescription
404No configuration found

Delete AI Configuration

DELETE /llm-config/

Remove the AI configuration entirely. AI features will be disabled until a new configuration is created.

Error Responses

StatusDescription
404No configuration found

Test Connection

POST /llm-config/test-connection

Test the stored LLM credentials by calling the provider's models API. Use this to verify that the API key is valid and the model is accessible.

Response 200 OK

{
"success": true,
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"message": "Connection successful"
}

Error Responses

StatusDescription
404No configuration found to test