Download OpenAPI specification:
Open-source AI monetization infrastructure
All API endpoints require authentication using Bearer token format:
Authorization: Bearer YOUR_API_KEY
Or using the X-API-Key header:
X-API-Key: YOUR_API_KEY
## How to get an API Key
You have two options to get started:
1. **Self-Hosted (Free & Private)**: Run the platform locally or on your own infrastructure. You are the admin and can generate keys for yourself.
2. **Sandbox (Quick Start)**: Use our hosted sandbox environment to try the API immediately without installation.
### Getting a Key (Sandbox)
1. Go to the [OpenMonetize Console](https://app.openmonetize.io).
2. Navigate to the **Sandbox** or **API Keys** section.
3. Generate a new API key.
4. Use this key in the "Authorize" button above.
## Rate Limiting
API requests are rate-limited to 100 requests per 1 minute per API key.
Register a new customer account
| name required | string [ 1 .. 255 ] characters |
| email required | string <email> ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z... |
| tier | string Default: "STARTER" Enum: "STARTER" "GROWTH" "ENTERPRISE" |
{- "name": "string",
- "email": "user@example.com",
- "tier": "STARTER"
}{- "data": {
- "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac",
- "apiKey": "string",
- "name": "string",
- "email": "string",
- "tier": "STARTER",
- "createdAt": "2019-08-24T14:15:22Z"
}
}Ingest a batch of usage events
required | Array of objects [ 1 .. 1000 ] items |
{- "events": [
- {
- "event_id": "a7a26ff2-e851-45b6-9634-d595f45458b7",
- "customer_id": "string",
- "user_id": "string",
- "team_id": "string",
- "event_type": "TOKEN_USAGE",
- "feature_id": "string",
- "provider": "OPENAI",
- "model": "string",
- "input_tokens": 9007199254740991,
- "output_tokens": 9007199254740991,
- "image_count": 0,
- "image_size": "string",
- "quality": "string",
- "unit_type": "string",
- "quantity": 0,
- "timestamp": "2019-08-24T14:15:22Z",
- "metadata": {
- "property1": null,
- "property2": null
}, - "idempotency_key": "string"
}
]
}{- "accepted": 0,
- "rejected": 0,
- "duplicates": 0,
- "batch_id": "string",
- "status": "string",
- "message": "string"
}Get credit balance for the authenticated customer
{- "data": {
- "balance": "string",
- "reservedBalance": "string",
- "availableBalance": "string",
- "currency": "string"
}
}Get credit balance for a specific user
| userId required | string non-empty |
{- "data": {
- "balance": 0,
- "reserved": 0,
- "available": 0,
- "expiresAt": "string"
}
}Purchase credits for a user (top-up)
| userId required | string non-empty |
| amount required | number > 0 |
| purchasePrice required | number > 0 |
| expiresAt | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
{- "userId": "string",
- "amount": 0,
- "purchasePrice": 0,
- "expiresAt": "2019-08-24T14:15:22Z"
}{- "data": {
- "transactionId": "string",
- "newBalance": 0
}
}Grant credits to a customer, user, or team (admin operation)
| userId | string non-empty |
| teamId | string non-empty |
| amount required | number >= 1 |
| reason | string |
object | |
| idempotencyKey | string |
| expiresAt | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
{- "userId": "string",
- "teamId": "string",
- "amount": 1,
- "reason": "string",
- "metadata": {
- "property1": null,
- "property2": null
}, - "idempotencyKey": "string",
- "expiresAt": "2019-08-24T14:15:22Z"
}{- "data": {
- "transactionId": "string",
- "walletId": "string",
- "newBalance": "string",
- "amount": "string"
}
}Get credit transaction history for a user
| userId required | string non-empty |
| limit | integer [ 1 .. 100 ] Default: 50 |
| offset | integer [ 0 .. 9007199254740991 ] Default: 0 |
{- "data": [
- {
- "id": "string",
- "transactionType": "string",
- "amount": 0,
- "balanceBefore": 0,
- "balanceAfter": 0,
- "description": "string",
- "createdAt": "string"
}
], - "pagination": {
- "limit": 0,
- "offset": 0,
- "total": 0
}
}Check if a user is entitled to perform an action (sub-10ms latency)
| userId required | string non-empty |
| featureId required | string |
required | object |
{- "userId": "string",
- "featureId": "string",
- "action": {
- "type": "token_usage",
- "provider": "string",
- "model": "string",
- "estimated_input_tokens": 0,
- "estimated_output_tokens": 0
}
}{- "allowed": true,
- "reason": "string",
- "estimatedCostCredits": 0,
- "estimatedCostUsd": 0,
- "currentBalance": 0,
- "actions": [
- {
- "type": "string",
- "label": "string",
- "url": "string"
}
]
}Create a new entitlement for a customer or user
| userId | string non-empty |
| featureId required | string |
| limitType required | string Enum: "HARD" "SOFT" "NONE" |
| limitValue | number or null |
| period | string or null Enum: "DAILY" "MONTHLY" "TOTAL" |
object |
{- "userId": "string",
- "featureId": "string",
- "limitType": "HARD",
- "limitValue": 0,
- "period": "DAILY",
- "metadata": {
- "property1": null,
- "property2": null
}
}{- "data": {
- "id": "string",
- "featureId": "string",
- "limitType": "string",
- "limitValue": 0
}
}List all entitlements for the authenticated customer
{- "data": [
- {
- "featureId": "string",
- "limitType": "string",
- "limitValue": 0,
- "period": "string",
- "metadata": null
}
]
}Update an existing entitlement
| id required | string <uuid> ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA... |
| limitType | string Enum: "HARD" "SOFT" "NONE" |
| limitValue | number or null |
| period | string or null Enum: "DAILY" "MONTHLY" "TOTAL" |
object |
{- "limitType": "HARD",
- "limitValue": 0,
- "period": "DAILY",
- "metadata": {
- "property1": null,
- "property2": null
}
}{- "data": {
- "id": "string",
- "featureId": "string",
- "limitType": "string",
- "limitValue": 0
}
}Get cost breakdown by provider/model
| startDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| endDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| groupBy | string Default: "day" Enum: "day" "week" "month" |
{- "data": [
- null
], - "totals": null,
- "period": null
}Get usage trends over time
| startDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| endDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| groupBy | string Default: "day" Enum: "day" "week" "month" |
{- "data": [
- null
], - "period": null
}Get usage analytics by feature for a customer
| customerId | string non-empty |
| startDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| endDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| groupBy | string Enum: "day" "week" "month" |
| provider | string |
| model | string |
| featureId | string |
{- "data": {
- "summary": {
- "totalEvents": 0,
- "totalInputTokens": "string",
- "totalOutputTokens": "string",
- "totalCreditsBurned": "string",
- "totalCostUsd": "string"
}, - "byFeature": [
- {
- "featureId": "string",
- "eventCount": 0,
- "creditsBurned": "string",
- "costUsd": "string"
}
], - "byProvider": [
- {
- "provider": "string",
- "model": "string",
- "eventCount": 0,
- "inputTokens": "string",
- "outputTokens": "string"
}
], - "byEventType": [
- {
- "eventType": "string",
- "eventCount": 0,
- "creditsBurned": "string",
- "costUsd": "string"
}
], - "timeline": [
- {
- "date": "string",
- "events": 0,
- "creditsBurned": "string"
}
]
}
}Get cost breakdown and margin analysis
| customerId | string non-empty |
| startDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| endDate | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
{- "data": {
- "summary": {
- "totalRevenue": "string",
- "totalProviderCost": "string",
- "totalMargin": "string",
- "marginPercent": 0
}, - "byProvider": [
- {
- "provider": "string",
- "model": "string",
- "providerCost": "string",
- "revenue": "string",
- "margin": "string"
}
]
}
}Get credit burn rate and consumption trends
| customerId | string non-empty |
| userId | string non-empty |
{- "data": {
- "currentBalance": "string",
- "last7Days": {
- "creditsBurned": "string",
- "averagePerDay": "string"
}, - "last30Days": {
- "creditsBurned": "string",
- "averagePerDay": "string"
}, - "projectedRunout": {
- "daysRemaining": 0,
- "estimatedRunoutDate": "string"
}, - "recommendations": [
- {
- "type": "string",
- "message": "string",
- "action": "string"
}
]
}
}Calculate cost for a single operation
| provider required | string Enum: "OPENAI" "ANTHROPIC" "GOOGLE" "COHERE" "MISTRAL" |
| model required | string non-empty |
| inputTokens required | integer [ 0 .. 9007199254740991 ] |
| outputTokens required | integer [ 0 .. 9007199254740991 ] |
{- "provider": "OPENAI",
- "model": "string",
- "inputTokens": 9007199254740991,
- "outputTokens": 9007199254740991
}{- "cost": 0,
- "currency": "string",
- "credits": 0
}Bulk cost calculation
required | Array of objects [ 1 .. 100 ] items |
{- "calculations": [
- {
- "provider": "OPENAI",
- "model": "string",
- "inputTokens": 9007199254740991,
- "outputTokens": 9007199254740991
}
]
}{- "customerId": "string",
- "results": [
- null
], - "total": 0
}Create a new burn table
| name required | string [ 1 .. 255 ] characters |
required | object |
| validFrom | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| validUntil | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
{- "name": "string",
- "rules": {
- "property1": {
- "inputTokens": 0,
- "outputTokens": 0,
- "perUnit": 1000
}, - "property2": {
- "inputTokens": 0,
- "outputTokens": 0,
- "perUnit": 1000
}
}, - "validFrom": "2019-08-24T14:15:22Z",
- "validUntil": "2019-08-24T14:15:22Z"
}{- "data": null
}Update a burn table
| id required | string <uuid> ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA... |
| name | string [ 1 .. 255 ] characters |
object | |
| isActive | boolean |
| validFrom | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
| validUntil | string <date-time> ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[... |
{- "name": "string",
- "rules": {
- "property1": {
- "inputTokens": 0,
- "outputTokens": 0,
- "perUnit": 1000
}, - "property2": {
- "inputTokens": 0,
- "outputTokens": 0,
- "perUnit": 1000
}
}, - "isActive": true,
- "validFrom": "2019-08-24T14:15:22Z",
- "validUntil": "2019-08-24T14:15:22Z"
}{- "data": null
}