Usage
Every request the environment's gateway served, as the usage log recorded it, and its analytics.
Records arrive shortly after the request ends. The analytics share one envelope: from and to; bucket and buckets when cut by time; group_by, the dimension of every group; series per bucket and group; groups per group over the range; omitted_groups, those left out; others, their per-bucket sum where figures add up; and total.
| Operation | Method | SDK |
|---|---|---|
| List usage | GET | hixel.usage.list |
| Get a usage series | GET | hixel.usage.series |
| Get usage totals | GET | hixel.usage.totals |
| Get usage performance | GET | hixel.usage.performance |
| Get usage errors | GET | hixel.usage.errors |
| Get usage failures | GET | hixel.usage.failures |
| Get guardrail activity | GET | hixel.usage.guardrails |
| Get key activity | GET | hixel.usage.keys |
| Get a usage record | GET | hixel.usage.get |
| List limit crossings | GET | hixel.limitCrossings.list |
| Summarize limit crossings | GET | hixel.limitCrossings.summary |
| List the customers with the most limit crossings | GET | hixel.limitCrossings.customers |
List usage#
A page of the requests the environment's gateway served, newest first. The filters combine, each exact; pass the same ones with each page's cursor.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
request_id | query | string | Only the request with this id, as x-hixel-request-id returned it (req_…): at most one record. |
from | query | string (date-time) | Only requests that started at or after this instant. |
to | query | string (date-time) | Only requests that started before this instant. |
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
Response 200: UsageRecordList
| Field | Type | Description |
|---|---|---|
data required | array of UsageRecord | |
data[].id required | string | The id of one recorded request (use_…); not its request id. |
data[].request_id required | string | The request's id, as x-hixel-request-id returned it (req_…). |
data[].organization_id required | string | The id of your organization (org_…). |
data[].project_id required | string | The id of a project (proj_…). |
data[].environment_id required | string | The id of an environment (env_…). |
data[].key_id required | string | The key the request was made with. |
data[].key_tags required | array of string | The key's tags when the request was made. |
data[].customer required | string | null | Your id for the customer the request named (x-hixel-customer); null for none. |
data[].member required | string | null | Your id for the member the request named (x-hixel-member); null for none. |
data[].provider required | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | string | The provider that answered; a value this list does not name yet may appear. |
data[].api_shape required | "openai_chat_completions" | "openai_responses" | "anthropic_messages" | string | null | The wire format of a chat request; null for an endpoint beside chat. |
data[].endpoint required | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | "audio_translations" | … | string | null | The endpoint beside chat the request was for; null for chat. |
data[].endpoint_usage required | object | null | Media tokens and units of an endpoint beside chat; null for chat. |
data[].endpoint_usage.media_tokens required | object | |
data[].endpoint_usage.units required | object | |
data[].requested_model required | string | The model the request named, an alias perhaps. |
data[].model required | string | The public model name that answered. |
data[].upstream_model required | string | The provider's own name of the model. |
data[].deployment_id required | string | The route of the model that answered. |
data[].payer required | "wallet" | "tenant" | "byok" | Who paid: the customer's wallet, your account with the platform (tenant), or the customer's own provider key (byok). |
data[].attempts required | integer | Upstream calls made, retries and fallbacks included. |
data[].stream required | boolean | Whether the response was streamed. |
data[].tokens required | object | |
data[].tokens.input required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].tokens.cache_read required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].tokens.cache_write_5m required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].tokens.cache_write_1h required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].tokens.output required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].tokens.reasoning required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
data[].usage_completeness required | "complete" | "partial" | "missing" | "truncated" | string | How much of the usage the provider reported: complete, or partial, missing or truncated, whose cost is an estimate. |
data[].cost_micros required | string | null | The provider's cost before markup, as charged: the settlement's amount when the gateway settled the request (which may be the reservation's estimate, above the cost of the usage seen), else the priced usage. null without a price. |
data[].billed_micros required | string | null | What the payer was charged, as cost_micros is; 0 for BYOK. |
data[].usage_cost_micros required | string | null | The cost of the usage the gateway saw, whatever was charged. |
data[].usage_billed_micros required | string | null | What the usage the gateway saw bills, whatever was charged. |
data[].upstream_status required | integer | The HTTP status the provider answered with. |
data[].outcome required | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | How the response body ended. |
data[].mocked required | boolean | Answered by the mock of a test environment: no provider was called. |
data[].cache required | "hit" | "miss" | null | hit or miss when the response cache applied; null when it did not. |
data[].guardrails required | object | |
data[].guardrails.flagged required | array of string | |
data[].guardrails.masked required | array of string | |
data[].guardrails.blocked required | string | null | The output rule that stopped the response. |
data[].tags required | array of string | The request's own tags (x-hixel-tags), in the order it gave them; empty when it sent none. They are metadata: they decided nothing about routing, the payer, limits or the price. |
data[].client_token_id required | string | null | The id of the client token the request came through; null for a request with a key. |
data[].session_id required | string | null | The realtime session the record belongs to (the request id of the session's handshake), shared by every response and input transcription of the session; null for any other. |
data[].settlement required | object | |
data[].settlement.status required | "untracked" | "settled" | "released" | "not_applied" | "failed" | How the request's charge to the balance ended: settled (charged), released (no provider response; nothing charged), not_applied, failed (the gateway's balance could not be reached; the ledger posts it), or untracked (no wallet paid and no limit applied). |
data[].settlement.basis required | "usage" | "estimate" | string | null | What was charged: the usage seen or the estimate, for settled and failed. |
data[].settlement.reason required | string | null | Why the object did not apply it, for not_applied. |
data[].started_at required | string (date-time) | When the request arrived at the gateway. |
data[].duration_ms required | integer | How long it took, in milliseconds. |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.usage.list()) {
console.log(item);
}Get a usage series#
Requests, tokens, cost and billed amounts by bucket, grouped by one dimension: the 25 largest groups in series, the rest summed in others.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from, or 7 days by hour. |
bucket | query | "day" | "hour" | How the range is cut: by UTC day (the default) or hour. |
group_by | query | "customer" | "member" | "model" | "key" | "tag" | "provider" | … | What each bucket is grouped by; none for one total per bucket. By tag, a request counts in each of its tags' groups. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: UsageSeries
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
bucket required | "day" | "hour" | How the range is cut: by UTC day or hour. |
buckets required | array of string | Every bucket of the range, oldest first, with requests or not. |
group_by required | "customer" | "member" | "model" | "key" | "tag" | "provider" | … | null | The dimension of group; null when the call gave none: one row per bucket. |
series required | array of object | By bucket, then group (null first): the 25 groups that billed the most over the range (then most requests, then by name). |
series[].bucket required | string (date-time) | The start of the UTC day or hour. |
series[].group required | string | null | The customer (your id), member, model, key id, tag, provider, payer or outcome; null for requests that named none, and always without group_by. |
series[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens required | object | |
series[].tokens.input required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens.cache_read required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens.cache_write_5m required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens.cache_write_1h required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens.output required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].tokens.reasoning required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].cost_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
series[].billed_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
others required | array of object | Per bucket, the sum of the omitted groups; empty when none were. By tag, a request in several tags may count both in series and here. |
others[].bucket required | string (date-time) | The start of the UTC day or hour. |
others[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens required | object | |
others[].tokens.input required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens.cache_read required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens.cache_write_5m required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens.cache_write_1h required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens.output required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].tokens.reasoning required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
others[].cost_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
others[].billed_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/series?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usageSeries = await hixel.usage.series({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get usage totals#
One range's totals, and its split by payer; call it again with the previous range to compare.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: UsageTotals
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
group_by required | "payer" | groups is by payer. |
groups required | array of object | By payer, always all three in the order wallet, tenant, byok. |
groups[].group required | "wallet" | "tenant" | "byok" | |
groups[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].cost_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
groups[].billed_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
total required | object | |
total.requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens required | object | |
total.tokens.input required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens.cache_read required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens.cache_write_5m required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens.cache_write_1h required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens.output required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.tokens.reasoning required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.cost_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
total.billed_micros required | string | An amount of micro-USD (millionths of a US dollar) as a decimal string: "1500000" is 1.50 USD. Never a JSON number. |
total.unpriced required | string | Requests without a price: they add no money. |
total.customers required | string | Distinct customers among requests that named one. |
total.members required | string | Distinct members among requests that named one, counted per customer. |
total.incomplete required | string | Requests whose body did not complete. |
total.upstream_errors required | string | Requests the provider answered with a status of 400 or above. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/totals?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usageTotals = await hixel.usage.totals({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get usage performance#
Latency percentiles (p50, p95, p99), retries, cache hits and streaming over the range: by bucket and group, per group, and in total.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from, or 7 days by hour. |
bucket | query | "day" | "hour" | How the range is cut: by UTC day (the default) or hour. |
group_by | query | "model" | "provider" | Group series and groups by model or provider; none for totals only. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: UsagePerformance
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
bucket required | "day" | "hour" | How the range is cut: by UTC day or hour. |
buckets required | array of string | Every bucket of the range, oldest first, with requests or not. |
group_by required | "model" | "provider" | null | The dimension of group; null when the call gave none. |
series required | array of object | By bucket, then group: the first 10 groups of groups (percentiles do not add up, so there is no others). |
series[].bucket required | string (date-time) | The start of the UTC day or hour. |
series[].group required | string | null | The model or provider; always null without group_by. |
series[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].mocked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].p50_ms required | integer | null | |
series[].p95_ms required | integer | null | |
series[].p99_ms required | integer | null | |
series[].retried required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].attempts required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].cache_hits required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].cache_misses required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].streamed required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups required | array of object | Per model or provider over the range, most requests first (then by name), at most 50; empty without group_by. |
groups[].group required | string | |
groups[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].mocked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].p50_ms required | integer | null | |
groups[].p95_ms required | integer | null | |
groups[].p99_ms required | integer | null | |
groups[].retried required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].attempts required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].cache_hits required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].cache_misses required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].streamed required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
total required | object | |
total.requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.mocked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.p50_ms required | integer | null | |
total.p95_ms required | integer | null | |
total.p99_ms required | integer | null | |
total.retried required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.attempts required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.cache_hits required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.cache_misses required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.streamed required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/performance?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usagePerformance = await hixel.usage.performance({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get usage errors#
How requests ended over the range, by bucket and outcome or upstream status class, and the requests guardrails blocked.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from, or 7 days by hour. |
bucket | query | "day" | "hour" | How the range is cut: by UTC day (the default) or hour. |
group_by required | query | "outcome" | "status_class" | Group by how the body ended (outcome) or the upstream status_class. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: UsageErrors
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
bucket required | "day" | "hour" | How the range is cut: by UTC day or hour. |
buckets required | array of string | Every bucket of the range, oldest first, with requests or not. |
group_by required | "outcome" | "status_class" | The dimension of group: how the body ended, or the upstream status class. |
series required | array of object | Every request by bucket and group, completed ones included. |
series[].bucket required | string (date-time) | The start of the UTC day or hour. |
series[].group required | string | The outcome (completed, aborted, …) or status class (2xx, 4xx, 5xx, other). |
series[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups required | array of object | Every group over the range, in the order of its values. |
groups[].group required | string | |
groups[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
total required | object | |
total.requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.guardrail_blocked required | string | Requests whose response a guardrail rule stopped. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/errors?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z&group_by=outcome" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usageErrors = await hixel.usage.errors({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
group_by: "outcome",
});Get usage failures#
The kinds of failed request over the range (provider, model, upstream status and outcome), most frequent first.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: UsageFailures
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
group_by required | "failure" | group is a kind of failure: its provider, model, upstream status and outcome. |
groups required | array of object | The kinds of failed request (not completed, or a status of 400 or above), most requests first, then latest first; at most 50. |
groups[].group required | object | |
groups[].group.provider required | string | |
groups[].group.model required | string | |
groups[].group.upstream_status required | integer | The HTTP status the provider answered. |
groups[].group.outcome required | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | How the response body ended. |
groups[].requests required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].last_seen_at required | string (date-time) | When the latest of them started. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/failures?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usageFailures = await hixel.usage.failures({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get guardrail activity#
The requests each guardrail rule flagged, masked or blocked, by bucket.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from, or 7 days by hour. |
bucket | query | "day" | "hour" | How the range is cut: by UTC day (the default) or hour. |
customer | query | string | Only requests that named this customer, by your id for it. |
member | query | string | Only requests that named this member, by your id for it. |
model | query | string | Only requests this public model name answered. |
key_id | query | string | Only requests made with this key (key_…). |
tag | query | string | Only requests that carried this tag. |
payer | query | "wallet" | "tenant" | "byok" | Only requests this payer paid. |
outcome | query | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | Only requests whose body ended this way. |
endpoint | query | "chat" | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | … | Only requests for this: chat, or the endpoint beside chat. |
session_id | query | string | Only the records of this realtime session. |
Response 200: GuardrailActivity
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
bucket required | "day" | "hour" | How the range is cut: by UTC day or hour. |
buckets required | array of string | Every bucket of the range, oldest first, with requests or not. |
group_by required | "rule" | group is a guardrail rule's id. |
series required | array of object | The rules of groups by bucket, then rule id; buckets without action left out. |
series[].bucket required | string (date-time) | The start of the UTC day or hour. |
series[].group required | string | |
series[].flagged required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].masked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
series[].blocked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups required | array of object | The rules that acted the most over the range (flagged + masked + blocked, then by id), at most 64. |
groups[].group required | string | |
groups[].flagged required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].masked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].blocked required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
total required | object | |
total.requests required | string | Requests at least one rule acted on, each once however many rules did. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/guardrails?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const guardrailActivity = await hixel.usage.guardrails({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get key activity#
When each key of the environment was last used, and its requests in the range (at most 92 days).
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from. |
Response 200: KeyActivity
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
group_by required | "key" | group is a key's id (key_…). |
groups required | array of object | The keys that made a request ever (revoked and expired ones included), most recently used first, at most 200. A key missing here was never used. |
groups[].group required | string | The id of a key (key_…); never the key itself. |
groups[].last_used_at required | string (date-time) | When the key's latest request ever started, in the range or not. |
groups[].requests required | string | Its requests in the range. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/keys?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const keyActivity = await hixel.usage.keys({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});Get a usage record#
One recorded request, by the record's own id (use_…).
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string | The record's id (use_…), not the request id: GET /v1/usage?request_id= finds a record by that. |
Response 200: UsageRecord
| Field | Type | Description |
|---|---|---|
id required | string | The id of one recorded request (use_…); not its request id. |
request_id required | string | The request's id, as x-hixel-request-id returned it (req_…). |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
key_id required | string | The key the request was made with. |
key_tags required | array of string | The key's tags when the request was made. |
customer required | string | null | Your id for the customer the request named (x-hixel-customer); null for none. |
member required | string | null | Your id for the member the request named (x-hixel-member); null for none. |
provider required | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | string | The provider that answered; a value this list does not name yet may appear. |
api_shape required | "openai_chat_completions" | "openai_responses" | "anthropic_messages" | string | null | The wire format of a chat request; null for an endpoint beside chat. |
endpoint required | "embeddings" | "image_generations" | "image_edits" | "audio_speech" | "audio_transcriptions" | "audio_translations" | … | string | null | The endpoint beside chat the request was for; null for chat. |
endpoint_usage required | object | null | Media tokens and units of an endpoint beside chat; null for chat. |
endpoint_usage.media_tokens required | object | |
endpoint_usage.media_tokens.image_input_tokens required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.media_tokens.image_output_tokens required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.media_tokens.audio_input_tokens required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.media_tokens.audio_output_tokens required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.media_tokens.audio_cache_read_tokens required | string | Cached audio and image input tokens, apart from the uncached: realtime only. |
endpoint_usage.media_tokens.image_cache_read_tokens required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.units required | object | |
endpoint_usage.units.images required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.units.image_size required | string | null | "1024x1536", when known. |
endpoint_usage.units.image_quality required | string | null | |
endpoint_usage.units.audio_millis required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.units.input_characters required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
endpoint_usage.units.search_units required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
requested_model required | string | The model the request named, an alias perhaps. |
model required | string | The public model name that answered. |
upstream_model required | string | The provider's own name of the model. |
deployment_id required | string | The route of the model that answered. |
payer required | "wallet" | "tenant" | "byok" | Who paid: the customer's wallet, your account with the platform (tenant), or the customer's own provider key (byok). |
attempts required | integer | Upstream calls made, retries and fallbacks included. |
stream required | boolean | Whether the response was streamed. |
tokens required | object | |
tokens.input required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
tokens.cache_read required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
tokens.cache_write_5m required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
tokens.cache_write_1h required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
tokens.output required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
tokens.reasoning required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
usage_completeness required | "complete" | "partial" | "missing" | "truncated" | string | How much of the usage the provider reported: complete, or partial, missing or truncated, whose cost is an estimate. |
cost_micros required | string | null | The provider's cost before markup, as charged: the settlement's amount when the gateway settled the request (which may be the reservation's estimate, above the cost of the usage seen), else the priced usage. null without a price. |
billed_micros required | string | null | What the payer was charged, as cost_micros is; 0 for BYOK. |
usage_cost_micros required | string | null | The cost of the usage the gateway saw, whatever was charged. |
usage_billed_micros required | string | null | What the usage the gateway saw bills, whatever was charged. |
upstream_status required | integer | The HTTP status the provider answered with. |
outcome required | "completed" | "aborted" | "upstream_error" | "truncated" | "stream_error" | How the response body ended. |
mocked required | boolean | Answered by the mock of a test environment: no provider was called. |
cache required | "hit" | "miss" | null | hit or miss when the response cache applied; null when it did not. |
guardrails required | object | |
guardrails.flagged required | array of string | |
guardrails.masked required | array of string | |
guardrails.blocked required | string | null | The output rule that stopped the response. |
tags required | array of string | The request's own tags (x-hixel-tags), in the order it gave them; empty when it sent none. They are metadata: they decided nothing about routing, the payer, limits or the price. |
client_token_id required | string | null | The id of the client token the request came through; null for a request with a key. |
session_id required | string | null | The realtime session the record belongs to (the request id of the session's handshake), shared by every response and input transcription of the session; null for any other. |
settlement required | object | |
settlement.status required | "untracked" | "settled" | "released" | "not_applied" | "failed" | How the request's charge to the balance ended: settled (charged), released (no provider response; nothing charged), not_applied, failed (the gateway's balance could not be reached; the ledger posts it), or untracked (no wallet paid and no limit applied). |
settlement.basis required | "usage" | "estimate" | string | null | What was charged: the usage seen or the estimate, for settled and failed. |
settlement.reason required | string | null | Why the object did not apply it, for not_applied. |
started_at required | string (date-time) | When the request arrived at the gateway. |
duration_ms required | integer | How long it took, in milliseconds. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.environment_required: a project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
usage_event_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/usage/use_123" \
-H "Authorization: Bearer $HIXEL_API_KEY"const usageRecord = await hixel.usage.get("use_123");List limit crossings#
A page of the environment's limit crossings, newest first: each request the gateway refused at a spend limit or because a wallet could not cover it.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
customer | query | string | Only this customer's crossings, by your id for it. |
limit_type | query | "spend_limit" | "insufficient_credits" | Only crossings of this kind. |
from | query | string (date-time) | Only crossings at or after this instant. |
to | query | string (date-time) | Only crossings before this instant. |
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
Response 200: LimitCrossingList
| Field | Type | Description |
|---|---|---|
data required | array of LimitCrossing | |
data[].id required | string | |
data[].customer required | string | null | |
data[].customer_name required | string | null | |
data[].member required | string | null | |
data[].key_id required | string | null | |
data[].limit_type required | "spend_limit" | "insufficient_credits" | |
data[].limit_id required | string | null | |
data[].request_id required | string | |
data[].reached_at required | string (date-time) | |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/limit_crossings" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.limitCrossings.list()) {
console.log(item);
}Summarize limit crossings#
Limit crossings by bucket and limit type over the range (at most 92 days; 7 by hour), and in total.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from, or 7 days by hour. |
bucket | query | "day" | "hour" | How the range is cut: by UTC day (the default) or hour. |
customer | query | string | Only this customer's crossings, by your id for it. |
limit_type | query | "spend_limit" | "insufficient_credits" | Only crossings of this kind. |
Response 200: LimitCrossingSummary
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
bucket required | "day" | "hour" | How the range is cut: by UTC day or hour. |
buckets required | array of string | Every bucket of the range, oldest first, with requests or not. |
group_by required | "limit_type" | group is the kind of limit. |
series required | array of object | By bucket, then limit type (spend_limit first); empty buckets left out. |
series[].bucket required | string (date-time) | The start of the UTC day or hour. |
series[].group required | "spend_limit" | "insufficient_credits" | |
series[].crossings required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups required | array of object | Both limit types over the range, spend_limit first. |
groups[].group required | "spend_limit" | "insufficient_credits" | |
groups[].crossings required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
total required | object | |
total.crossings required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
total.key_crossings required | string | Crossings of a key's own limit. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/limit_crossings/summary?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const limitCrossingSummary = await hixel.limitCrossings.summary({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});List the customers with the most limit crossings#
The customers whose requests were refused at a limit the most over the range (at most 92 days).
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
from required | query | string (date-time) | The start of the range, inclusive. |
to required | query | string (date-time) | The end of the range, exclusive: at most 92 days after from. |
limit_type | query | "spend_limit" | "insufficient_credits" | Only crossings of this kind. |
Response 200: LimitCrossingCustomers
| Field | Type | Description |
|---|---|---|
from required | string (date-time) | The start of the range, inclusive. |
to required | string (date-time) | The end of the range, exclusive. |
group_by required | "customer" | group is a customer, by your id. |
groups required | array of object | The customers with the most crossings (both types together, then by id), at most 50. Keys' own limits are not here. |
groups[].group required | string | Your id for the customer (its external_id), as every path takes it. |
groups[].customer_name required | string | null | |
groups[].spend_limit required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
groups[].insufficient_credits required | string | An exact integer as a decimal string, such as "1250": never a JSON number, which cannot hold every integer exactly. |
omitted_groups required | integer | Groups left out of groups and series; 0 when none. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_range:frommust be beforeto, and a summary covers at most 92 days (7 days by hour).environment_required: a project key was sent withoutx-hixel-environment.invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/limit_crossings/customers?from=2026-11-01T00%3A00%3A00Z&to=2026-12-01T00%3A00%3A00Z" \
-H "Authorization: Bearer $HIXEL_API_KEY"const limitCrossingCustomers = await hixel.limitCrossings.customers({
from: "2026-11-01T00:00:00Z",
to: "2026-12-01T00:00:00Z",
});