Skip to main content
POST
Create a provider

Authorizations

Authorization
string
header
required

A Barndoor API key, sent as Authorization: Bearer <key>. Keys are prefixed bdai_ and are opaque — do not attempt to decode one. Interchangeable with an OAuth 2.0 access token.

Scopes

openid

Issue an OIDC ID token identifying the caller.

profile

Read the caller's basic profile claims.

email

Read the caller's email address.

Body

application/json
base_url
string
required
model_provider
string
required
name
string
required
api_key
string | null

The provider's upstream API key. Required when connection_id is not supplied.

auth_type
string | null
billing_mode
enum<string> | null

Whether the gateway records a per-token cost (BCP-3876). Omitted means per_token — a provider never stops recording cost by default, and nothing is inferred server-side. The create form suggests from the catalog entry and the auth type; openrouter is why inference would be wrong (it ships pricing: [] and is API-billed).

Available options:
per_token,
not_metered
billing_note
string | null

Optional free-text context for the arrangement, max [BILLING_NOTE_MAX_LEN] chars.

billing_reason
enum<string> | null

How the vendor bills. Required when billing_mode is not_metered, optional otherwise — see validate_billing_fields.

Available options:
subscription,
local,
external,
other
catalog_id
string<uuid> | null

Optional reference to a provider_catalog entry.

change_note
string | null

Optional free-text note explaining why this provider was added (BCP-3998). Distinct from billing_note, which describes the billing arrangement and persists; this describes one change and is replaced by the next edit's note.

connection_id
string<uuid> | null

Optional reference to a connection for shared credentials.

credentials
any

Structured provider credentials. Preferred over api_key for provider-specific auth schemas; never returned by any API.

enforce_health_check
boolean | null

Whether routing should gate on the connectivity health check. None/omitted defaults to true (enforce). Set false to override the gate and serve the provider even when its probe fails.

model_sync_mode
enum<string> | null

Whether this provider tracks Barndoor's model catalog (BCP-3811). Omitted means off — a provider is never enrolled by default.

Available options:
off,
additive,
full
models
string[]

Upstream models to auto-create as 1:1 model mappings (alias = upstream name).

request_timeout_secs
integer<int32> | null

Provider-tier total-request timeout override (non-streaming). Operator-only and None by default: the effective value is written at the route tier (model_mappings), so this applies only if a route row leaves it unset, and then to every such route served by this provider. The range is fixed platform policy (TOTAL_REQUEST_TIMEOUT_MIN_SECS..=TOTAL_REQUEST_TIMEOUT_MAX_SECS); see [crate::proxy::timeouts].

settings
any
stream_idle_timeout_secs
integer<int32> | null

Provider-tier stream-idle timeout override (streaming). Operator-only and None by default; the effective value is written at the route tier (model_mappings). The range is fixed platform policy (STREAM_IDLE_TIMEOUT_MIN_SECS..=STREAM_IDLE_TIMEOUT_MAX_SECS); see [crate::proxy::timeouts].

Response

The created record

Who created and last changed this provider, and why (BCP-3998).

Absent in the resolve/route queries -- the request path never reads it -- and read with try_get, so those rows come back unattributed rather than failing. That is indistinguishable from a row nobody has touched since V75, which is the correct thing for a value the request path was never given.

auth_type
string
required
base_url
string
required
billing_mode
enum<string>
required

Whether the gateway records a per-token cost for this provider's traffic (V69 / BCP-3876). PerToken for every provider that has not opted in, which is the default and the back-compat value.

The request path does not read this field: billing consults [ai_governance::CostCalculator]'s own cached not-metered set, which is refreshed from the same query as pricing. This exists for the admin API surface and the audit trail.

Available options:
per_token,
not_metered
created_at
string<date-time>
required
enabled
boolean
required
enforce_health_check
boolean
required

Operator override for the health gate (V46). When true (default) routing requires health_status <> 'unhealthy'; when false the gate is bypassed and the provider serves regardless of probe results (we still probe and surface health). Lets an admin force traffic through a false-positive probe.

health_status
string
required

Observed upstream reachability, recorded separately from enabled (operator intent) so the system never overwrites the toggle (V45). One of unverified | healthy | unhealthy. unverified is the back-compat default and also covers provider families we don't probe (Bedrock/Vertex/Azure, claude_oauth, codex_oauth). A provider serves traffic only when enabled AND health_status <> 'unhealthy': a failed probe auto-suspends it from routing (see resolve_*) without disabling it, and it resumes once a probe records it healthy again.

id
string<uuid>
required
model_provider
string
required
model_sync_mode
enum<string>
required

Whether this provider tracks Barndoor's model catalog, and how far (V63 / BCP-3811). Off for every provider that has not opted in, which is the default and the back-compat value.

Available options:
off,
additive,
full
name
string
required
org_id
string<uuid>
required
secret_path
string
required
settings
any
required
updated_at
string<date-time>
required
created_by_email
string | null
created_by_name
string | null
created_by_user_id
string<uuid> | null
last_change_note
string | null

Optional free text explaining why the last change was made ("Raised for the Q3 batch job", "Vendor deprecated the old endpoint").

Admin-authored and rendered in the portal, so it is untrusted input: length-capped here, escaped on render.

last_modified_at
string<date-time> | null

When the change named by last_modified_by_* happened.

Its own column rather than the row's updated_at, because updated_at is bumped by writes nobody is attributed for -- pairing the two would date a named admin's edit to a background job's clock. See the V75 migration for the full reasoning.

last_modified_by_email
string | null
last_modified_by_name
string | null
last_modified_by_user_id
string<uuid> | null
billing_note
string | null

Optional free-text context for the arrangement (max 200 chars). Human-readable only — never parsed, never aggregated.

billing_reason
enum<string> | null

How the vendor bills this provider. Required when billing_mode is NotMetered, optional otherwise (V69 CHECK-enforced) — a subscription billing overages is both per-token and a subscription. Purely descriptive: no code branches on it, which is what lets a new reason be added without touching the billing path.

Available options:
subscription,
local,
external,
other
catalog_id
string<uuid> | null
catalog_slug
string | null
connection_id
string<uuid> | null
health_checked_at
string<date-time> | null

When the last connectivity probe ran (NULL until the first probe).

health_detail
string | null

Reason for the last unhealthy or unverified probe (NULL if healthy or never probed).

request_timeout_secs
integer<int32> | null

Provider-tier total-request timeout override (non-streaming). Operator-only and None by default: the effective value is written at the route tier (model_mappings), so this only applies if a route row somehow leaves it unset. Range TOTAL_REQUEST_TIMEOUT_MIN_SECS..=TOTAL_REQUEST_TIMEOUT_MAX_SECS is enforced by the CHECK constraint (see proxy::timeouts).

stream_idle_timeout_secs
integer<int32> | null

Provider-tier stream-idle timeout override (streaming). Operator-only and None by default; the effective value is written at the route tier (model_mappings). Range STREAM_IDLE_TIMEOUT_MIN_SECS..=STREAM_IDLE_TIMEOUT_MAX_SECS is enforced by the CHECK constraint (see proxy::timeouts).