One ingest contract. Every server runtime.
On this page
Public endpoints
The hosted base URL is https://traket.ai. Send usage only from trusted server code.
/api/v1/usage/events/api/v1/usage/catalogAuthenticate writes
Send the project-scoped SDK write key as a bearer token. The Catalog endpoint is public and requires no authorization.
Authorization: Bearer traket_live_...
Content-Type: application/jsonOne project per key
Plaintext shown once
POST usage events
Submit a JSON object with one events array. The endpoint processes every item independently after request-level authentication and limit checks.
curl --request POST \
https://traket.ai/api/v1/usage/events \
--header "Authorization: Bearer traket_live_..." \
--header "Content-Type: application/json" \
--data '{
"events": [
{
"provider": "openai",
"externalCustomerId": "cus_123",
"environment": "production",
"feature": "support_reply",
"operation": "responses.create",
"model": "gpt-5.4-mini",
"idempotencyKey": "response_01J...",
"usage": {
"input_tokens": 1280,
"input_tokens_details": { "cached_tokens": 640 },
"output_tokens": 220,
"output_tokens_details": { "reasoning_tokens": 80 },
"total_tokens": 1500
}
}
]
}'results entry.Event object
The documented wire contract uses the fields below. Unknown top-level fields are ignored except legacy customerId, which is explicitly rejected. Traket accepts usage and attribution metadata only, never prompt or model-output content.
provideropenai, azure_openai, anthropic, aws_bedrock, google_vertex, mistral, openrouter, other. Normalized to a lowercase underscore slug before validation.externalCustomerIdcus_....attributionQualitynone, model, user, or customer. Defaults to customer.costdurationMsenvironmentfeaturegranularityrequest, hour, or day. Defaults to request.idempotencyKeymetadatamodeloccurredAtoperationproviderRequestIdproviderResponseIdstatussuccess, error, cancelled, or timeout. Defaults to success.traceIdunitsusageCost, units, and OpenAI usage
Cost object
Send cost when your provider or gateway already knows the charge. A valid explicit amount wins over a catalog estimate.
amountcurrencyusd by default; normalized to lowercase and stored up to 8 characters.sourceestimated_catalog, csv_import, or manual_override; defaults to manual_override.priceVersionmetadataUnits array
Every event receives one request unit automatically. Use the optional array for additional billable quantities.
quantityunitNameunknown.unitTyperequest, token, image, audio_second, embedding_token, or tool_call.billableQuantityproviderRawKeymetadataOpenAI-style usage
OpenAI and Azure OpenAI events normalize these fields into token units. Known catalog models can receive a local USD estimate when no explicit cost is supplied.
input_tokensinput_tokens_details.cached_tokensoutput_tokensoutput_tokens_details.reasoning_tokenstotal_tokensunits must be an array of unit records; usage is the OpenAI-style token object.Resolve the paying customer
externalCustomerId is required and must be a Stripe customer ID beginning with cus_. Before live metering, import or connect Stripe so that identity resolves to exactly one customer in the write key's project.
No match
Ambiguous match
Responses and errors
A response envelope reports new inserts in accepted, event failures in rejected, and the outcome of every submitted index in results. Duplicate events appear only in results.
{
"accepted": 1,
"rejected": 1,
"results": [
{
"eventId": "b06c67d5-...",
"index": 0,
"status": "inserted"
},
{
"eventId": "90ef2161-...",
"index": 1,
"status": "duplicate"
},
{
"error": "Stripe customer cus_missing is not imported into this project.",
"index": 2,
"status": "rejected"
}
]
}insertedduplicaterejected200400401413422429503503 response can be a small top-level { "error": "..." } object or the normal result envelope when every event was rejected and at least one rejection was a persistence failure. Treat both forms as retryable.Limits, quotas, and retries
Events per requestRequest bodySerialized eventAuthenticated project abuse ceilings use fixed one-minute buckets. Submitted requests and event counts consume the bucket before per-event validation, so rejected rows still count.
FreeProEnterpriseA separate in-process client-address ceiling allows 20,000 requests per minute. It dampens obvious unauthenticated floods before project-level quota enforcement.
- On
429, wait for the integer seconds inRetry-After. - Authenticated quota responses also include
X-Traket-Ingest-Limit-Class. - Retry network failures, timeouts,
408,429, and5xxwith bounded exponential jitter. - Preserve each event's idempotency key across every retry.
When idempotencyKey is omitted, SDKs assign one before delivery and the raw API derives a stable payload hash. Supplying a provider request or response ID is safer when the same logical event might be reconstructed differently.
GET provider catalog
The public Catalog endpoint returns the accepted provider IDs and the base OpenAI-family models that have local pricing. It is a pricing catalog, not a model allowlist.
GET https://traket.ai/api/v1/usage/catalog{
"modelCatalogVersion": "openai-text-2026-07-19",
"providers": [
{
"id": "openai",
"label": "OpenAI",
"modelPolicy": "catalog",
"notes": "Listed base models and their date-suffixed snapshots are priced locally; other unknown IDs are stored without an estimate.",
"models": [
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4.1-nano"
]
},
{
"id": "azure_openai",
"label": "Azure OpenAI",
"modelPolicy": "catalog",
"notes": "Send the underlying OpenAI model, not only an Azure deployment name; listed bases and date-suffixed snapshots use local pricing.",
"models": [
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4.1-nano"
]
}
]
}Current model catalog version: openai-text-2026-07-19.
openaiazure_openaianthropicaws_bedrockgoogle_vertexmistralopenrouterotherLocally priced OpenAI-family models in this build:
gpt-4.1gpt-4.1-minigpt-4.1-nanogpt-4ogpt-4o-minigpt-5gpt-5-minigpt-5-nanogpt-5.1gpt-5.2gpt-5.3-codexgpt-5.4gpt-5.4-minigpt-5.4-nanogpt-5.4-progpt-5.5gpt-5.5-progpt-5.6gpt-5.6-lunagpt-5.6-solgpt-5.6-terrao1o1-minio1-proo3o3-minio3-proo4-miniYYYY-MM-DD snapshot variant use the same local price. Other unknown OpenAI and Azure OpenAI IDs are accepted and stored without an estimated cost.Prompts are never collected
Traket never collects or stores prompts, messages, model outputs, or full provider request and response bodies. There is no prompt-capture mode. Only usage counts, costs, operational identifiers, and customer attribution are sent to Traket.
- Never send prompts, messages, model output, files, images, tool arguments, full provider responses, or provider headers.
- Never send API keys, authorization values, passwords, secrets, or tokens.
- Metadata is limited to 24 scalar entries. Keys are trimmed to 64 characters and string values to 512 characters.
- A direct API event is rejected when a metadata key resembles private content or credentials.
