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

# Get daily costs

> Retrieve daily API costs and the range total for your developer project.



## OpenAPI

````yaml /openapi.yaml get /v2/billing/costs
openapi: 3.1.0
info:
  title: getimg.ai API
  version: 2.0.0
  description: |
    The getimg.ai API for image and video generation.

    Authenticate with a bearer token in the format `sk_<secret>`.
servers:
  - url: https://api.getimg.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: Endpoints for image generation.
  - name: Models
    description: Endpoints for listing available developer models.
  - name: Videos
    description: Endpoints for video generation.
  - name: Billing
    description: Developer API balance and usage costs.
paths:
  /v2/billing/costs:
    get:
      tags:
        - Billing
      summary: Get daily costs
      description: Retrieve daily API costs and the range total for your developer project.
      operationId: getCosts
      parameters:
        - name: start
          in: query
          required: true
          description: Inclusive ISO 8601 start timestamp. Must include a time zone.
          schema:
            type: string
            format: date-time
          example: '2026-09-01T00:00:00Z'
        - name: end
          in: query
          required: true
          description: >
            Inclusive ISO 8601 end timestamp. Must include a time zone, fall
            after `start`, and sit within 180 days of it.
          schema:
            type: string
            format: date-time
          example: '2026-09-05T00:00:00Z'
      responses:
        '200':
          description: >
            Daily costs across every API key in the project, bucketed by UTC
            calendar date in ascending order. Buckets cover zero-cost days and
            the end date, and the first and last bucket can each cover a partial
            day. Costs are reported in USD and can lag recent charges, so read
            them as usage telemetry rather than an authoritative billing ledger.
            Responses are sent with `Cache-Control: no-store`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - currency
                  - total_cost
                  - start
                  - end
                  - data
                properties:
                  currency:
                    type: string
                    enum:
                      - USD
                  data:
                    type: array
                    description: One bucket per UTC calendar date in the range.
                    items:
                      type: object
                      required:
                        - date
                        - cost
                      properties:
                        date:
                          type: string
                          format: date
                          description: UTC calendar date for the bucket.
                          example: '2026-09-01'
                        cost:
                          type: number
                          description: Cost for the bucket in USD.
                          example: 0.84
                  total_cost:
                    type: number
                    description: Total cost for the range in USD.
                    example: 3.45
                  start:
                    type: string
                    format: date-time
                    description: Start of the requested range.
                  end:
                    type: string
                    format: date-time
                    description: End of the requested range.
              examples:
                costs:
                  summary: Daily costs for a five-day range
                  value:
                    currency: USD
                    data:
                      - date: '2026-09-01'
                        cost: 0.84
                      - date: '2026-09-02'
                        cost: 1.26
                      - date: '2026-09-03'
                        cost: 0
                      - date: '2026-09-04'
                        cost: 0.42
                      - date: '2026-09-05'
                        cost: 0.93
                    total_cost: 3.45
                    start: '2026-09-01T00:00:00Z'
                    end: '2026-09-05T00:00:00Z'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/ServerError'
      x-codeSamples:
        - lang: javascript
          label: Node.js
          source: |
            import GetimgAI from "getimg-ai";

            const client = new GetimgAI();

            const costs = await client.billing.listCosts({
              start: "2026-09-01T00:00:00Z",
              end: "2026-09-05T00:00:00Z",
            });
        - lang: python
          label: Python
          source: |
            from getimg import GetimgAI

            client = GetimgAI()

            costs = client.billing.list_costs(
                start="2026-09-01T00:00:00Z",
                end="2026-09-05T00:00:00Z",
            )
components:
  responses:
    BadRequestError:
      description: The request payload or parameters are invalid.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            invalid_parameter:
              value:
                error:
                  message: Unsupported resolution '8K' for model 'seedream-5-lite'.
                  type: invalid_request_error
                  param: resolution
                  code: invalid_parameter
            parameter_missing:
              value:
                error:
                  message: Required parameter 'prompt' is missing.
                  type: invalid_request_error
                  param: prompt
                  code: parameter_missing
    UnauthorizedError:
      description: Authentication failed due to a missing or invalid API key.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            invalid_api_key:
              value:
                error:
                  message: >-
                    Incorrect API key provided. You can manage your API keys at
                    https://getimg.ai/app/developer/api-keys
                  type: invalid_request_error
                  param: null
                  code: invalid_api_key
                  doc_url: https://docs.getimg.ai/guides/authentication
    RateLimitError:
      description: A rate or concurrency limit was exceeded.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            rate_limited:
              value:
                error:
                  message: Too many requests hit the API too quickly.
                  type: invalid_request_error
                  param: null
                  code: rate_limit
    ServerError:
      description: An unexpected server error occurred.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PublicApiError'
          examples:
            server_error:
              value:
                error:
                  message: Something went wrong on our end.
                  type: invalid_request_error
                  param: null
                  code: server_error
  headers:
    X-RateLimit-Limit:
      description: Maximum requests allowed in the current rate-limit window.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '60'
    X-RateLimit-Remaining:
      description: Remaining requests in the current rate-limit window.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '59'
    X-RateLimit-Reset:
      description: Unix timestamp (seconds) when the current rate-limit window resets.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '1760000042'
    Retry-After:
      description: Number of seconds to wait before retrying.
      schema:
        type: string
        pattern: ^[0-9]+$
      example: '42'
  schemas:
    PublicApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - param
            - code
          properties:
            message:
              type: string
            type:
              type: string
              const: invalid_request_error
            param:
              anyOf:
                - type: string
                - type: 'null'
            code:
              type: string
              enum:
                - invalid_api_key
                - parameter_missing
                - invalid_parameter
                - quota_exceeded
                - rate_limit
                - content_policy_violation
                - not_found
                - server_error
            doc_url:
              type: string
              format: uri
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Send your API key as a bearer token:
        `Authorization: Bearer sk_<secret>`.

````