POST /usage/transactions
Ingest AI usage transactions for cost tracking. Costs are calculated automatically based on the provider’s pricing. Supports both single transaction and bulk submissions. Use this endpoint after each AI provider call to track cost.
Send AI usage transactions for cost tracking.Documentation Index
Fetch the complete documentation index at: https://docs.fenra.io/llms.txt
Use this file to discover all available pages before exploring further.
Request Formats
Single Transaction
Bulk Request
Context
Onlybillable_customer_id is required in the context object. You can add any additional fields. They will be stored and available for filtering in your dashboard.
Response Codes
| Code | Meaning |
|---|---|
202 Accepted | All transactions queued |
207 Multi-Status | Some succeeded, some failed |
400 Bad Request | Validation error |
401 Unauthorized | Invalid API key |
500 Internal Error | Server error |
Examples
Basic Request
Error Responses
Validation Error (400)
Unauthorized (401)
Partial Success (207)
See Also
Authorizations
API key for authentication. Must be associated with an active organization.
Body
- Single Transaction
- Bulk Request
Either a single transaction or a bulk request containing multiple transactions
AI provider. Fenra automatically applies the correct pricing for each provider. Use 'custom' for providers not yet supported, combined with custom pricing configuration in your dashboard.
openai, gemini, bedrock, anthropic, xai, deepseek, custom The model identifier (e.g., 'gpt-4o', 'claude-3-opus', 'gemini-pro')
1"gpt-4o"
"claude-3-opus"
"gemini-1.5-pro"
Array of usage entries. Each usage type may appear at most once per transaction.
1- Tokens
- Images
- Audio
- Video
- Requests
- Custom
Only billable_customer_id is required. Add any additional fields (environment, feature, user_id, team, etc.) and they will appear in your dashboard for filtering, alerts, and reports.
Optional model tier classification for custom pricing tiers
Optional raw usage data from the provider for debugging or auditing
Response
All transactions queued successfully