> ## Documentation Index
> Fetch the complete documentation index at: https://docs.barndoor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit a scheduled pricing version

> Updates a future-dated (scheduled) pricing version in place. Past versions are immutable: to change the active price, create a new version with `POST /admin/model-pricing`.



## OpenAPI

````yaml api-reference/llm-gateway-openapi.yml put /admin/model-pricing/{id}
openapi: 3.1.0
info:
  title: Barndoor LLM Gateway Admin API
  version: 1.0.0
  description: >
    Configure the Barndoor LLM Gateway programmatically: credentials and
    providers,

    model routes and route groups, pricing, routing policies and rules, launch
    profiles,

    budgets, rate limits, model access, API keys, and organization-wide
    governance settings.


    These are the same APIs the Barndoor app uses under **LLM Management**, and
    the

    Barndoor Terraform provider manages its LLM Gateway resources through them.
    Every

    endpoint is scoped to the organization of the calling token.


    ## Base URL


    ```

    https://app.barndoor.ai/api/llm-gateway

    ```


    For a dedicated deployment, replace `app.barndoor.ai` with the host you sign
    in to.


    ## Authentication


    Send an access token from Barndoor's identity provider in the
    `Authorization` header:


    ```

    Authorization: Bearer <access-token>

    ```


    For scripts and CI, use a service-account token from the OAuth 2.0
    client-credentials

    grant, as the Terraform provider does. The caller needs the admin role in
    the

    organization.


    The `bd-...` API keys you create with these endpoints are for LLM traffic

    (`/v1/chat/completions`, `/v1/messages`, and so on), not for these
    administrative calls.


    ## Partial updates


    Most `PUT` endpoints change only the fields you send. Where a field can be
    cleared,

    send it as `null`; omitting it leaves it unchanged. The exceptions are
    called out on

    the endpoint: `PUT /admin/governance-config` replaces the whole
    configuration,

    `PUT /admin/routing-rules/{id}` replaces the whole rule, and

    `PUT /admin/agent-runtime-profiles/{slug}` replaces the profile's models.


    ## Errors


    Errors are returned as JSON:


    ```json

    { "error": { "message": "retry_on_429_count must be between 0 and 10",
    "type": "invalid_request_error" } }

    ```
  contact:
    name: Barndoor Support
    url: https://barndoor.ai
servers:
  - url: https://{host}/api/llm-gateway
    description: Your Barndoor platform host.
    variables:
      host:
        default: app.barndoor.ai
        description: >-
          The host serving your Barndoor deployment. Use the default for
          Barndoor SaaS; for a dedicated deployment, use the host you sign in
          to.
security:
  - BearerAuth: []
tags:
  - name: Credentials
    description: >-
      Stored upstream secrets (API keys, AWS roles, Google credentials) that
      providers reference
  - name: Providers
    description: Named upstream providers backed by a credential and a model family
  - name: Model Routes
    description: >-
      Map caller-facing aliases to upstream models on one or more providers,
      with failover order, retries, timeouts, and cooldowns
  - name: Route Groups
    description: >-
      Named sets of model aliases that model access policies can target as one
      unit
  - name: Model Pricing
    description: >-
      Versioned per-million-token costs used for cost reporting and cost-based
      budgets
  - name: Routing Policies
    description: Model aliases that pick one of several model slots for each request
  - name: Routing Rules
    description: >-
      Plain-English rules that set a minimum slot or forbid slots on a routing
      policy
  - name: Launch Profiles
    description: >-
      Models and capabilities applied when members start an agent with barndoor
      run
  - name: Rate Limits
    description: Requests-per-minute and tokens-per-minute ceilings
  - name: Budgets
    description: Daily, weekly, or monthly token and cost ceilings
  - name: Model Access
    description: >-
      Allowlist and denylist policies for models, providers, aliases, and route
      groups
  - name: Governance
    description: Organization-wide LLM Gateway settings
  - name: API Keys
    description: Organization-managed `bd-...` gateway API keys for LLM traffic
paths:
  /admin/model-pricing/{id}:
    put:
      tags:
        - Model Pricing
      summary: Edit a scheduled pricing version
      description: >-
        Updates a future-dated (scheduled) pricing version in place. Past
        versions are immutable: to change the active price, create a new version
        with `POST /admin/model-pricing`.
      operationId: updatePricing
      parameters:
        - name: id
          in: path
          description: Record ID (UUID)
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePricingRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminModelPricing'
        '400':
          description: Invalid request. The error message says which field or rule failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Your role does not allow this action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such record in your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            Another pricing version for this rule already occupies that
            `effective_from` time
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    UpdatePricingRequest:
      type: object
      properties:
        cache_read_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: >-
            New prompt-cache read rate. Omit to leave unchanged; send `null` to
            clear.
        cache_write_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: >-
            New prompt-cache write rate. Omit to leave unchanged; send `null` to
            clear.
        change_reason:
          type:
            - string
            - 'null'
        effective_from:
          type:
            - string
            - 'null'
          format: date-time
          description: New activation time. Must not be in the past.
        input_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
        long_context:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LongContextTierRequest'
              description: >-
                New long-context rate set. Omit to leave unchanged; send `null`
                to remove the tier.
        output_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
        sync_mode:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PricingSyncMode'
              description: Omit to leave the sync mode unchanged.
    AdminModelPricing:
      allOf:
        - $ref: '#/components/schemas/ModelPricing'
        - type: object
          required:
            - sync_mode
            - change_source
            - is_archived
          properties:
            change_reason:
              type:
                - string
                - 'null'
              description: Free-text note recorded with this version.
            change_source:
              $ref: '#/components/schemas/PricingChangeSource'
            created_by_email:
              type:
                - string
                - 'null'
            created_by_name:
              type:
                - string
                - 'null'
            created_by_user_id:
              type:
                - string
                - 'null'
              format: uuid
            is_archived:
              type: boolean
              description: >-
                True for the version that archived the rule. Archived rules are
                excluded from `GET /admin/model-pricing`.
            sync_mode:
              $ref: '#/components/schemas/PricingSyncMode'
              description: How the rule reacts to changes in Barndoor's default pricing.
      description: >-
        One version of a pricing rule, with its sync mode and how the version
        was created.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              description: Human-readable explanation of what went wrong.
            type:
              type: string
              description: >-
                Error category, such as `invalid_request_error`,
                `authentication_error`, `permission_error`, `not_found_error`,
                or `conflict_error`.
            code:
              type:
                - string
                - 'null'
              description: Machine-readable code, when one applies.
      example:
        error:
          message: retry_on_429_count must be between 0 and 10
          type: invalid_request_error
    LongContextTierRequest:
      type: object
      description: A long-context rate set. The tier is set or removed as a whole.
      required:
        - threshold_prompt_tokens
        - input_cost_per_million_tokens
        - output_cost_per_million_tokens
      properties:
        cache_read_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: Omit to bill long-context cache reads at this tier's input rate.
        cache_write_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
        input_cost_per_million_tokens:
          type: number
          format: double
        output_cost_per_million_tokens:
          type: number
          format: double
        threshold_prompt_tokens:
          type: integer
          format: int64
          description: >-
            Prompt size, in tokens (non-cached input plus cache reads and
            writes), at or above which this tier's rates replace the base rates
            for the whole request.
    PricingSyncMode:
      type: string
      description: >-
        `pinned`: never changed by default-pricing updates. `tracking`: updates
        to Barndoor's defaults are surfaced for review. `auto`: the price
        follows Barndoor's defaults automatically.
      enum:
        - tracking
        - pinned
        - auto
    ModelPricing:
      type: object
      required:
        - id
        - org_id
        - model_pattern
        - input_cost_per_million_tokens
        - output_cost_per_million_tokens
        - effective_from
      properties:
        cache_read_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: >-
            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:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Rate for input tokens written to the prompt cache. Null means no
            separate rate.
        catalog_slug:
          type:
            - string
            - 'null'
          description: >-
            Catalog slug for provider-level pricing (e.g. "openai",
            "aws_bedrock").
        effective_from:
          type: string
          format: date-time
          description: >-
            When this version takes effect. The version with the latest
            `effective_from` in the past is the one billed.
        id:
          type: string
          format: uuid
        input_cost_per_million_tokens:
          type: number
          format: double
        long_context:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LongContextTier'
              description: Optional higher rate set for large prompts.
        model_pattern:
          type: string
        model_provider:
          type:
            - string
            - 'null'
        org_id:
          type: string
          format: uuid
        output_cost_per_million_tokens:
          type: number
          format: double
        provider_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Optional reference to a specific LLM Gateway provider instance.
        provider_name:
          type:
            - string
            - 'null'
      description: A pricing version.
    PricingChangeSource:
      type: string
      description: >-
        How a pricing version was created: `admin_create`, `admin_edit`,
        `admin_schedule`, `import`, `sync_manual`, `sync_auto`, `admin_archive`,
        or `admin_restore`.
      enum:
        - admin_create
        - admin_edit
        - admin_schedule
        - import
        - sync_manual
        - sync_auto
        - admin_archive
        - admin_restore
    LongContextTier:
      type: object
      description: >-
        A second rate set that replaces the base rates for the whole request
        once the prompt reaches `threshold_prompt_tokens`. It applies to output
        tokens as well as input.
      required:
        - threshold_prompt_tokens
        - input_cost_per_million_tokens
        - output_cost_per_million_tokens
      properties:
        cache_read_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: Null means cache reads are billed at this tier's input rate.
        cache_write_cost_per_million_tokens:
          type:
            - number
            - 'null'
          format: double
          description: Null means cache writes are billed at this tier's input rate.
        input_cost_per_million_tokens:
          type: number
          format: double
        output_cost_per_million_tokens:
          type: number
          format: double
        threshold_prompt_tokens:
          type: integer
          format: int64
          description: Prompt size, in tokens, at or above which this tier applies.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.