Skip to main content
The Fenra API lets you send AI usage data for cost tracking and analytics.

Base URL

Authentication

All requests require an API key in the X-Api-Key header:
Get your API key from app.fenra.io under Settings → API Keys.

Authentication Guide

How to get and use API keys.

Quick Example

Response:

Transaction Schema

Context

Only billable_customer_id is required. Add any additional context fields you need. They will appear in your dashboard and can be used for filtering, alerts, and reports.
See the Transactions Guide for examples of useful context fields.

Usage

The usage field describes what resources an AI call consumed. Different AI operations consume different resources:
  • Text generation (GPT, Claude, etc.) consumes tokens
  • Image generation (DALL-E, etc.) consumes images
  • Speech-to-text/TTS (Whisper, etc.) consumes audio seconds
The usage field is an array because some AI calls consume multiple resource types. For example, a GPT-4 Vision request might consume both tokens (for text) and process images. Structure of a usage entry:
Each entry has:
  • type: The resource type (see table below)
  • metrics: The measurements for that resource

Usage Types

Example: Text Generation (Most Common)

Example: Multimodal (Multiple Resource Types)

A request that generates both text and images:
Each usage type can only appear once per transaction. See the Transactions Guide for detailed information on each usage type and their optional metrics.

Response Codes

Error Reference

Complete list of error codes and how to handle them.

Endpoints

POST /usage/transactions

Send one or more AI usage transactions.