Does staging hitting its LLM API budget block production?

See a live Ofox test where a $5 staging API-key cap returned 402 while production returned 200. Reproduce the two-key check and verify shared limits.

Two separate taps, one shut with an orange handle while the other releases two drops.

In our Ofox test, staging returned HTTP 402 after reaching its own $5 daily API-key budget. A second key representing production still returned HTTP 200 and BUDGET-DRILL-OK after the staging block. Both keys belonged to the same owner and team. Their individual limits were separate, and the shared rules had headroom.

A key-level cap blocks requests from that key. If the two keys sit under the same member or team limit, reaching that shared limit can stop both. Read the scope and error body to identify which budget stopped the request.

1. Give staging its own budget scope

Set up the experiment with two temporary keys you control. Both should start healthy, use the same model, and send the same short prompt to the same endpoint. Assign one key to staging and the other to production. In Ofox API Keys, open the staging key’s menu and go to Spend cap. Set an API-key budget and choose Notify and block. Record the period and amount on both keys. Use the same period for the test so a reset does not change the comparison halfway through. See the Ofox budget scopes and actions.

Effective ruleWhat to check before testing
Staging API keyGive it its own hard cap. Use this key for the request that reaches it.
Production API keyUse a different key. Check that it has budget headroom.
Shared member and teamCheck any hard caps affecting both keys, and confirm enough shared wallet balance to finish the test.
Request rateCheck the team’s shared RPM limit, a separate reason both keys could fail.

Use Check effective rules to look up the model and the relevant budget rules for each key. For a production rollout, document which member owns each key. Distinct key names still leave both keys subject to any shared member cap. Likewise, a default member budget is applied per member. An explicit member budget takes precedence where applicable.

2. Run the same request before and after the cap

On a test account, record one successful response from each key. Use a dedicated test key and confirm its usage counter has reached the cap before sending the follow-up probes. Use an approved test budget and account for every possible token category before generating any new usage. Send the same short prompt using the same model and endpoint with each key. Keep the output allowance small and record any setting changes. The production probe should return the expected text as well as HTTP 200. The staging probe should return HTTP 402 with spending_limit_exceeded in its error body. Ofox’s Responses endpoint returned that identifier in error.type and the number 402 in error.code.

The example below probes the keys once each. Run it before and after the staging cap is reached. Set the two key variables securely in your shell, and set OFOX_TEST_MODEL to a model available to both keys. See the Responses endpoint and response fields.

import json
import os
from urllib.error import HTTPError
from urllib.request import Request, urlopen

endpoint = "https://api.ofox.ai/v1/responses"
body = json.dumps({
    "model": os.environ["OFOX_TEST_MODEL"],
    "input": "Reply with exactly BUDGET-DRILL-OK.",
    "max_output_tokens": 128,
}).encode()

for role in ("staging", "production"):
    key = os.environ[f"OFOX_{role.upper()}_TEST_KEY"]
    request = Request(endpoint, data=body, headers={
        "Authorization": "Bearer " + key,
        "Content-Type": "application/json",
    })
    try:
        response = urlopen(request, timeout=45)
    except HTTPError as err:
        response = err
    with response:
        data = json.load(response)
        answer = "".join(
            part.get("text", "")
            for item in data.get("output", [])
            if item.get("type") == "message"
            for part in item.get("content", [])
            if part.get("type") == "output_text"
        )
        fields = data.get("error") or {}
        error = fields.get("code")
        if not isinstance(error, str):
            error = fields.get("type") or error
        print(role, response.status, error or answer)

3. Read the live results

We sent requests to the hosted Ofox Responses endpoint on December 3, 2026, using openai/gpt-6.2-astra through Azure Foundry. Two temporary keys represented staging and production so the test ran apart from live application traffic. Each key had its own Daily rule with Notify and block. The staging cap was $5 and the production cap was $10. The team had room under its shared limits. No member cap appeared in the setup panel. Both short baseline requests returned the exact expected text.

Live probeStaging keyProduction test key
Before staging reached its cap200 · BUDGET-DRILL-OK200 · BUDGET-DRILL-OK
After staging reached its cap402 · spending_limit_exceeded200 · BUDGET-DRILL-OK

The staging error said Spending limit exceeded (api_key daily). Used: $6.30928480, Limit: $5.00000000. Activity marked the blocked request as Budget cap, with 0 tokens and a $0.00000000 charge. The production probe completed with the expected text at 12:04:36 UTC+8, after staging returned 402 at 11:57:55. We had disabled the staging key and briefly re-enabled only the production test key for the follow-up. It used the same model and prompt as the baseline with an output limit of 16 tokens, and returned 12. Activity posted $0.00057800 for the follow-up. Both temporary keys were disabled at the end.

The call that pushed staging over its cap completed with 371,065 input tokens. The provider recorded 371,062 cache-write tokens and 3 uncached input tokens. Our preflight omitted cache-write pricing, and the posted charge for that call was $6.30870680. It overshot the test’s planned $6 ceiling. Total posted charges for the drill were $6.31044080. In this run, the fill request completed and posted a charge above the staging cap. The next staging request was blocked. Use a separate spend estimate that includes cache writes before trying a large request, and avoid a long fill call just to exercise a budget guard.

We also checked a shared limit in an isolated run of Ofox’s budget service. With the staging key at its $5 cap, the second key passed the budget gate. Once the shared member’s $10 cap was exhausted, the second key received a member-scope block even though it had only $5 against its own $10 key cap. That second scenario used seeded usage in the local harness.

4. Interpret the failure and close the test

What comes backWhat to check
402 with spending_limit_exceededCheck the rule’s scope and period. Wait for a daily or monthly reset or adjust the intended cap. Confirm the blocked request in Activity.
402 with insufficient_creditsCheck wallet balance. A top-up addresses balance. It does not reset a filled cap.
429Check the team’s request rate and follow the 429 troubleshooting guide.
503 with spending_limit_check_unavailableThe gateway could not verify a relevant spending limit. Save the error and follow the provider’s retry guidance.

The Ofox blocked-response reference lists the codes and describes where to check them. Save both responses with a timestamp, scope and result. Keep keys and authorization headers out of the record. If the intended key is isolated but both calls fail, compare each key’s effective member and team rules and wallet before adjusting anything. Use the API-key and model reconciliation tutorial when you need to match a request with the charge posted to Activity.