Exact refill math with an injectable clock. No drift allowed. A model passes this trial only when every test goes green — retries are included in the price, and the clock runs until done.
| Model | Verdict | Tries | Time | Cost to done | Tokens |
|---|---|---|---|---|---|
| claude-haiku-4-5 | GREEN | x1 | 6s | $0.0011 | 328 |
| gpt-5-mini | GREEN | x1 | 11s | $0.0026 | 743 |
| claude-sonnet-4-6 | GREEN | x1 | 6s | $0.0028 | 288 |
| gpt-5.4 | GREEN | x1 | 5s | $0.0028 | 281 |
| gpt-4.1 | GREEN | x1 | 5s | $0.0029 | 273 |
| claude-opus-4-8 | GREEN | x1 | 6s | $0.0038 | 392 |
| claude-fable-5 | GREEN | x1 | 9s | $0.0042 | 422 |
| claude-sonnet-5 | GREEN | x1 | 6s | $0.0044 | 467 |
| gpt-5.2 | GREEN | x1 | 10s | $0.0057 | 475 |
| gpt-5.5 | GREEN | x1 | 5s | $0.0057 | 287 |
| gpt-5.1 | GREEN | x1 | 9s | $0.0059 | 487 |
| gpt-5 | GREEN | x1 | 10s | $0.0090 | 676 |
Green row = cheapest to done · blue time = fastest to done. REFUSED = the model declined the task (a failure mode token prices never show). claude-fable-5's line is high-variance: follow-up probes saw it stochastically refuse benign coding prompts it had previously attempted. One trial per model per round; replies capped at 2,048 output tokens uniformly. Costs metered per session by cerver.
Write `solution.py` with class `TokenBucket(rate: float, burst: float, clock)`: - `clock` is a zero-arg callable returning seconds (float) - `allow() -> bool`: consumes 1 token if available, else False - bucket starts FULL (burst tokens); refills continuously at `rate`/sec, capped at `burst` - must be exact: no drift when allow() is called at irregular times Return the COMPLETE `solution.py` in one ```python block, nothing else.
from solution import TokenBucket
class FakeClock:
def __init__(self): self.t = 0.0
def __call__(self): return self.t
def test_burst_then_block():
c = FakeClock(); b = TokenBucket(rate=1, burst=3, clock=c)
assert [b.allow() for _ in range(4)] == [True, True, True, False]
def test_refill():
c = FakeClock(); b = TokenBucket(rate=2, burst=2, clock=c)
assert b.allow() and b.allow() and not b.allow()
c.t = 0.5 # +1 token
assert b.allow() and not b.allow()
def test_cap_at_burst():
c = FakeClock(); b = TokenBucket(rate=100, burst=2, clock=c)
b.allow(); b.allow()
c.t = 999
assert [b.allow() for _ in range(3)] == [True, True, False]
def test_never_exceeds_capacity_windowed():
c = FakeClock(); b = TokenBucket(rate=20, burst=40, clock=c)
admitted = []
for i in range(400):
c.t = i * 0.01 # 100 calls/sec attempted for 4s
if b.allow(): admitted.append(c.t)
for start in [x * 0.5 for x in range(7)]:
window = [t for t in admitted if start <= t < start + 1.0]
assert len(window) <= 60 # 40 burst + 20 refill max in any 1s