AI Metering
Meter an LLM completion
Record the details of an LLM completion
post/v2/ai/completions
Request body
Example request
{
"transactionId": "123e4567-e89b-12d3-a456-426614174000",
"traceId": "123e4567-e89b-12d3-a456-426614174000",
"model": "gpt4",
"responseQualityScore": 45,
"modelSource": "ANTHROPIC",
"inputTokenCount": 50,
"outputTokenCount": 150,
"reasoningTokenCount": 1300,
"cacheCreationTokenCount": 1300,
"cacheReadTokenCount": 1300,
"totalTokenCount": 200,
"stopReason": "END",
"inputTokenCost": 12.34,
"outputTokenCost": 12.34,
"totalCost": 12.34,
"costType": "AI",
"requestTime": "2025-03-02T15:04:05Z",
"completionStartTime": "2025-03-02T15:04:05Z",
"timeToFirstToken": 10200,
"responseTime": "2025-03-02T15:04:06Z",
"requestDuration": 1000,
"mediationLatency": 1000,
"provider": "OpenAI",
"taskType": "completion",
"subscriberCredentialName": "OpenAI Key (Production)",
"subscriberCredential": "asd-123",
"subscriberEmail": "user@example.com",
"subscriberId": "user-123",
"organizationId": "org-123",
"subscriptionId": "subscr-456",
"productId": "Free Trial",
"agent": "Bishop",
"operationType": "CHAT",
"systemFingerprint": "fp_44z789a1c23def456gh7890ijkl1234mnopq567rstuv8910wxyz",
"temperature": 0.78,
"errorReason": "key not allowed to access model"
}Response
AI completion successfully metered
Example response
{
"object": "metering",
"label": "Metering Response",
"created": "2025-03-02T15:04:05Z",
"updated": "2025-03-02T15:04:06Z",
"id": "abc123",
"signature": "signature123"
}