Documentation menu

Tags and caching

Label requests for your own reports, and answer repeated requests from a cache.

Tags#

Tag a request to see later what it was for: a feature, a team, an experiment. Send a comma-separated list in x-hixel-tags:

curl https://api.hixel.dev/v1/responses \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-hixel-customer: org_42" \
  -H "x-hixel-tags: feature:summarise, team/search" \
  -d '{ "model": "gpt-6.2-sol", "input": "…" }'
  • At most 8 tags, each 1 to 64 characters of letters, digits, ., _, :, / and -. Spaces around a tag are trimmed; a repeated tag is kept once.
  • A ninth tag, a longer one, another character or an empty entry (a,,b, a trailing comma) refuses the request with 400, invalid_header and param x-hixel-tags, before anything is charged.
  • Tags are labels only. They never change routing, the payer, limits, pricing or caching, and they are not sent to the provider.

The tags are on the request's usage record (tags), on the usage.recorded webhook and on its trace span. Filter the usage log by one (GET /v1/usage?tag=feature:summarise) or total usage by tag (GET /v1/usage/series?group_by=tag&…). A key's own tags, set when it is created, are recorded separately as key_tags.

Caching#

The gateway can answer a repeated request from a cache instead of calling the provider. A hit costs nothing: it is recorded with cost_micros and billed_micros of "0". The cache is off by default; turn it on under Gateway → Caching in the dashboard, where you also set the default and longest time to live and the largest response stored, or send the cache policy with PATCH /v1/gateway with a project key.

What it matches: the same request in the same format, to the same model, in the same environment, under the same configuration and model catalog. The body is compared after any masking by guardrails, ignoring key order and the few fields that do not change the answer (such as metadata). By default each customer has its own entries; the environment can share them across customers. Requests on a customer's own provider key are kept apart from the others.

It applies to the three chat formats only, in live environments only (a test environment's mock is never cached). A response is stored once it completed successfully with its usage read; a stream is stored and replayed as a stream. The cache lives in each data centre, so a hit depends on where a request lands.

Directives#

Steer one request with x-hixel-cache:

DirectiveEffect
ttl=<seconds>Store this response for that long (at most the environment's longest)
no-cacheDo not answer from the cache, but store the fresh answer
no-storeDo not store this answer
-H "x-hixel-cache: ttl=3600"

A response the cache applied to carries x-hixel-cache: hit or miss. A directive that cannot be read is refused with 400 and invalid_cache_directive. A cache hit still counts as a request toward the requests-per-minute limit, but not toward the token limit.