Skip to main content
POST
Create or schedule a pricing rule
Creates a new pricing version for a model. Pricing drives every cost-aware feature on the platform — usage attribution, spend reporting, and budgets with a cost_limit.

Activate now or schedule for later

The effective_from field decides whether the change is immediate or scheduled:
  • Omit (or null) — the price activates immediately and replaces the current effective price for this rule.
  • Future timestamp — the price activates on that date, recorded as a scheduled change. Visible to admins via the history endpoint and the Scheduled indicator in the Barndoor app.
Past versions are immutable; to correct a mistake, create a new version with an immediate effective_from.

Sync mode

sync_mode controls whether Barndoor’s seeded defaults can move this row later:
  • pinned (default for manually-created rules) — never auto-sync.
  • tracking — show the user a prompt when defaults change.
  • auto — silently follow the default. Useful when you want to outsource pricing maintenance entirely to Barndoor.

Example

For wildcards, scheduling, and the four-tier resolution order, see Manage Model Pricing.

Authorizations

Authorization
string
header
required

An access token from Barndoor's identity provider, sent as Authorization: Bearer <token>. Use a service-account token from the OAuth 2.0 client-credentials grant for scripts and CI, or a signed-in user's token. The caller needs the admin role in the organization. Gateway API keys (bd-...) are not accepted here.

Body

application/json
input_cost_per_million_tokens
number<double>
required
model_pattern
string
required

Model name or glob pattern the rule prices, such as gpt-5.5 or claude-*.

output_cost_per_million_tokens
number<double>
required
cache_read_cost_per_million_tokens
number<double> | null

Rate for input tokens read from the prompt cache. Omit to use the Barndoor default, or the input rate when there is none.

cache_write_cost_per_million_tokens
number<double> | null

Rate for input tokens written to the prompt cache (the cache-creation premium some models charge). Omit for no override.

catalog_slug
string | null

Provider catalog slug for provider-level pricing, such as openai or aws_bedrock.

change_reason
string | null

Optional free-text note ("Q1 pricing review", "Negotiated discount") surfaced on the History dialog timeline.

effective_from
string<date-time> | null

When the price takes effect. Omit or send null for now; a future time schedules the change.

long_context
null | object

Optional higher rate set for large prompts. Omit when the model has one rate at every prompt size.

model_provider
string | null

Provider family the rule applies to, such as openai. Omit to match any provider.

provider_id
string<uuid> | null

Limit the rule to one provider in your organization.

sync_mode
enum<string>

How the rule reacts to changes in Barndoor's default pricing. Defaults to pinned.

Available options:
tracking,
pinned,
auto

Response

Created

One version of a pricing rule, with its sync mode and how the version was created.

effective_from
string<date-time>
required

When this version takes effect. The version with the latest effective_from in the past is the one billed.

id
string<uuid>
required
input_cost_per_million_tokens
number<double>
required
model_pattern
string
required
org_id
string<uuid>
required
output_cost_per_million_tokens
number<double>
required
change_source
enum<string>
required

How a pricing version was created: admin_create, admin_edit, admin_schedule, import, sync_manual, sync_auto, admin_archive, or admin_restore.

Available options:
admin_create,
admin_edit,
admin_schedule,
import,
sync_manual,
sync_auto,
admin_archive,
admin_restore
is_archived
boolean
required

True for the version that archived the rule. Archived rules are excluded from GET /admin/model-pricing.

sync_mode
enum<string>
required

How the rule reacts to changes in Barndoor's default pricing.

Available options:
tracking,
pinned,
auto
cache_read_cost_per_million_tokens
number<double> | null

Rate for input tokens read from the prompt cache. Null means cached input is billed at the input rate.

cache_write_cost_per_million_tokens
number<double> | null

Rate for input tokens written to the prompt cache. Null means no separate rate.

catalog_slug
string | null

Catalog slug for provider-level pricing (e.g. "openai", "aws_bedrock").

long_context
null | object

Optional higher rate set for large prompts.

model_provider
string | null
provider_id
string<uuid> | null

Optional reference to a specific LLM Gateway provider instance.

provider_name
string | null
change_reason
string | null

Free-text note recorded with this version.

created_by_email
string | null
created_by_name
string | null
created_by_user_id
string<uuid> | null