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.

OperationsTesting failures

Testing failures

What this solves: Let you drill all kinds of failure scenarios without actually burning through your quota or waiting for a real outage.

Mock (drill) doesn't actually hit upstream. It makes Tare return errors that match the shape of a real failure, following a specified script.

Why you need it

The hardest branch to create on your own in a drill is the error branch. To really hit quota exhaustion, you'd have to spend all the money first; to really encounter an upstream failure, you can only wait for it to happen on its own, at a time you don't get to pick.

Attach a fixed scenario to a key, and requests made with that key return the simulated result directly, without actually reaching upstream. Not a single token is spent, and you don't have to wait for a real outage to occur.

When to use Mock

  • Before launch, verify how the client handles rate limiting, arrears, and quota exhaustion.
  • Verify the error copy that support or the frontend shows to end users.
  • Verify that retry logic only retries errors that should be retried.
  • Verify that monitoring and alerts can recognize failures.

Suggested drill order

  1. Start with a normal Mock response (SUCCESS) to confirm the call path is controllable.
  2. Drill 429 and confirm the client reads Retry-After.
  3. Drill quota exhaustion and arrears, and confirm it doesn't blindly retry.
  4. Drill all upstreams down, and confirm both the frontend and alerts can recognize it.
  5. Drill a DLP block, and confirm sensitive content isn't still being sent upstream.

Details

Attaching a scenario

Console path: API Keys → the flask icon on a key.

You can also call the API directly:

Code / Terminal
curl -X PUT https://tare.jamerly.ai/v1/mocks/{apiKeyId} \
  -H "Authorization: Bearer $TARE_KEY" -H "Content-Type: application/json" \
  -d '{"scenario":"UPSTREAM_TIMEOUT","enabled":true}'

The scope is only the key you name, not the whole account. When operating with management credentials, you can only touch the keys they own. Using a dedicated key for a drill won't turn your colleagues' production traffic into fake data.

Scenario list

GET /v1/mocks/scenarios gives the full list; read it from here, don't hard-code it in the client, because the list may grow:

ScenarioWhat it simulates
KEY_CREDIT_EXHAUSTEDThis key's own spend limit is used up
BUDGET_EXHAUSTEDThe account's monthly budget is used up
ACCOUNT_BALANCE_INSUFFICIENTThe account balance is exhausted
RATE_LIMITEDRequests too frequent
UPSTREAM_TIMEOUTUpstream never responds
UPSTREAM_ERRORUpstream returns 5xx
INVALID_KEYThe credential is rejected
MODEL_NOT_FOUNDThe requested model doesn't exist
BAD_REQUESTMalformed request
CONTENT_FILTEREDBlocked by content policy
SUCCESSNormal response, with content specified by you (see below)

Every failure scenario returns an error of exactly the same shape Tare would give if it really happened. The point is to make your code take the actual branch, not an approximation of it.

SUCCESS: a fixed response, not a failure

This is the only non-failure scenario. Set responseBody to the complete JSON you want; it is replayed as-is. Plain text is wrapped into a normal completion. Optionally add delayMs to simulate latency. Good for testing the happy path: you get a stable, predictable output instead of a real model's varying answer.

Expiry

A drill is supposed to be temporary: if you don't set expiresAt, by default it expires 4 hours after being enabled, and there's no "permanent" option.

A drill nobody remembers enabling, sitting on a credential that quietly became a production key, is far worse than the hassle of turning it on again.

What it doesn't affect

  • Calls on other keys are unaffected. A drill is a property attached to a key, not account-level.
  • Not a single token is consumed; a drill never actually reaches upstream.
  • Turning it off or deleting it takes effect from the next call; calls already in flight are unaffected.

A drill still leaves traces, and may be billed

A drill call always writes a usage record, marked MOCKED, so whichever scenario it is, it doesn't count toward your success-rate statistics (a SUCCESS scenario won't push it up, and a failure scenario won't pull it down).

It goes through the same billing path as a real call: token usage is always 0, but if the channel this model uses has a per-call minimum charge, that minimum charge is still collected. This call also has to pass the same three gates — balance, key limit, budget — as a real call. A key that has already exhausted its quota can't dodge the checks by turning on a drill and picking up a routing fee along the way.

Turning the drill on and off also leaves traces. Someone will eventually ask you to explain what happened during the period when production traffic quietly started returning fake data. See Audit Trail for details.

Next steps

Docs last updated Nov 27, 2026, 12:56 (UTC+8)