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

# Consumo de créditos

> Retorna o consumo de créditos por agente dentro de um período



## OpenAPI

````yaml GET /v2/agent/{agentId}/credits-spent
openapi: 3.0.1
info:
  title: OpenAPI GPT Maker
  description: Documentação completa da API do GPT Maker
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.gptmaker.ai
security:
  - bearerAuth: []
paths:
  /v2/agent/{agentId}/credits-spent:
    get:
      description: Retorna o consumo de créditos por agente dentro de um período
      parameters:
        - name: agentId
          in: path
          description: ID do agente
          required: true
          schema:
            type: string
        - name: year
          in: query
          description: Ano para filtrar
          schema:
            type: integer
            format: int32
        - name: month
          in: query
          description: Mês para filtrar
          schema:
            type: integer
            format: int32
        - name: day
          in: query
          description: Dia para filtrar
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: Consumo de créditos por agente
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: integer
                    format: int32
                    description: Total de créditos gastos
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        credits:
                          type: integer
                          description: Quantidade de créditos gastos
                        year:
                          type: integer
                          description: Ano
                        month:
                          type: integer
                          description: Mês
                        day:
                          type: integer
                          description: Dia
                        model:
                          type: string
                          description: Modelo de IA que consumiu os créditos
        '400':
          description: Erro inesperado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Erro de token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
components:
  schemas:
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    Error403:
      required:
        - error
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````