KazenAI
Security advisorysecuritybudgets

Security advisory: budget check could be bypassed in kazenai before 1.2.0

In kazenai and kazenai-finops 1.0.1 through 1.1.3, some OpenAI calls on a monitored client reached the provider without a budget check. Fixed in 1.2.0; the affected releases are yanked.

Affected: kazenai and kazenai-finops 1.0.1 through 1.1.3. Fixed in: 1.2.0 (2026-10-28). Yanked on PyPI (2026-10-30): every published kazenai and kazenai-finops release from 1.0.1 through 1.1.3. Action: upgrade to 1.2.1, the latest release (1.2.0 has the fix too). GitHub advisory: GHSA-2x2g-x54j-cj3m.

python -m pip install --upgrade "kazenai-finops[openai]==1.2.1"

What happened

monitor() wraps a provider client so that every paid call is checked against a budget before it is sent. On a monitored OpenAI client, these paths went to OpenAI with no pre-call check and no recorded cost:

  • responses.parse and responses.with_raw_response.parse (sync and async);
  • with_raw_response.create / with_streaming_response.create on chat.completions or responses when the wrapper was first accessed before monitor(), because the SDK caches it with the unpatched method;
  • legacy client.completions.create;
  • client.realtime.connect, client.beta.realtime.connect, and on openai 2.x responses.compact / responses.connect;
  • any provider method, raw or streaming wrapper, or client.request that your code saved before calling monitor(), and direct client.post(...).

The same pattern applied to Anthropic clients.

Impact

Calls made through these paths could exceed a configured budget and were not recorded. Calls made through the documented methods (chat.completions.create, messages.create, read from the client after monitor()) were checked as expected.

The fix

1.2.0 rebuilds cached wrappers from the guarded methods, supports the Responses API under the same checks, and adds a request gate: a monitored client checks each request it sends and refuses a paid request that did not come through one of its guarded methods, before anything reaches the provider. Endpoints outside the supported surface (embeddings, images, audio, batches, fine-tuning) are refused unless you name them in allow_unmetered; that spend is not counted.

Code that holds the API key and creates another client, or sends raw HTTP, is outside what monitor() can cover.

Reporting

Report security issues privately to [email protected]. Please don’t open a public issue; we will acknowledge your report and coordinate a fix and disclosure.