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

# Estimate the cost of a request

> Returns the credit cost of a generation request **without running it**. Send the same
body you'd send to the generate endpoint, plus `model`.

The cost is computed by the same logic that bills you, so it can't disagree with the
invoice. `exact` is `true` for deterministic pricing. For seedream's sequential mode
(the model chooses how many images, up to `max_images`) `credits` is the ceiling we
reserve and `exact` is `false` — the real charge is always ≤ it. Failed jobs cost
nothing, so you're never charged more than `credits`.




## OpenAPI

````yaml /openapi.yaml post /cost
openapi: 3.1.0
info:
  contact:
    email: support@budgetpixel.com
    name: BudgetPixel Support
  description: >
    The BudgetPixel developer API for programmatic image and video generation.


    Generation is **asynchronous**: you create a job, then poll its status until
    it

    reaches a terminal state (`succeeded` / `failed`). You are charged in
    credits

    only on success — never for failures, timeouts, or content blocked before

    generation.


    **Authentication.** All requests require an API key sent as a bearer token:

        Authorization: Bearer bpx_live_xxx

    Create and manage keys from your BudgetPixel account dashboard. The
    developer

    API is currently available on the **Ultra** plan.


    **Pricing.** API usage is metered in credits at each model's published price

    (see `GET /v1/models`). Consumer subscription perks (free daily generations,

    free-for-Ultra models, subscription discounts) do not apply to API traffic.
  title: BudgetPixel API
  version: '2026-06-20'
servers:
  - description: Production
    url: https://api.budgetpixel.com/v1
security:
  - ApiKeyAuth: []
tags:
  - description: Account and credit balance
    name: Account
  - description: Discover available models and pricing
    name: Models
  - description: Upload input media for image/video generation
    name: Uploads
  - description: Image job status
    name: Images
  - description: FLUX image models
    name: Black Forest Labs
  - description: SeeDream image models
    name: Bytedance
  - description: Video job status
    name: Videos
  - description: Kuaishou Kling video models
    name: Kling
  - description: SeeDance video models
    name: ByteDance (SeeDance)
  - description: Music job status
    name: Audios
  - description: Music generation models
    name: Music
  - description: Format conversion for images, video, and audio
    name: Conversions
  - description: Publish posts to your BudgetPixel feed
    name: Social
  - description: Content moderation — NSFW rating and CSAM detection
    name: Moderation
  - description: Content classification — music genre detection
    name: Classification
paths:
  /cost:
    post:
      tags:
        - Models
      summary: Estimate the cost of a request
      description: >
        Returns the credit cost of a generation request **without running it**.
        Send the same

        body you'd send to the generate endpoint, plus `model`.


        The cost is computed by the same logic that bills you, so it can't
        disagree with the

        invoice. `exact` is `true` for deterministic pricing. For seedream's
        sequential mode

        (the model chooses how many images, up to `max_images`) `credits` is the
        ceiling we

        reserve and `exact` is `false` — the real charge is always ≤ it. Failed
        jobs cost

        nothing, so you're never charged more than `credits`.
      operationId: estimateCost
      requestBody:
        content:
          application/json:
            example:
              length_seconds: 5
              model: seedance-2.0
              resolution: 1080p
            schema:
              additionalProperties: true
              properties:
                model:
                  description: The model slug (image or video), e.g. `seedance-2.0`.
                  type: string
              required:
                - model
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostEstimate'
          description: The estimated cost.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    CostEstimate:
      description: >-
        The credit cost of a request. The real charge is always ≤ `credits`
        (failures cost nothing; sequential image jobs may use fewer images).
      properties:
        credits:
          description: >-
            Credits the request will cost — the maximum, for non-deterministic
            cases.
          example: 2750
          type: integer
        exact:
          description: >-
            True when the cost is exact; false when `credits` is an upper bound
            (e.g. seedream sequential, where the model picks the image count).
          type: boolean
        model:
          example: seedance-2.0
          type: string
        type:
          enum:
            - image
            - video
          type: string
      required:
        - model
        - type
        - credits
        - exact
      type: object
    Error:
      properties:
        error:
          properties:
            code:
              description: Stable machine-readable code.
              example: model_not_available
              type: string
            message:
              type: string
            type:
              description: Error category.
              example: invalid_request_error
              type: string
          required:
            - type
            - code
            - message
          type: object
      required:
        - error
      type: object
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The request was malformed or referenced an unavailable model.
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Missing or invalid API key.
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Authenticated but not permitted (plan gate, ownership, restriction).
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The requested job was not found.
    TooManyRequests:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Rate or queue limit reached. Retry after a short delay.
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: bpx_live_*
      description: 'API key as a bearer token: Authorization: Bearer bpx_live_xxx'
      scheme: bearer
      type: http

````