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

# Export billed usage as per-customer invoices

> GoModel API reference for GET /admin/usage/invoice: Export billed usage as per-customer invoices.



## OpenAPI

````yaml /openapi.json get /admin/usage/invoice
openapi: 3.0.0
info:
  description: >-
    AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic,
    Gemini, Groq, Fireworks AI, Meta, OpenRouter, Kilo AI, DeepSeek, Z.ai, xAI,
    MiniMax, Xiaomi MiMo, OpenCode Go, Oracle, Ollama, Bailian). Drop-in
    OpenAI-compatible API.
  title: GoModel API
  contact: {}
  version: '1.0'
servers:
  - url: '{base_url}'
    description: Edit the base URL to point at your GoModel deployment.
    variables:
      base_url:
        default: http://localhost:8080
        description: Your GoModel deployment URL
security: []
paths:
  /admin/usage/invoice:
    get:
      tags:
        - admin
      summary: Export billed usage as per-customer invoices
      description: >-
        Returns billed usage for the period, one block of model/provider line
        items per customer user path, with subtotals and a grand total. Amounts
        are USD. With parent, each direct child of that user path is one
        customer (usage on the parent itself stays under the parent); without it
        every user path is its own customer. Requests, tokens and provider cost
        cover provider-served requests; billed cost also includes billed
        response-cache hits. CSV rows carry row_type item, subtotal or total.
        Requires a GoModel Pro license with the billing entitlement and
        pricing.markups_enabled.
      parameters:
        - description: 'Export format: csv (default, as an attachment) or json'
          name: format
          in: query
          schema:
            type: string
        - description: >-
            Bill each direct child of this user path as one customer, e.g.
            /customers
          name: parent
          in: query
          schema:
            type: string
        - description: Number of days (default 30)
          name: days
          in: query
          schema:
            type: integer
        - description: Start date (YYYY-MM-DD)
          name: start_date
          in: query
          schema:
            type: string
        - description: End date (YYYY-MM-DD)
          name: end_date
          in: query
          schema:
            type: string
        - description: Filter by exact model names; repeat or comma-separate for several
          name: model
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
        - description: >-
            Filter by provider names or types; repeat or comma-separate for
            several
          name: provider
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
        - description: Filter by request labels (exact match); repeat for several
          name: label
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
        - description: >-
            Filter by exact request endpoints, e.g.
            /v1/chat/completions,/v1/messages; repeat or comma-separate for
            several
          name: endpoint
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
        - description: >-
            Filter by comma-separated operations, e.g.
            chat_completions,embeddings
          name: operation
          in: query
          schema:
            type: string
        - description: Filter by exact detected session ID
          name: session_id
          in: query
          schema:
            type: string
        - description: Filter by managed auth key IDs; repeat or comma-separate for several
          name: auth_key_id
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
        - description: Filter by tracked user path subtrees; repeat for several
          name: user_path
          in: query
          explode: true
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            text/csv:
              schema:
                type: string
            application/json:
              schema:
                $ref: '#/components/schemas/usage.Invoice'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.GatewayError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.GatewayError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.GatewayError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.GatewayError'
      security:
        - BearerAuth: []
components:
  schemas:
    usage.Invoice:
      type: object
      properties:
        currency:
          type: string
        customers:
          type: array
          items:
            $ref: '#/components/schemas/usage.InvoiceCustomer'
        end_date:
          type: string
        parent:
          type: string
        start_date:
          type: string
        total:
          $ref: '#/components/schemas/usage.InvoiceAmounts'
    core.GatewayError:
      type: object
      properties:
        code:
          type: string
          nullable: true
        message:
          type: string
        param:
          type: string
          nullable: true
        provider:
          type: string
        status_code:
          type: integer
        type:
          $ref: '#/components/schemas/core.ErrorType'
    usage.InvoiceCustomer:
      type: object
      properties:
        customer:
          type: string
        lines:
          type: array
          items:
            $ref: '#/components/schemas/usage.InvoiceLine'
        subtotal:
          $ref: '#/components/schemas/usage.InvoiceAmounts'
    usage.InvoiceAmounts:
      type: object
      properties:
        billed_cost:
          type: number
          nullable: true
        effective_markup_percent:
          type: number
          nullable: true
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        provider_cost:
          type: number
          nullable: true
        requests:
          type: integer
    core.ErrorType:
      type: string
      enum:
        - provider_error
        - rate_limit_error
        - invalid_request_error
        - authentication_error
        - not_found_error
        - permission_error
        - internal_error
      x-enum-varnames:
        - ErrorTypeProvider
        - ErrorTypeRateLimit
        - ErrorTypeInvalidRequest
        - ErrorTypeAuthentication
        - ErrorTypeNotFound
        - ErrorTypePermission
        - ErrorTypeInternal
    usage.InvoiceLine:
      type: object
      properties:
        billed_cost:
          type: number
          nullable: true
        effective_markup_percent:
          type: number
          nullable: true
        input_tokens:
          type: integer
        model:
          type: string
        output_tokens:
          type: integer
        provider:
          type: string
        provider_cost:
          type: number
          nullable: true
        requests:
          type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.