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-..."
}
| Field | Type | Required | Description |
|---|---|---|---|
provider | string | Yes | LLM provider: anthropic, openai, etc. |
model | string | Yes | Model identifier |
api_key | string | Yes | Provider API key (stored encrypted) |
Response 201 Created
Error Responses
| Status | Description |
|---|---|
409 | Configuration 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
| Status | Description |
|---|---|
404 | No 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
| Status | Description |
|---|---|
404 | No 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
| Status | Description |
|---|---|
404 | No configuration found to test |
Related
- AI Copilot — Chat and description generation endpoints
- Secrets Management Guide — How API keys are stored and encrypted