Skip to main content
GET
/
v1
/
tasks
/
{task_id}
/
llm_usage
Get Task LLM Usage
curl --request GET \
  --url https://api.xpander.ai/v1/tasks/{task_id}/llm_usage \
  --header 'x-api-key: <api-key>'
{
  "task_id": "e6cf93db-30c7-471b-a1a9-5051a2c9e4ba",
  "tokens": 3842,
  "input_tokens": 1520,
  "output_tokens": 2322,
  "actions": 4,
  "is_byok": false
}
Retrieve LLM token usage statistics for a specific task, including input/output token counts and the number of tool actions performed.

Path Parameters

task_id
string
required
Unique identifier of the task (UUID format)

Response

task_id
string
Unique identifier of the task
tokens
integer
Total number of LLM tokens consumed (input + output)
input_tokens
integer
Number of input (prompt) tokens consumed
output_tokens
integer
Number of output (completion) tokens generated
actions
integer
Number of tool actions performed during the task
is_byok
boolean
Whether the task used a Bring Your Own Key (BYOK) model configuration

Example Request

curl -X GET -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/llm_usage"

Example Response

{
  "task_id": "e6cf93db-30c7-471b-a1a9-5051a2c9e4ba",
  "tokens": 3842,
  "input_tokens": 1520,
  "output_tokens": 2322,
  "actions": 4,
  "is_byok": false
}

Use Cases

  • Track token consumption - Monitor LLM token usage for individual tasks
  • Cost analysis - Calculate per-task LLM costs based on input/output tokens
  • Usage auditing - Review resource consumption across tasks
  • BYOK tracking - Identify which tasks ran with your own API keys vs. platform-provided keys

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

task_id
string
required

Response

Successful Response

LLM token usage statistics for a specific task

task_id
string
required

Unique identifier of the task

tokens
integer
default:0

Total number of LLM tokens consumed (input + output)

input_tokens
integer
default:0

Number of input (prompt) tokens consumed

output_tokens
integer
default:0

Number of output (completion) tokens generated

actions
integer
default:0

Number of tool actions performed during the task

is_byok
boolean
default:false

Whether the task used a Bring Your Own Key (BYOK) model configuration