Fetch Token Report

GA
GET

Retrieve detailed token usage statistics for a specific task.

This endpoint provides comprehensive token consumption data, including:

  • Total tokens used across all task runs
  • Token usage breakdown by time period
  • Average tokens per request
  • Usage patterns and trends

Parameters:

  • start_date: Filter data from this date onward (supports both absolute dates and relative times)
  • end_date: Filter data up to this date (supports both absolute dates and relative times)

Date Format Options:

  1. Absolute dates: ‘YYYY-MM-DD’ (e.g., ‘2024-01-15’)
  2. Relative times:
    • ‘now’, ‘today’, ‘yesterday'
    • 'X hours/days/weeks ago’ (e.g., ‘24 hours ago’, ‘7 days ago’)
    • ‘last week’, ‘last month’

Common Use Cases:

  1. Monitoring token consumption trends
  2. Cost analysis and budgeting
  3. Usage pattern analysis
  4. Resource allocation planning

Path parameters

org_idstringRequired

The unique identifier of the organization.

project_idstringRequired

The unique identifier of the project.

task_idstringRequired

The specific Task to reference.

Query parameters

start_datestringOptional

Start date for the report (e.g., ‘2023-06-01’, ‘24 hours ago’, ‘yesterday’).

end_datestringOptional

End date for the report (e.g., ‘2023-06-30’, ‘now’, ‘today’).

Response

Successfully retrieved token usage report

task_idstringformat: "uuid"

Unique identifier of the task

date_rangemap from strings to optional strings

Time period covered by the report, with start and end timestamps

total_input_tokensinteger>=0

Total number of input tokens consumed across all revisions and runs

total_output_tokensinteger>=0

Total number of output tokens generated across all revisions and runs

total_tokensinteger>=0

Combined total of input and output tokens across all revisions

total_task_runsinteger>=0

Total number of task executions across all revisions

task_revisionslist of objects

Token usage breakdown by task revision, showing detailed statistics for each active revision

Errors

Built with