openapi: 3.0.0 info: title: Usage API version: 1.1.0 description: API for retrieving usage information and costs paths: /v1/usage/total-cost: get: summary: Get total cost for a given period tags: - Usage security: - ApiKeyAuth: [] parameters: - in: query name: start_date schema: type: string format: date required: true - in: query name: end_date schema: type: string format: date required: true responses: '200': description: Total cost retrieved successfully content: application/json: schema: $ref: '#/components/schemas/TotalCostResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /v1/usage/records: get: summary: Get a list of usage records for a given period tags: - Usage security: - ApiKeyAuth: [] parameters: - in: query name: start_date schema: type: string format: date required: true - in: query name: end_date schema: type: string format: date required: true - $ref: '#/components/parameters/PageParam' - $ref: '#/components/parameters/ItemsPerPageParam' responses: '200': description: Usage records retrieved successfully content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/UsageRecordResponse' pagination: $ref: '#/components/schemas/Pagination' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' components: schemas: TotalCostResponse: type: object properties: start_date: type: string format: date end_date: type: string format: date total_cost: type: number format: float UsageRecordResponse: type: object properties: id: type: string format: uuid created_at: type: string format: date-time service_name: type: string enum: [ FINE_TUNING_JOB ] usage_amount: type: number format: float usage_unit: type: string enum: [ TOKEN ] cost: type: number format: float fine_tuning_job_name: type: string Pagination: type: object properties: total_pages: type: integer current_page: type: integer items_per_page: type: integer ErrorResponse: type: object properties: status: type: integer message: type: string responses: BadRequest: description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Unauthorized: description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' NotFound: description: Resource not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Forbidden: description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' parameters: PageParam: in: query name: page schema: type: integer default: 1 minimum: 1 description: Page number to retrieve ItemsPerPageParam: in: query name: items_per_page schema: type: integer default: 20 minimum: 1 description: Number of items to return per page securitySchemes: ApiKeyAuth: type: apiKey in: header name: x-api-key