Create a Provider - Barndoor Documentation
Create a provider
cURL
curl --request POST \
--url https://app.barndoor.ai/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
}
'
JSON Payload Example
{
"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
}
A Provider
A Provider is a named upstream that authenticates with one credential and serves a model family. Provider creation supports two modes:
- 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 in models 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>.
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
Authorization
string
header
required
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
application/json
Body Fields
- name: string (required)
- model_provider: enum
(required) - base_url: string (required)
- auth_type: string (required)
- api_key: string
(required for direct API-key auth when no connection_idis provided) - catalog_id: string
- connection_id: string
- models: string[]
- settings: object
- credentials: object
- request_timeout_secs: integer | null
- stream_idle_timeout_secs: integer | null