Skip to main content
POST
Send AI usage transactions for cost tracking.

Request Formats

Single Transaction

Bulk Request

Context

Only billable_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

Examples

Basic Request

Response:

Error Responses

Validation Error (400)

Unauthorized (401)

Partial Success (207)

See Also

Authorizations

X-Api-Key
string
header
required

API key for authentication. Must be associated with an active organization.

Body

application/json

Either a single transaction or a bulk request containing multiple transactions

provider
enum<string>
required

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.

Available options:
openai,
gemini,
bedrock,
anthropic,
xai,
deepseek,
custom
model
string
required

The model identifier (e.g., 'gpt-4o', 'claude-3-opus', 'gemini-pro')

Minimum string length: 1
Examples:

"gpt-4o"

"claude-3-opus"

"gemini-1.5-pro"

usage
(Tokens · object | Images · object | Audio · object | Video · object | Requests · object | Custom · object)[]
required

Array of usage entries. Each usage type may appear at most once per transaction.

Minimum array length: 1
context
object
required

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.

model_tier
string

Optional model tier classification for custom pricing tiers

provider_usage_raw
object

Optional raw usage data from the provider for debugging or auditing

Response

All transactions queued successfully

status
string
required

Status indicating all transactions were queued

Allowed value: "queued"
events_queued
integer
required

Number of transactions successfully queued

Required range: x >= 1
message
string
required

Human-readable success message

results
object[]
required