The image_costs
endpoint allows you to retrieve a breakdown of the costs associated with image generation tasks, including cloud compute costs, LLM token costs, image generation costs, and more. This endpoint supports pagination for navigating large sets of historical task data.
To retrieve image generation costs, send a GET
request to the following URL:
GET https://api.genaifactory.ai/v1/image_costs
Ensure that your request includes the following header:
Name
Type
Required
Description
formacloud-api-key
string
Yes
API key required for authenticating your request.
You can use the following query parameters to specify pagination details for retrieving image cost history:
Name
Type
Required
Description
start
string
No
The start date of the history retrieval period in UTC (e.g., 2023-01-01T00:00:00Z
).
end
string
No
The end date of the history retrieval period in UTC (e.g., 2023-01-31T23:59:59Z
).
page_size
int
No
The maximum number of records to retrieve per page (default: 10).
page
int
No
The page number to retrieve (default: 1).
The response will include a list of image generation cost records, each containing the following details:
task_id
int
Yes
Unique identifier of the image generation task.
poster_count
int
No
The number of posters created in the task.
task_status
string
Yes
Status of the task (e.g., SUCCESS, FAILED).
creation_time
string
Yes
The time when the image generation task was created (in UTC).
end_time
string
No
The time when the image generation task was completed (in UTC), if applicable.
total_cost
float
Yes
The total cost of the task.
error_msg
string
No
Error message associated with the task, if it failed.
Example Request
Example Response
Success Response (Status Code 200):
Failure Response (Status Code 4XX):