Skip to main content
The Tokonomics REST API lets you proxy LLM requests through a unified metering layer and query real-time spend analytics — all from a single base URL. Every proxied call is automatically metered, tagged, and counted against your configured monthly budget so you always know exactly what you’re spending.

Base URL

All API requests are made to:

Authentication

Authenticate every request by passing your Tokonomics API key as a Bearer token in the Authorization header. All keys are prefixed with mk_ followed by 48 hex characters.
Example:
Keep your API key secret. Do not commit it to source control or expose it in client-side code. If a key is compromised, rotate it immediately from your Tokonomics dashboard.

Rate Limits

Every API response includes the following rate-limit headers: When you exceed your rate limit, the API returns a 429 Too Many Requests response. The response also includes a Retry-After header indicating how many seconds to wait before retrying.

Error Responses

All errors return a JSON body with error and message fields:
A 429 response can indicate either a rate limit or that your account has reached its monthly budget cap. Check the message field to distinguish between the two cases.

Endpoints Summary

UsageEvent Schema

Every metered LLM call produces a UsageEvent record. You’ll encounter this object in the /analytics/events endpoint response.
string
Unique UUID identifier for the event. Example: "3f6a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c"
string
The model name as reported by the provider. Example: "gpt-4o"
string
The provider slug. Example: "openai"
integer
Number of input (prompt) tokens consumed by the request.
integer
Number of output (completion) tokens generated by the model.
integer
Number of tokens served from the provider’s prompt cache (read). Billed at a reduced rate where supported.
integer
Number of tokens written to the provider’s prompt cache. Billed at a premium where supported.
number
Total cost of the request in USD, calculated to 8 decimal places. Example: 0.00342100
integer
End-to-end request latency in milliseconds, from the time Tokonomics received your request to the time the provider response was fully received.
object
Key-value pairs of custom tags attached to the request via the X-Metering-Tags header. Values are always strings. Example: {"team": "growth", "feature": "summarizer"}
string
ISO 8601 datetime when the event was recorded. Example: "2026-06-10T14:32:01.000Z"