listPricingDefaults.md
List Barndoor's default pricing
The default pricing catalog Barndoor maintains. Use as a starting point for import-defaults and sync-defaults.
OpenAPI
# OpenAPI Specification for Barndoor LLM Gateway
openapi: 3.1.0
info:
title: Barndoor LLM Gateway API
version: 1.0.0
description: >
REST API for the Barndoor LLM Gateway: configure providers, model routes,
pricing, governance, and operate a multi-provider LLM platform
programmatically.
All endpoints in this document are scoped to your organization. They are the
same APIs powering the Barndoor portal under **LLM Configuration**,
**LLM Controls**, and **Settings - My Models**, exposed for teams that
prefer scripting over the UI.
## Base URL
All requests are issued against your Barndoor instance:
```
https://app.barndoor.ai/api/llm-gateway
```
Replace `app.barndoor.ai` with your tenant host if you run on Enterprise.
## Authentication
Endpoints accept a JWT Bearer token issued by your Barndoor identity
provider. Tokens can be obtained interactively via the Barndoor SDK:
```ts
const sdk = await loginInteractive();
```
The token must be sent in the `Authorization` header on every request:
```
Authorization: Bearer eyJhbGciOi...
```
Note: the `bd-...` API keys you create through these endpoints are for
runtime LLM traffic (`/v1/chat/completions`, `/v1/messages`, etc.), not for
administrative calls. Administrative endpoints require a user/admin JWT.
## Permissions
Most endpoints require an `admin` (or higher) role on the calling user.
Read-only endpoints are typically accessible by all authenticated users.
Read-only listings under `/user/...` are scoped to the authenticated user.
## Errors
Errors are returned as JSON with a stable shape:
```json
{ "error": "BadRequest", "message": "request_timeout_secs must be between 1 and 3600" }
```
### contact:
name: Barndoor Support
url: https://barndoor.ai
### servers:
- url: https://{host}/api/llm-gateway
description: >-
Production / Trial (Barndoor SaaS). The gateway lives on your Barndoor
control-plane host. For Enterprise or self-hosted deployments, replace the
host with your portal hostname — the authoritative value is shown on
Settings → My Models in the portal.
variables:
host:
description: Your Barndoor control-plane (portal) hostname
default: app.barndoor.ai
- url: https://app.barndooruat.com/api/llm-gateway
description: UAT
- url: https://app.barndoordev.com/api/llm-gateway
description: Dev
### security:
- BearerAuth: []
### tags:
- name: Credentials
description: >-
Reusable upstream credentials (API keys, AWS roles, Vertex service
accounts)
- name: Providers
description: Named upstream providers backed by credentials and a model family
- name: Provider Catalog
description: Read-only catalog of supported upstream provider templates
- name: Model Routes
description: Map client-facing aliases to one or more upstream provider/model pairs
- name: Model Pricing
description: Per-million-token input/output costs for usage and budget reporting
- name: Rate Limits
description: Requests-per-minute and tokens-per-minute caps
- name: Token Budgets
description: Daily, weekly, or monthly token and cost ceilings
- name: Model Access
description: Allowlist or denylist policies for models, providers, or aliases
- name: Smart Models
description: Routing policies that pick a target model based on the request
- name: Governance Configuration
description: Org-wide behavior toggles for the LLM Gateway
- name: Route Health
description: Operational view of upstream route ejection and recovery
- name: API Keys
description: Org-managed gateway API keys (the `bd-...` keys callers send on `/v1/...`)
- name: User
description: Self-service endpoints for the authenticated user
### paths:
/admin/model-pricing/defaults:
get:
tags:
- Model Pricing
summary: List Barndoor's default pricing
description: |
The default pricing catalog Barndoor maintains. Use as a starting
point for `import-defaults` and `sync-defaults`.
operationId: listModelPricingDefaults
responses:
'200':
description: List of default pricing entries
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ModelPricingDefault'
### components:
schemas:
ModelPricingDefault:
type: object
description: |
A single entry in the default pricing catalog Barndoor maintains.
Returned by `GET /admin/model-pricing/defaults` and used as the source
rows for `import-defaults` and `sync-defaults`.
The catalog is filtered to providers currently enabled in this
environment — pricing for disabled providers is intentionally not
surfaced here even though it exists in the database (so historical
cost calculation keeps working).
required:
- id
- provider_slug
- model_name
- model_pattern
- input_cost_per_million_tokens
- output_cost_per_million_tokens
- currency
- source
properties:
id:
type: string
format: uuid
description: >-
Stable identifier for this default row. Pass in `ids` to import or
sync a subset.
provider_slug:
type: string
description: Catalog slug of the provider this pricing applies to.
example: openai
model_name:
type: string
description: Human-readable model identifier.
example: gpt-4o-mini
model_pattern:
type: string
description: |
Pattern matched against the upstream model name when billing.
Usually the same as `model_name`; may be a `*` wildcard for
providers that bill all variants at one rate.
example: gpt-4o-mini
input_cost_per_million_tokens:
type: number
description: USD (or `currency`) cost per 1M input tokens.
example: 0.15
output_cost_per_million_tokens:
type: number
description: USD (or `currency`) cost per 1M output tokens.
example: 0.6
currency:
type: string
description: >-
ISO-4217 currency code. Barndoor publishes its managed defaults in
USD.
example: USD
source:
type: string
description: |
Provenance label for this row (e.g. provider YAML name, vendor
price-sheet snapshot). Surfaced in the admin UI so operators can
tell where a default came from.
cache_read_cost_per_million_tokens:
type: number
description: |
Barndoor's managed prompt-cache read rate. **Omitted** when the
provider/model doesn't support caching (embeddings, vision, classic
text-completion, etc.) — the field is absent from the JSON rather
than sent as `0` so the admin UI hides the cache row entirely
instead of rendering a misleading "$0.00".
cache_write_cost_per_million_tokens:
type: number
description: |
Barndoor's managed prompt-cache write rate. Same omission semantics
as `cache_read_cost_per_million_tokens`.
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: |
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.