Add AI provider to organization
curl --request POST \
--url https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-ant-api03-AbCdEf1234567890XyZ"
}
'import requests
url = "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider"
payload = {
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-ant-api03-AbCdEf1234567890XyZ"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
aiModel: '5f7b1c2e8a1d4e0012c3b4a5',
modelDetail: 'claude-sonnet-4-6',
apiKey: 'sk-ant-api03-AbCdEf1234567890XyZ'
})
};
fetch('https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'aiModel' => '5f7b1c2e8a1d4e0012c3b4a5',
'modelDetail' => 'claude-sonnet-4-6',
'apiKey' => 'sk-ant-api03-AbCdEf1234567890XyZ'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider"
payload := strings.NewReader("{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"aiProviders": [
{
"_id": "65f9b1c2e8a1d4e001a0b1c3",
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-a••••••••f9d2"
}
],
"currentAiProviderIndex": 0,
"currentAiModelIndex": 0,
"currentAiModelVercelUniqueName": "anthropic"
}
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}AI Models
Add AI provider to organization
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.
POST
/
api
/
ai-models
/
organization
/
{organizationId}
/
provider
Add AI provider to organization
curl --request POST \
--url https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-ant-api03-AbCdEf1234567890XyZ"
}
'import requests
url = "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider"
payload = {
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-ant-api03-AbCdEf1234567890XyZ"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
aiModel: '5f7b1c2e8a1d4e0012c3b4a5',
modelDetail: 'claude-sonnet-4-6',
apiKey: 'sk-ant-api03-AbCdEf1234567890XyZ'
})
};
fetch('https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'aiModel' => '5f7b1c2e8a1d4e0012c3b4a5',
'modelDetail' => 'claude-sonnet-4-6',
'apiKey' => 'sk-ant-api03-AbCdEf1234567890XyZ'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider"
payload := strings.NewReader("{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai-models/organization/{organizationId}/provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"aiModel\": \"5f7b1c2e8a1d4e0012c3b4a5\",\n \"modelDetail\": \"claude-sonnet-4-6\",\n \"apiKey\": \"sk-ant-api03-AbCdEf1234567890XyZ\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"aiProviders": [
{
"_id": "65f9b1c2e8a1d4e001a0b1c3",
"aiModel": "5f7b1c2e8a1d4e0012c3b4a5",
"modelDetail": "claude-sonnet-4-6",
"apiKey": "sk-a••••••••f9d2"
}
],
"currentAiProviderIndex": 0,
"currentAiModelIndex": 0,
"currentAiModelVercelUniqueName": "anthropic"
}
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}{
"success": false,
"message": "Organization credentials not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
ObjectId of the AiModel registry entry (provider) to attach to this organization.
modelName to use within the chosen provider; must exist in that AiModel's modelDetails.
Provider API key; stored encrypted and never returned in GET responses.
Set current active AI model for organizationUpdate an existing AI provider configuration for organization
⌘I