Instead of hardcoding SPEND_PER_REQUEST (which broke when the model
changed from gpt-3.5-turbo-0301 to gpt-3.5-turbo), make a single
calibration request first, poll for its spend, and use that as the
per-request cost. Fails fast with pytest.fail() after 5 retries if
calibration cannot determine the cost.
Also fixes a bug in test_basic_spend_accuracy where the user spend
assertion error message referenced user_info['info'] instead of
user_info['user_info'].
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The spend accuracy tests were flaky because they used fixed sleeps
(45s/30s) to wait for the batch writer to flush. Under CI load, the
batch writer scheduler can be delayed beyond these windows, causing
all spend values to remain 0.0 and the test to fail.
Replace fixed sleeps with a polling loop that checks key spend every
10s for up to 120s, only proceeding once spend becomes non-zero.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix 1.1: Make ResponseApplyPatchToolCall import conditional with try/except
for compatibility with openai==1.100.1 (CI environment)
Fix 1.2: Move Router creation inside mock context in vector store tests
so mocks are applied before Router captures function references
Fix 1.3: Update test_model_group_info_e2e to check for 'anthropic/*'
wildcard group instead of specific model names not in proxy config
Fix 2.1: Increase redis cache test sleep from 1s to 5s
Fix 2.2: Increase spend accuracy test sleep from 25s to 45s
Fix 2.3: Add 0.5s sleep between budget test calls
Fix 2.4: Increase vertex AI spend test sleep from 20s to 40s
Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
* fix: use fastuuid helper across the codebase
First batch of changes, simple drop in replacement.
* second batch of changes
* fixed: script mistake on helper file