Retrieve Image Metrics

The image_metrics endpoint allows you to query the performance, costs, and other metrics related to the creation of images within a specified period. This information can help you evaluate the effectiveness and resource usage of the image creation process over time.

API Endpoint

To retrieve the metrics, send a GET request to the following URL:

GET https://api.genaifactory.ai/v1/image_metrics

Headers

Ensure that your request includes the following header:

Name

Type

Required

Description

formacloud-api-key

string

Yes

API key required for authenticating your request.

Query Parameters

You can use the following query parameters to specify the time period for which you want to retrieve metrics:

Name

Type

Required

Description

start

string

No

The start date of the metrics collection period in UTC (e.g., 2023-01-01T00:00:00Z).

end

string

No

The end date of the metrics collection period in UTC (e.g., 2023-01-31T23:59:59Z).

Response Body

The response will include the following metrics related to image creation within the specified period:

Name

Type

Required

Description

total_images

int

Yes

The total number of images created within the specified period.

total_cost

number

Yes

The total cost associated with creating the images within the specified period.

average_time

number

Yes

The average time taken to create each image within the specified period, in seconds.

Example Request

curl -G 'https://api.genaifactory.ai/v1/image_metrics' \
-H 'formacloud-api-key: abc123' \
--data-urlencode "start=2023-01-01T04:16:39Z&end=2023-01-31T12:25:47Z"

Example Response

Success Response (Status Code 200)

{
    "total_images": 45,
    "total_cost": 12.50,
    "average_time": 3.5
}

Failure Response (Status Code 4XX)

{
    "error": "Invalid date range",
}

Last updated