FriendliAI Cost API

The Cost API from FriendliAI — 1 operation(s) for cost.

OpenAPI Specification

friendliai-cost-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Friendli Suite API Reference Container.Audio Cost API
  description: This is an OpenAPI reference of Friendli Suite API.
  termsOfService: https://friendli.ai/terms-of-service
  contact:
    name: FriendliAI Support Team
    email: support@friendli.ai
  version: 0.1.0
servers:
- url: https://api.friendli.ai
tags:
- name: Cost
paths:
  /v1/team/cost:
    get:
      tags:
      - Cost
      summary: Cost
      description: Get cost details for the team.
      operationId: getCost
      security:
      - token: []
      parameters:
      - name: start_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: RFC 3339 timestamp in UTC. The time portion must be zeroed out (e.g., 2026-01-01T00:00:00Z). Must be no earlier than one year ago.
          title: Start Time
        description: RFC 3339 timestamp in UTC. The time portion must be zeroed out (e.g., 2026-01-01T00:00:00Z). Must be no earlier than one year ago.
      - name: bucket_width
        in: query
        required: false
        schema:
          anyOf:
          - $ref: '#/components/schemas/CostBucketWidth'
          - type: 'null'
          description: Width of each time bucket in response. Currently only `1d` is supported, default to `1d`.
          default: 1d
          title: Bucket Width
        description: Width of each time bucket in response. Currently only `1d` is supported, default to `1d`.
      - name: end_time
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: RFC 3339 timestamp in UTC. The time portion must be zeroed out (e.g., 2026-01-02T00:00:00Z). Must not be later than midnight UTC of the next day.
          title: End Time
        description: RFC 3339 timestamp in UTC. The time portion must be zeroed out (e.g., 2026-01-02T00:00:00Z). Must not be later than midnight UTC of the next day.
      - name: limit
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
            maximum: 35
            minimum: 1
          - type: 'null'
          description: A limit on the number of buckets to be returned. Limit can range between 1 and 35, and the default is 7.
          default: 7
          title: Limit
        description: A limit on the number of buckets to be returned. Limit can range between 1 and 35, and the default is 7.
      - name: page
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.
          title: Page
        description: A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.
      - name: group_by
        in: query
        required: false
        schema:
          anyOf:
          - $ref: '#/components/schemas/CostGroupBy'
          - type: 'null'
          description: Group the costs by the specified fields. Currently only `line_item` is supported.
          title: Group By
        description: Group the costs by the specified fields. Currently only `line_item` is supported.
      - name: X-Friendli-Team
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: ID of team to run requests as (optional parameter).
          title: X-Friendli-Team
        description: ID of team to run requests as (optional parameter).
      responses:
        '200':
          description: Team cost response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostResponse'
              example:
                data:
                - has_more: true
                  data:
                  - start_time: '2023-11-07T05:31:56Z'
                    end_time: '2023-11-07T05:31:56Z'
                    results:
                    - total: 2.709083
                      quantity: 0.934167
                      unit_price: 290
                      line_item: h100, gpu_time
        '429':
          description: Rate limit exceeded
        '422':
          description: Unprocessable Entity
      x-speakeasy-name-override: getCost
      x-mint:
        metadata:
          title: Cost
          sidebarTitle: Cost
          og:title: Cost
          description: Get cost details for the team.
          og:description: Get cost details for the team.
        href: /openapi/administration/cost
        content: 'Get cost details for the team.


          If `X-Friendli-Team` is omitted, this endpoint uses the default team configured in Friendli Suite.


          There may be a slight delay between usage and when it shows up in cost. If you need to call this endpoint repeatedly, wait at least 5 minutes between calls.


          To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp_XXX) value in the **Bearer Token** field.

          Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.'
components:
  schemas:
    CostGroupBy:
      type: string
      enum:
      - line_item
      title: CostGroupBy
    CostBucketWidth:
      type: string
      enum:
      - 1d
      title: CostBucketWidth
    CostBucket:
      properties:
        start_time:
          type: string
          format: date-time
          title: Start Time
        end_time:
          type: string
          format: date-time
          title: End Time
        results:
          items:
            $ref: '#/components/schemas/CostResult'
          type: array
          title: Results
      type: object
      required:
      - start_time
      - end_time
      - results
      title: CostBucket
    CostResult:
      properties:
        total:
          type: number
          title: Total
          description: The numeric value of the cost. In USD.
          examples:
          - 2.709083
        quantity:
          anyOf:
          - type: number
          - type: 'null'
          title: Quantity
          description: When `group_by=line_item`, this field provides quantity of the line item.
          examples:
          - 0.934167
        unit_price:
          anyOf:
          - type: number
          - type: 'null'
          title: Unit Price
          description: When `group_by=line_item`, this field provides unit price of the line item in USD Cents.
          examples:
          - 290.0
        line_item:
          anyOf:
          - type: string
          - type: 'null'
          title: Line Item
          description: When `group_by=line_item`, this field provides line item name of the grouped costs result.
          examples:
          - h100, gpu_time
          - zai-org/GLM-5.1, output_tokens
      type: object
      required:
      - total
      title: CostResult
    CostResponse:
      properties:
        has_more:
          type: boolean
          title: Has More
        next_page:
          anyOf:
          - type: string
          - type: 'null'
          title: Next Page
        data:
          items:
            $ref: '#/components/schemas/CostBucket'
          type: array
          title: Data
      type: object
      required:
      - has_more
      - data
      title: CostResponse
  securitySchemes:
    token:
      type: http
      description: 'When using Friendli Suite API for inference requests, you need to provide a **Friendli Token** for authentication and authorization purposes.


        For more detailed information, please refer [here](https://friendli.ai/docs/openapi/introduction#authentication).'
      scheme: bearer
x-speakeasy-retries:
  strategy: backoff
  backoff:
    initialInterval: 500
    maxInterval: 60000
    maxElapsedTime: 3600000
    exponent: 1.5
  statusCodes:
  - 429
  - 500
  - 502
  - 503
  - 504
  retryConnectionErrors: true