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

# Get Model APIs costs

> Returns daily Model API costs in USD for your organization, with optional filtering and grouping by API key, user, model, and service tier. Results may differ from finalized invoice amounts. Cost history is available from August 5, 2026 at 20:45 UTC. August 5 is a partial day; earlier dates are unavailable.

<Note>
  Cost data starts on August 5, 2026, at 20:45 UTC. The August 5 bucket includes only usage after that time. The API rejects an earlier `start_date`.
</Note>

For token and request totals, see [Get Model APIs usage](/reference/management-api/model-apis/gets-model-apis-token-usage). For examples and billing details, see [Pricing and limits](/inference/model-apis/pricing-and-limits#costs).


## OpenAPI

````yaml get /v1/billing/model_apis
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/billing/model_apis:
    get:
      summary: Gets daily Model APIs costs
      description: >-
        Returns daily Model API costs in USD for your organization, with
        optional filtering and grouping by API key, user, model, and service
        tier. Results may differ from finalized invoice amounts. Cost history is
        available from August 5, 2026 at 20:45 UTC. August 5 is a partial day;
        earlier dates are unavailable.
      parameters:
        - name: cursor
          in: query
          required: false
          description: >-
            Opaque cursor returned by a previous page. Omit to fetch the first
            page.
          schema:
            anyOf:
              - type: string
              - type: 'null'
            default: null
            title: Cursor
        - name: limit
          in: query
          required: false
          description: Number of daily cost buckets to return. Defaults to 7; maximum 31.
          schema:
            default: 7
            maximum: 31
            minimum: 1
            title: Limit
            type: integer
        - name: start_date
          in: query
          required: false
          description: >-
            Inclusive UTC calendar day at the start of the query range. Defaults
            to the previous UTC date, cannot be before 2026-08-05, and is
            ignored when you pass a cursor.
          schema:
            anyOf:
              - format: date
                type: string
              - type: 'null'
            default: null
            title: Start Date
        - name: end_date
          in: query
          required: false
          description: >-
            Exclusive UTC calendar day at the end of the query range. Defaults
            to the day after the current UTC date so current-day usage is
            included. The date range cannot exceed 90 days.
          schema:
            anyOf:
              - format: date
                type: string
              - type: 'null'
            default: null
            title: End Date
        - name: group_by
          in: query
          required: false
          description: >-
            Dimensions to break costs down by, repeated once per dimension:
            api_key_prefix, user, model, or service_tier. Each result represents
            one observed combination of the requested dimensions within that
            day. For example, grouping by api_key_prefix and user returns each
            API-key and user pair that had usage. Combinations without usage are
            omitted, so result counts can differ between days. Omit for daily
            organization totals.
          schema:
            items:
              $ref: '#/components/schemas/ModelApiCostDimensionV1'
            title: Group By
            type: array
        - name: api_key_prefixes
          in: query
          required: false
          description: >-
            Return only costs for these exact API key prefixes, repeated once
            per prefix.
          schema:
            items:
              type: string
            title: Api Key Prefixes
            type: array
        - name: user_ids
          in: query
          required: false
          description: >-
            Return only costs attributed to these exact user IDs, repeated once
            per ID.
          schema:
            items:
              type: string
            title: User Ids
            type: array
        - name: models
          in: query
          required: false
          description: >-
            Return only costs for these exact model identifiers, repeated once
            per model.
          schema:
            items:
              type: string
            title: Models
            type: array
        - name: service_tiers
          in: query
          required: false
          description: >-
            Return only costs for these exact service tiers, repeated once per
            tier.
          schema:
            items:
              type: string
            title: Service Tiers
            type: array
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelApisCostsResponseV1'
      x-codeSamples:
        - lang: bash
          source: |
            curl --request GET \
            --url https://api.baseten.co/v1/billing/model_apis \
            --header "Authorization: Bearer $BASETEN_API_KEY"
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/billing/model_apis"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "GET",
                url,
                headers=headers,
                params={'cursor': None, 'start_date': None, 'end_date': None}
            )

            print(response.text)
components:
  schemas:
    ModelApiCostDimensionV1:
      enum:
        - api_key_prefix
        - user
        - model
        - service_tier
      title: ModelApiCostDimensionV1
      type: string
    ModelApisCostsResponseV1:
      description: >-
        One non-overlapping bucket per UTC day, ordered oldest first with no
        gaps.


        Days without matching usage are included with an empty results list.
      properties:
        items:
          description: Items in this page.
          items:
            $ref: '#/components/schemas/ModelApisCostBucketV1'
          title: Items
          type: array
        pagination:
          $ref: '#/components/schemas/PaginationResponseV1'
          description: Pagination metadata for the page.
      required:
        - items
        - pagination
      title: ModelApisCostsResponseV1
      type: object
    ModelApisCostBucketV1:
      description: One daily bucket and the costs attributed to it.
      properties:
        date:
          description: >-
            UTC calendar date for this bucket, from midnight inclusive to the
            next midnight exclusive.
          format: date
          title: Date
          type: string
        results:
          description: >-
            Cost totals for the observed combinations of requested dimensions in
            this bucket, ordered by those dimensions. Empty when the day has no
            matching usage.
          items:
            $ref: '#/components/schemas/ModelApisCostResultV1'
          title: Results
          type: array
      required:
        - date
      title: ModelApisCostBucketV1
      type: object
    PaginationResponseV1:
      properties:
        has_more:
          description: Whether more items exist after this page.
          title: Has More
          type: boolean
        cursor:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Opaque cursor to pass into the next request. Null when there is no
            next page.
          title: Cursor
      required:
        - has_more
      title: PaginationResponseV1
      type: object
    ModelApisCostResultV1:
      properties:
        api_key_prefixes:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            The single attributed API key prefix for this result. Null when not
            grouping by api_key_prefix or when attribution is unavailable.
          title: Api Key Prefixes
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Attributed user ID. Null when not grouping by user or when
            attribution is unavailable.
          title: User Id
        model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Model identifier. Null when not grouping by model.
          title: Model
        service_tier:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Service tier. Null when not grouping by service_tier or when
            attribution is unavailable.
          title: Service Tier
        subtotal:
          description: >-
            Model API cost in USD for this day and grouping combination,
            returned as an exact decimal string preserving fractional-cent
            amounts. This amount may differ from finalized invoice amounts.
          examples:
            - '0.00000123'
          title: Subtotal
          type: string
      required:
        - subtotal
      title: ModelApisCostResultV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````