curl --request POST \
--url https://{host}/api/llm-gateway/admin/providers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"model_provider": "openai",
"base_url": "<string>",
"auth_type": "api_key",
"api_key": "<string>",
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"models": [
"gpt-4o-mini",
"gpt-4o"
],
"settings": {},
"credentials": {},
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900
}
'import requests
url = "https://{host}/api/llm-gateway/admin/providers"
payload = {
"name": "<string>",
"model_provider": "openai",
"base_url": "<string>",
"auth_type": "api_key",
"api_key": "<string>",
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"models": ["gpt-4o-mini", "gpt-4o"],
"settings": {},
"credentials": {},
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900
}
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({
name: '<string>',
model_provider: 'openai',
base_url: '<string>',
auth_type: 'api_key',
api_key: '<string>',
catalog_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
connection_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
models: ['gpt-4o-mini', 'gpt-4o'],
settings: {},
credentials: {},
request_timeout_secs: 1800,
stream_idle_timeout_secs: 900
})
};
fetch('https://{host}/api/llm-gateway/admin/providers', 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://{host}/api/llm-gateway/admin/providers",
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([
'name' => '<string>',
'model_provider' => 'openai',
'base_url' => '<string>',
'auth_type' => 'api_key',
'api_key' => '<string>',
'catalog_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'connection_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'models' => [
'gpt-4o-mini',
'gpt-4o'
],
'settings' => [
],
'credentials' => [
],
'request_timeout_secs' => 1800,
'stream_idle_timeout_secs' => 900
]),
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://{host}/api/llm-gateway/admin/providers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\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://{host}/api/llm-gateway/admin/providers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/providers")
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 \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "OpenAI Production (US)",
"model_provider": "openai",
"auth_type": "api_key",
"base_url": "<string>",
"enabled": true,
"settings": {},
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900,
"catalog_slug": "<string>"
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}Create a Provider
Creates a new named provider. Either supply a connection_id to share
an existing credential, or supply api_key / credentials to create
an inline secret as part of the request.
Pass models to enable a list of upstream model names as 1:1 routes
in the same call — equivalent to creating each route individually
afterwards.
curl --request POST \
--url https://{host}/api/llm-gateway/admin/providers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"model_provider": "openai",
"base_url": "<string>",
"auth_type": "api_key",
"api_key": "<string>",
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"models": [
"gpt-4o-mini",
"gpt-4o"
],
"settings": {},
"credentials": {},
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900
}
'import requests
url = "https://{host}/api/llm-gateway/admin/providers"
payload = {
"name": "<string>",
"model_provider": "openai",
"base_url": "<string>",
"auth_type": "api_key",
"api_key": "<string>",
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"models": ["gpt-4o-mini", "gpt-4o"],
"settings": {},
"credentials": {},
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900
}
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({
name: '<string>',
model_provider: 'openai',
base_url: '<string>',
auth_type: 'api_key',
api_key: '<string>',
catalog_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
connection_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
models: ['gpt-4o-mini', 'gpt-4o'],
settings: {},
credentials: {},
request_timeout_secs: 1800,
stream_idle_timeout_secs: 900
})
};
fetch('https://{host}/api/llm-gateway/admin/providers', 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://{host}/api/llm-gateway/admin/providers",
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([
'name' => '<string>',
'model_provider' => 'openai',
'base_url' => '<string>',
'auth_type' => 'api_key',
'api_key' => '<string>',
'catalog_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'connection_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'models' => [
'gpt-4o-mini',
'gpt-4o'
],
'settings' => [
],
'credentials' => [
],
'request_timeout_secs' => 1800,
'stream_idle_timeout_secs' => 900
]),
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://{host}/api/llm-gateway/admin/providers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\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://{host}/api/llm-gateway/admin/providers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/llm-gateway/admin/providers")
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 \"name\": \"<string>\",\n \"model_provider\": \"openai\",\n \"base_url\": \"<string>\",\n \"auth_type\": \"api_key\",\n \"api_key\": \"<string>\",\n \"catalog_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"models\": [\n \"gpt-4o-mini\",\n \"gpt-4o\"\n ],\n \"settings\": {},\n \"credentials\": {},\n \"request_timeout_secs\": 1800,\n \"stream_idle_timeout_secs\": 900\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "OpenAI Production (US)",
"model_provider": "openai",
"auth_type": "api_key",
"base_url": "<string>",
"enabled": true,
"settings": {},
"catalog_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"request_timeout_secs": 1800,
"stream_idle_timeout_secs": 900,
"catalog_slug": "<string>"
}{
"error": "BadRequest",
"message": "request_timeout_secs must be between 1 and 3600"
}- Inline credential — pass
api_key(orcredentials) directly. Barndoor stores the secret in its encrypted secret store, scoped to this provider. - Shared credential — pass
connection_idreferencing an existing Credential. The provider’sauth_type,base_url, and settings inherit from the shared record.
Auto-enabling models in one call
Pass a list of upstream model names inmodels and Barndoor will create a 1:1
Model Route for each
one in the same call. The route’s alias matches the upstream model name so
callers can address it as <provider>/<model>. Add bare-name aliases or
failover routes afterwards via the Model Routes endpoints.
Example
curl -X POST https://app.barndoor.ai/api/llm-gateway/admin/providers \
-H "Authorization: Bearer $BARNDOOR_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "OpenAI Production (US)",
"model_provider": "openai",
"base_url": "https://api.openai.com/v1",
"connection_id": "4f8b2a3c-12ee-4d92-9c7b-e7d2f8b0a111",
"models": ["gpt-4o-mini", "gpt-4o", "text-embedding-3-large"]
}'
Authorizations
JWT obtained through Barndoor's authentication flow. Pass the token
verbatim in Authorization: Bearer <token>. Use the Barndoor SDK's
loginInteractive() helper to obtain a token in scripts and notebooks.
Body
Slug of the upstream model provider this resource speaks to
openai, anthropic, azure_openai, google_ai, bedrock, vertex, groq, together, mistral, cohere, xai, fireworks, perplexity, openrouter, deepseek, custom "openai"
The authentication scheme this credential or provider uses to talk to
the upstream model provider. Valid values depend on model_provider:
for OpenAI/Anthropic-style vendors this is typically api_key; for AWS
Bedrock it is one of aws_role, aws_keys, or bedrock_api_key; for
Google Vertex it is google_adc, google_service_account, or
google_impersonation; Anthropic OAuth passthrough uses oauth_passthrough.
"api_key"
Required for direct API-key auth when no connection_id is provided
Optional reference to a provider catalog template
Optional reference to a shared Credentials record
Upstream models to enable on this provider as 1:1 model routes.
Each entry creates a route where the alias equals the upstream model
name (so callers can address it as <provider>/<model>).
["gpt-4o-mini", "gpt-4o"]
Structured non-API-key credentials (AWS keys, Vertex SA JSON, etc.)
1 <= x <= 36001 <= x <= 1800Response
The newly created provider
A named upstream provider backed by a credential and a model family.
"OpenAI Production (US)"
Slug of the upstream model provider this resource speaks to
openai, anthropic, azure_openai, google_ai, bedrock, vertex, groq, together, mistral, cohere, xai, fireworks, perplexity, openrouter, deepseek, custom "openai"
The authentication scheme this credential or provider uses to talk to
the upstream model provider. Valid values depend on model_provider:
for OpenAI/Anthropic-style vendors this is typically api_key; for AWS
Bedrock it is one of aws_role, aws_keys, or bedrock_api_key; for
Google Vertex it is google_adc, google_service_account, or
google_impersonation; Anthropic OAuth passthrough uses oauth_passthrough.
"api_key"
Reference to a built-in provider catalog template, if used
Reference to a shared Credentials record, if any
Provider-tier total-request timeout override. When null (the
default) the gateway inherits the platform default. Affects every
route served by this provider unless a more specific Model Route
value overrides it.
1 <= x <= 3600Maximum allowed idle gap between streamed response chunks. null
inherits the platform default.
1 <= x <= 1800Catalog slug shorthand used in some response listings