AI Models

Add AI provider to organization

POST
/api/ai-models/organization/{organizationId}/provider

Legacy endpoint that appends an entry to the aiProviders array on OrganizationCredentials with the supplied aiModel (AiModel _id), modelDetail (modelName) and apiKey. SUPERADMIN-only and tenant-scoped. The selected modelDetail must exist within the chosen provider.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

organizationId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/ai-models/organization/string/provider" \  -H "Content-Type: application/json" \  -d '{    "aiModel": "5f7b1c2e8a1d4e0012c3b4a5",    "modelDetail": "claude-sonnet-4-6",    "apiKey": "sk-ant-api03-AbCdEf1234567890XyZ"  }'
{  "success": true,  "data": {    "aiProviders": [      {        "_id": "65f9b1c2e8a1d4e001a0b1c3",        "aiModel": "5f7b1c2e8a1d4e0012c3b4a5",        "modelDetail": "claude-sonnet-4-6",        "apiKey": "sk-a••••••••f9d2"      }    ],    "currentAiProviderIndex": 0,    "currentAiModelIndex": 0,    "currentAiModelVercelUniqueName": "anthropic"  }}