Skip to main content
The proxy endpoint forwards your LLM requests to the upstream provider while transparently metering token usage and cost. You send the exact same request body you would send directly to the provider — Tokonomics intercepts it, records the usage event, and streams the provider’s response back to you with no added latency beyond the metering overhead. Endpoint

Path Parameters

string
required
The LLM provider slug identifying which upstream API to route the request to. Must be one of:
string
required
The upstream API path to forward the request to. This is the provider-native path — for example, chat/completions for OpenAI or messages for Anthropic.Examples:
  • OpenAI: chat/completions
  • Anthropic: messages
  • Gemini: models/gemini-2.0-flash:generateContent

Request Headers

string
required
Your Tokonomics API key in Bearer token format.
string
required
Must be application/json.
string
A JSON-encoded object of custom key-value tags to attach to the usage event. Use this to attribute spend to teams, features, or any other dimension you want to query in analytics.
string
Shorthand for tagging a single feature name. Sets the feature tag on the usage event. Equivalent to passing {"feature": "your-feature"} in X-Metering-Tags.
string
A customer tenant identifier to attach to the usage event. Sets the tenant_id tag, enabling per-tenant spend breakdowns in analytics.

Request Body

Pass the provider’s native request body unchanged as a JSON object. Tokonomics forwards your request body to the upstream provider without modification.
You do not need to include your upstream provider API key in the request body. Tokonomics injects it server-side using the credentials you configured in your dashboard.
Example — OpenAI chat completion:

Response

Tokonomics streams the provider’s response directly back to you. The response body and status code are the provider’s native response — no transformation is applied. The following additional headers are injected by Tokonomics:

Error Responses

401 response body:
When a 429 is returned due to budget cap, your requests will be blocked until the budget resets at the start of the next calendar month or you increase your budget in the dashboard.

Full Example