track_usage
Monitor and record token consumption for AI API calls from OpenAI and Anthropic models to track usage patterns and manage costs.
Instructions
Track token usage for an AI API call
Input Schema
Name | Required | Description | Default |
---|---|---|---|
input_tokens | Yes | Input tokens used | |
model | Yes | Model name | |
output_tokens | Yes | Output tokens used | |
provider | Yes | AI provider | |
user_id | No | Optional user ID |
Input Schema (JSON Schema)
{
"properties": {
"input_tokens": {
"description": "Input tokens used",
"type": "number"
},
"model": {
"description": "Model name",
"type": "string"
},
"output_tokens": {
"description": "Output tokens used",
"type": "number"
},
"provider": {
"description": "AI provider",
"enum": [
"openai",
"anthropic"
],
"type": "string"
},
"user_id": {
"description": "Optional user ID",
"type": "string"
}
},
"required": [
"provider",
"model",
"input_tokens",
"output_tokens"
],
"type": "object"
}