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

# Usage



## OpenAPI

````yaml https://api.deepinfra.com/openapi.json get /payment/usage
openapi: 3.1.0
info:
  title: DeepInfra API
  description: >-
    The DeepInfra API provides serverless AI inference, custom model
    deployments, and GPU rentals.
  version: 1.0.0
servers:
  - url: https://api.deepinfra.com
security: []
tags:
  - name: Chat Completions
    description: OpenAI and Anthropic-compatible chat completion endpoints for LLMs.
  - name: Text Completions
    description: OpenAI-compatible text completion endpoints.
  - name: Embeddings
    description: Generate text embeddings for search and RAG.
  - name: Image Generation
    description: Generate, edit, and create variations of images.
  - name: Audio
    description: OpenAI-compatible speech synthesis, transcription, and translation.
  - name: Text to Speech
    description: ElevenLabs-compatible TTS endpoints and voice management.
  - name: Inference
    description: Native DeepInfra inference API for models and deployments.
  - name: Dedicated Models
    description: Deploy and manage private model instances with autoscaling.
  - name: GPU Rentals
    description: Rent dedicated GPU containers.
  - name: Models
    description: Browse, search, and manage AI models.
  - name: Files & Batches
    description: File uploads and batch processing.
  - name: LoRA Adapters
    description: Create, manage, and query LoRA adapter models.
  - name: Agents
    description: Manage agent-framework instances (OpenClaw and friends).
  - name: Account
    description: User profile, team management, and rate limits.
  - name: Authentication
    description: API tokens, SSH keys, scoped JWTs, and login flows.
  - name: Billing
    description: Payment methods, usage tracking, and billing.
  - name: Logs & Metrics
    description: Query inference logs, deployment logs, and usage metrics.
  - name: Utilities
    description: Feedback submission and CLI version.
paths:
  /payment/usage:
    get:
      tags:
        - Billing
      summary: Usage
      operationId: usage_payment_usage_get
      parameters:
        - name: from
          in: query
          required: true
          schema:
            type: string
            description: >-
              start of period in YYYY.MM, current(-N), unix_timestamp (in
              seconds, UTC) format
            title: From
          description: >-
            start of period in YYYY.MM, current(-N), unix_timestamp (in seconds,
            UTC) format
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              end of period (if missing a single month marked by from is
              return), same format as from
            title: To
          description: >-
            end of period (if missing a single month marked by from is return),
            same format as from
        - name: session
          in: cookie
          schema:
            type: String
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    UsageOut:
      properties:
        months:
          items:
            $ref: '#/components/schemas/UsageMonth'
          type: array
          title: Months
        initial_month:
          type: string
          title: Initial Month
          description: The first month for this account
      type: object
      required:
        - months
        - initial_month
      title: UsageOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UsageMonth:
      properties:
        period:
          type: string
          title: Period
          description: YYYY.MM formatted period
        interval:
          $ref: '#/components/schemas/TimeInterval'
          description: time interval in this period
        items:
          items:
            $ref: '#/components/schemas/UsageItem'
          type: array
          title: Items
        total_cost:
          type: integer
          title: Total Cost
          description: total cost for all items in cents
        invoice_id:
          type: string
          title: Invoice Id
          description: Stripe Invoice ID, or EMPTY|NOT_FINAL
          default: NOT_FINAL
      type: object
      required:
        - period
        - interval
        - items
        - total_cost
      title: UsageMonth
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TimeInterval:
      properties:
        fr:
          type: integer
          title: Fr
          default: 0
        to:
          type: integer
          title: To
          default: 4000000000000
      type: object
      title: TimeInterval
      description: Inclusive, in ms
    UsageItem:
      properties:
        model:
          $ref: '#/components/schemas/ModelMeta'
        units:
          type: integer
          title: Units
          description: billed seconds or tokens
        rate:
          type: number
          title: Rate
          description: rate in cents/sec or cents per token
        cost:
          type: integer
          title: Cost
          description: model cost in cents
        pricing_type:
          type: string
          title: Pricing Type
          description: pricing type
        interval:
          $ref: '#/components/schemas/TimeInterval'
          description: time interval with this particular pricing
        discount:
          anyOf:
            - $ref: '#/components/schemas/DiscountMeta'
            - type: 'null'
          description: discount meta, only if pricing_type is discount
      type: object
      required:
        - model
        - units
        - rate
        - cost
        - pricing_type
        - interval
      title: UsageItem
    ModelMeta:
      properties:
        provider:
          type: string
          title: Provider
        model_name:
          type: string
          title: Model Name
        task:
          type: string
          title: Task
        plan_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Plan Id
        private:
          type: boolean
          title: Private
          default: false
        contract:
          anyOf:
            - type: string
            - type: 'null'
          title: Contract
          description: bare-metal contract description, shown like on invoices
      type: object
      required:
        - provider
        - model_name
        - task
      title: ModelMeta
    DiscountMeta:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: description of the discount, only for display purposes
      type: object
      required:
        - name
      title: DiscountMeta
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````