Skip to main content
Docs

One endpoint,
every model.

Tare is an OpenAI-compatible gateway in front of every model you use — ours and the ones you bring yourself. One base URL, one key, and every token accounted for.

Getting startedProvisioning keys

Provisioning keys

What this solves: Explains how the provisioning key issues and manages downstream child keys, plus the child key limit, expiry, and idempotent-creation gotchas.

When your end users have accounts and quota with you, a single shared key doesn't cut it. You need to issue a separate key to each user, limit each one separately, and disable them at any time. The provisioning key (also known as the master key) does exactly this: it only manages keys, and doesn't call models.

If you or a single service calls models directly, use an Inference key. See Before you start. A provisioning key plus child keys is for a SaaS product or a middle platform that issues keys, sets limits, and hands them out.

The most common use case is this: your platform backend stores one provisioning key. When a new user registers, buys quota, or creates a project, the backend calls /v1/keys to create a Child key, then hands it to that user or to the project's server to use.

Master key issues a child key A platform backend keeps one master key, calls POST /v1/keys when a user registers or buys quota, and hands the child key to that user. The master key manages keys and does not call models. Master key issues a child key Your platform backend Holds one master key Manages keys, not models POST /v1/keys Master key creates a child Response returns the child Child key Its own credential Own limit and disable End user or project Calls models with it Your account and quota The response nests the key as {key, data}: the credential, then its attributes. Clients built for this shape only change base_url and the management credential.
Provisioning key issuing child keys · end-to-end chain

The response embeds the key in two layers, {key, data:{…}}: the top level is the credential itself, and data holds its attributes. Clients that already integrate against this shape only need to change base_url and manage the credential.

Getting a provisioning key

Issue one yourself on the console's API Keys page: when creating, set the type to Provisioning (master key). The plaintext appears only once, at creation; after that only a fingerprint is kept in the database. It can also be issued by the platform on your behalf.

The provisioning key can only manage keys: it cannot send model requests, cannot read billing, and cannot change channels or routing. A credential that can both create child keys with unlimited limits and spend money has no loss ceiling if it leaks.

Creating child keys

Code / Terminal
curl https://tare.jamerly.ai/v1/keys \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "user-8f3a2b91",
    "limit": 12.50,
    "external_id": "usr_8f3a2b91",
    "include_byok_in_limit": false
  }'

The returned key is the full credential, shown only once; data.hash is the stable identifier for locating this key later.

FieldMeaning
namePurpose note, filled in by the caller; the platform doesn't model end users
limitSpend cap (USD), not a balance; omitted = no limit. With limit_reset set, it is the cap per period
limit_resetAutomatic reset period: daily / weekly / monthly; omitted = never reset automatically
external_idYour business ID, used for idempotent creation (see below)
include_byok_in_limitWhether BYOK spend counts toward this key's limit. Counted by default

external_id should always be included: after a create request times out, you can safely retry with the same ID, and Tare returns the existing key instead of opening another one.

Response fields

Create, query, and limit-change responses return data in the same shape:

FieldTypeDescription
hashstringStable identifier; every operation on this key uses it
namestringPurpose note
labelstringPrefix + ellipsis, for display
limitnumber or nullCap; null = no limit, not 0
limit_remainingnumber or nullWhat's left to spend = limit - limit_usage; also null when limit is null
limit_resetstring or nullAutomatic reset period; null = never
limit_usagenumberSpend since the last reset, which the limit is checked against; equals usage if never reset
limit_reset_atstring or nullWhen the limit was last reset (UTC); null if never
usagenumberCumulative spend so far; resets don't change it
usage_dailynumber or nullSpend today, by the billing timezone; resets don't change it. See "Usage by day" below
usage_weeklynumber or nullSpend since Monday
usage_monthlynumber or nullSpend since the 1st of the month
disabledbooleanWhether it's disabled
include_byok_in_limitbooleanWhether BYOK spend counts toward the limit
external_idstringExternal ID; this field is absent when unset
byok_usagenumberCurrently always 0, reserved field
created_at / updated_atstringISO 8601
expires_atstring or nullExpiry time

Listing and pagination

GET /v1/keys?limit=&after=, cursor pagination, includes disabled keys (you need to iterate all of them when rotating management credentials for a full migration).

The console's API Keys page also shows these child keys: pick the "Child keys" tab, which supports search by name, purpose, and external ID external_id. To locate a single end user's child key, this is more direct than iterating the list endpoint.

If your account has more than one provisioning key, the Child keys tab can filter by "which provisioning key issued it" — for example when you set up a separate provisioning key per environment or product line, use it to tell the batches of child keys apart.

Child keys don't show up in the "Inference" tab, even though the underlying key type is "inference" just like an ordinary key. That tab only lists keys you created directly. To find child keys, go to "Child keys"; otherwise it will look like the key doesn't exist at all.

Code / Terminal
{"data": [ /* same structure as above */ ], "next_cursor": 8123}
Location of next_cursorTop level, alongside data
Typenumber (platform auto-increment ID) or null; null = no next page
UsagePass it back to after as-is
limit default / max100 / 200; exceeding it is clamped to 200, not an error

The cursor is an id, not an offset. If new keys are created while you're paginating, an offset will skip or duplicate a key.

Response when plaintext is unavailable

When you repeat a create beyond the 5-minute window, key is null and two extra fields appear at the same level:

Code / Terminal
{"key": null,
 "key_unavailable_reason": "plaintext_window_expired",
 "key_unavailable_message": "The plaintext is only returned within 5 minutes ...",
 "data": { }}
  • key_unavailable_reason is a programmable enum value, currently only plaintext_window_expired; you'll be notified in advance before new enum values are added. Branch on this field.
  • key_unavailable_message is a human-facing message, its wording changes, don't use it for programmatic decisions.

Expiry (expires_at)

You can pass it at creation and change it later (PATCH with expires_at; an explicit null cancels the expiry).

An expired key calling a model returns 401, identical to a revoked one. Distinguishing the two would amount to confirming to someone holding an invalid credential that "this key once existed".

Expiry does not set disabled to true; that field only means "disabled". To check expiry, read expires_at.

Provisioning key rotation

Provisioning keys are independent of each other; an account can hold several at once and disable them separately, so rotation is zero-downtime:

  1. The platform issues a new provisioning key (plaintext appears only once);
  2. Switch the configuration to the new provisioning key, and new traffic goes through it;
  3. Confirm the new provisioning key works with any GET /v1/keys. /whoami won't work: that endpoint belongs to the reconciliation key, and the provisioning key gets a 403 whether it's valid or not;
  4. Tell the platform to disable the old provisioning key.

Don't disable the old one before switching the configuration. The provisioning key is the only way to create child keys; during the disable window all new user registrations will fail, with no way to compensate.

Rotating the provisioning key doesn't affect already-issued child keys; child keys are independent credentials and don't become invalid when the provisioning key does.

Master key rotation, no downtime Master keys are independent, so rotation has no downtime: issue a new key, switch config, confirm with GET /v1/keys, then disable the old key. Do not disable the old key first. Master key rotation, no downtime 1. Platform issues a new master key Plaintext is shown once. Only a fingerprint is kept. 2. Point config at the new master key New traffic uses the new key, on your side 3. GET /v1/keys to confirm it works Not /whoami. A master key always gets 403. 4. Ask the platform to disable the old key New signups fail while it is disabled, so do this last Master keys are independent. One account can hold several and disable them apart, so rotation does not stop traffic. Do not disable the old key before switching config. Signups fail while it is off. Child keys already issued stay.
Provisioning key rotation · zero-downtime sequence

Idempotent creation

After a create request times out you can't tell whether it was created: retrying creates one too many, not retrying leaves one missing. Including external_id avoids this: repeating a create with the same ID returns the existing key, with an HTTP status code of 200 instead of 201.

Creating a child key, idempotent Create a child key with external_id. No timeout returns HTTP 201 and the full credential. After a timeout, retry the same external_id: an existing key comes back as HTTP 200, a missing one is created as 201, and neither path opens a second key. After 5 minutes, key is null and key_unavailable_reason is set. key=null is not disabled, and re-enable does not restore the plaintext. Creating a child key, idempotent Create a child key with external_id Without it, a retry can add a key, or skipping the retry can lose one Did the create request time out? You cannot tell if it was created. That is when you retry. No timeout, normal return HTTP 201. Full key, shown once. data.hash is the stable id for this key Timed out: retry that external_id Exists: that key returns (200, not 201) Missing: create it (201). No second key. Repeat create after 5 minutes: key is null The same object adds key_unavailable_reason. Branch on it. Note: re-enable and key=null differ key=null is not disabled. Re-enable does not restore plaintext. Re-enable with PATCH {disabled:false}. A new key on the same external_id splits usage history. Always send external_id. After a timeout, the same id retries safely and does not open a second key. The full key can be fetched again for 5 minutes. After that, mint a new key. A silent refetch is not audited.
Creating child keys · idempotency

The full key can only be retrieved again within 5 minutes of creation.

Beyond that window, a repeated create still returns the key's data, but key is null, with a key_unavailable_reason attached.

Without this limit, anyone holding the provisioning key could enumerate external_id to repeatedly retrieve the plaintext of any child key, and since child keys can spend money, "the provisioning key can't spend money itself" would no longer be a loss ceiling. If external_id is just the user ID, the enumeration cost is close to zero.

Real create retries happen within seconds, so 5 minutes is generous. When you need the plaintext again, the right move is to issue a new key: disable the old one and create with a new external_id. This leaves an audit record; a silent re-retrieval doesn't.

external_id uniqueness includes disabled keys: one ID permanently maps to one key. To unban a user, use PATCH {"disabled": false}; do not open another key with the same external_id; otherwise that user's usage history splits into two segments.

Locating by external ID

No need to maintain an external_id → hash mapping table; you can operate directly with your own ID:

Code / Terminal
curl https://tare.jamerly.ai/v1/keys/external/usr_8f3a2b91 \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY"

curl -X PATCH https://tare.jamerly.ai/v1/keys/external/usr_8f3a2b91 \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit": 3.75}'

The semantics are exactly the same as the hash-based endpoints. /external/{id} is a separate path rather than letting {hash} accept both kinds of identifiers: both are free text, and if placed in the same position, an ID that happens to look like a hash would silently operate on a different key.

Changing the limit / disabling

Code / Terminal
curl -X PATCH https://tare.jamerly.ai/v1/keys/$HASH \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit": 3.75}'

Takes effect on the next call, with no cache delay. This is a deliberate guarantee: when you lower the limit after deducting a user's credits, any minute-level delay window means overspending.

To disable, pass {"disabled": true}, which also takes effect immediately.

Limit semantics

The limit is checked against limit_usage, the spend since the last reset. For a key that has never been reset, limit_usage is the cumulative usage and limit is a lifetime cap. usage only goes up; resets don't touch it.

Two ways to sync credits:

  • On every credit change, reset the key and set limit to the amount matching the user's current credits (see the next section).
  • Without resets, count cumulatively: limit = usage + the amount matching the user's current credits. If the key is spending between your read of usage and the update, this drifts.

The three limits don't overlap:

LimitEffectSet by
Account balanceWhether this account is in arrearsPlatform
Monthly budgetThis month's spend cap, resets every monthYou
Key limitThis key's spend cap, doesn't come back until resetYou (i.e. limit here)

The third isn't merged with the monthly budget, because credits don't automatically restore every month.

Resetting the limit

Reset now: limit_usage goes back to 0 and limit_remaining back to limit, effective on the next call. No request body.

Code / Terminal
curl -X POST https://tare.jamerly.ai/v1/keys/$HASH/reset \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY"

To reset by your own ID, use POST /v1/keys/external/{id}/reset. The returned data has the same shape as the lookup endpoint.

Reset on a schedule: pass limit_reset when creating or in a PATCH.

Code / Terminal
curl -X PATCH https://tare.jamerly.ai/v1/keys/$HASH \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit": 5, "limit_reset": "daily"}'
ValueResets at (UTC)
daily00:00 every day
weekly00:00 every Monday
monthly00:00 on the 1st of each month
nullNever

The reset happens within a minute of the boundary. Values and boundaries match OpenRouter's limit_reset.

Turning on a reset period starts the period at that moment; what the key already spent is not wiped. To clear it now, call reset as well.

A reset only affects the limit. usage, invoices, and usage records stay the same, and the account balance doesn't grow.

Usage by day

usage_daily, usage_weekly and usage_monthly on the key object have the same names and meaning as in OpenRouter's GET /api/v1/key. They count spend inside a time window, so a reset doesn't change them. Days are cut in the billing timezone, which the endpoints below return as timezone; limit_reset uses UTC boundaries instead. null means usage can't be read right now, not 0.

For a key with include_byok_in_limit: false, usage leaves BYOK spend out, while these three fields and the daily rows below include it.

For history, read one row per key per day:

Code / Terminal
curl "https://tare.jamerly.ai/v1/keys/usage/daily?from=2026-11-01&to=2026-11-23" \
  -H "Authorization: Bearer $TARE_PROVISIONING_KEY"
PathScope
GET /v1/keys/usage/dailyAll child keys under the account
GET /v1/keys/{hash}/usage/dailyOne key
GET /v1/keys/external/{id}/usage/dailyOne key, located by your own ID
ParameterMeaning
from / toYYYY-MM-DD, both inclusive; defaults to the 1st of this month through today. At most 100 days per request
group_bymodel splits each row by model and adds a model field
Code / Terminal
{"data": [
  {"date": "2026-11-22", "hash": "9c1e…", "external_id": "usr_8f3a2b91",
   "usage": 1.284, "requests": 37,
   "prompt_tokens": 51230, "completion_tokens": 8410,
   "reasoning_tokens": 2100, "cached_tokens": 30500}
 ],
 "from": "2026-11-01", "to": "2026-11-23",
 "timezone": "Asia/Shanghai", "includes_open_day": true}
FieldDescription
external_idThe key's external ID; null if never set
usageSpend that day (USD), same basis as usage_daily
requestsNumber of calls
prompt_tokens / completion_tokensInput / output tokens
cached_tokensThe part of prompt_tokens read from cache
reasoning_tokensThe part of completion_tokens spent on reasoning. Counted from 2026-11-23; earlier days show 0. Anthropic upstreams don't report reasoning separately, so their calls show 0
includes_open_dayThe window contains today. Today's row is computed live and still changes

A key with no usage on a given day has no row for it. Rows are ordered by date, then key, then model. For incremental sync, a response with includes_open_day: false won't change and can be stored as final.

Per key, the figures match /v1/integration/usage/daily in the Reconciliation API; both read the same daily totals.

Errors: 400 for a malformed date, to before from, a window over 100 days, or a group_by other than model; 404 for a key that isn't yours; 500 when usage is temporarily unavailable, in which case retry later.

Unauthorized access

You can only operate on keys you own. A hash that isn't yours returns 404 rather than 403; a 403 would incidentally confirm that the hash really exists.

Rate limit

The provisioning key tier is 1200 requests/minute, counted separately from model traffic: your limit-change frequency is roughly your billing-event frequency, and rate-limiting at the model tier would 429 on the first burst.

For the four tiers, the raise process, concurrency, and timeouts, see Rate limits and quotas.

Next steps

  • Want to know how you call models once you have a child key: read API Key.
  • Want to give a key a source IP allowlist or see the difference between the three key types: read API Key.
  • How to debug API errors: read Error codes.
Docs last updated Nov 27, 2026, 12:56 (UTC+8)