---
title: "Claude Haiku 5.5 on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 60%, code mode 80%; rank 31 of 44."
canonical: https://pydantic.dev/models/list/claude-haiku-5.5/billing_ops/
---

# Claude Haiku 5.5 on Pydantic AI - Billing ops

> Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 60%, code mode 80%; rank 31 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/claude-haiku-5.5/billing_ops/. Index for agents: https://pydantic.dev/models/llms.txt

**Agents: use the API for model information.** It answers a question in one request, where the pages need several.

- Choose a model for an agent: `POST https://pydantic.dev/models/api/select` with a JSON body such as `{"description": "what the agent does"}`. It returns up to five ranked models with reasons. Format: https://pydantic.dev/models/select.md
- Search models by name: `GET https://pydantic.dev/models/api/search?query=<text>`
- List, filter and sort models: `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`
- One model in full: `GET https://pydantic.dev/models/api/models/<slug>`
- Any other question about the models: `GET https://pydantic.dev/models/api/ask?query=<question>`

Add `intent=<intent>&stack=<stack>&harness=<harness>` to the query string of all but the single model. An `OPTIONS` request to any endpoint returns its schema. The same five are tools of the MCP server at `https://pydantic.dev/models/mcp`. More: https://pydantic.dev/models/usage.md

About the benchmark: https://pydantic.dev/models/benchmarks/billing_ops.md. The model on every Pydantic AI benchmark: https://pydantic.dev/models/list/claude-haiku-5.5/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | ------- |
| Tool calling | 60%   | 6 of 10      | $0.14  | 49       | 130        | 5.5 min |
| Code mode    | 80%   | 8 of 10      | $0.056 | 96       | 86         | 5.3 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`claude-haiku-5-5` passed 14 of 20 runs: 6/10 with tool calling and 8/10 in code mode. Every single-client lookup or change was solved or nearly solved; the failures are in audit-style questions over hundreds of invoices and in two rule or logic slips. No provider errors.

#### Where it does well

- **Small lookups**: `small-invoice_total-1` and `small-owed_on_invoices-1` passed in both modes in 2–4 requests at about $0.001.
- **Write workflows**: `large-correction-2` passed in both modes with the right order (`update_attendance`, `void_invoice`, `create_invoice`) and dates.
- **Allocation maths**: both `large-record_payment-1` runs worked out 37626 / 12500 correctly, netting off the existing 21152 allocation.
- **Tutor margin by hand**: tool-calling runs got 120741 and 65045 right from 74 and 33 lines with no calculator.
- **Recovery in code mode**: it worked through the 100-nested-call cap and a 1000-suspension session reset to still pass `large-wrong_invoices-1`.

#### Mistakes it makes

- **Gives up on scale, silently (3 tool-calling fails)**: with 384 invoices it opened 10 (`large-duplicate_lines-1`), 1 (`large-missed_billed-1`, never calling `list_attendance`) or 3 (`large-wrong_invoices-1`, 3 of 12 rows), then answered as if finished. Two returned `{"ids": []}`.
- **Duplicate write**: tool-calling `large-record_payment-1` called `record_payment` a second time with empty allocations, adding a spurious 50126 payment. It owned up in the summary.
- **Rule slip in code**: `small-tutor_margin-3` skipped tutor pay for 4 billable lessons whose student was `missed`, overstating margin by 11488.
- **Incomplete check**: code-mode `small-wrong_invoices-1` never tested for duplicated lines and missed `INV-00158`.
- **Summary error**: code-mode `large-record_payment-1` passed but reported £250.04 outstanding instead of £125.04.
- **Waste**: no-op `run_code` calls (`"done"`, `"ok"`), full pages printed into context, and about 20 redundant requests after the session reset.

#### Tool calling compared with code mode

Code mode was better on bulk work: it passed all three large audit cases that tool calling failed, because loops fetched every invoice instead of a sample. It was also cheaper overall ($0.056 against $0.136); `small-wrong_invoices-1` cost $0.0864 with tools against $0.0055 in code.

Tool calling was better where judgement over a small data set mattered: it passed `small-tutor_margin-3` and `small-wrong_invoices-1`, both of which code mode failed through bugs in its own script that it did not sanity-check. Code mode's sandbox limits cost many requests: `large-wrong_invoices-1` took 38.

For large volumes, use code mode; for either mode, do not trust an empty or short answer without checking coverage.

## Runs

### small-invoice_total-1

**Tool calling: passed.** One `get_invoice` call for `INV-00084`, read `total` 89700. Passed in 2 requests. ($0.0010, 2 requests, 3 s)
- Right: Minimal: one call, direct answer

**Code mode: passed.** One `run_code` call wrapping `get_invoice`, read `total` 89700. Passed in 2 requests. ($0.0010, 2 requests, 4 s)
- Right: Minimal

### small-owed_on_invoices-1

**Tool calling: passed.** `search_clients`, `list_invoices` (unpaid) and `list_allocations` for `CL-0007`, then 39452 − 3563 + 49315 = 85204. Passed in 4 requests. ($0.0012, 4 requests, 6 s)
- Right: Subtracted the 3563 credit allocation on `INV-00155`
- Right: Used the `status=unpaid` filter
- Mistake: Invoices and allocations were fetched in separate turns; they could have been parallel

**Code mode: passed.** Found `CL-0007`, fetched unpaid invoices and allocations in one snippet, then computed `39452 - 3563 + 49315` = 85204. Passed in 4 requests. ($0.0013, 4 requests, 5 s)
- Right: Invoices and allocations fetched in the same snippet
- Mistake: The sum was typed as literals in a separate `run_code` call rather than computed from the fetched records

### large-tutor_margin-3

**Tool calling: passed.** Fetched 75 lessons for `TU-002`, attendance for the 67 billable ones, and 18 clients in parallel, then produced 120741 with no visible working. Passed in 5 requests. ($0.0092, 5 requests, 44 s)
- Right: Filtered to `complete`/`cancelled_chargeable` before calling `list_attendance`
- Right: Fetched `is_taxable` for every client involved, needed for gross lessons
- Right: Handled `hourly_split`, `one_off` and gross pricing correctly
- Mistake: All arithmetic over 74 lines was done unrecorded in one final turn; nothing to check it against

**Code mode: passed.** Loaded 75 lessons, 79 attendance rows and 18 clients, computed net revenue 360316 and tutor pay 239575 with `Decimal` half-up rounding, giving 120741. Passed in 7 requests. ($0.0037, 7 requests, 21 s)
- Right: Tutor pay summed per billable lesson, separately from the charged-student loop
- Right: Re-ran tutor pay treating `hourly_split` as hourly and confirmed the same 239575
- Mistake: First tutor-pay pass treated `hourly_split` as one-off; it only matched because every split lesson was exactly 60 minutes, though the second pass caught the logic
- Mistake: Dumped the full 75-lesson list into context

### small-tutor_margin-3

**Tool calling: passed.** Fetched 39 lessons for `TU-001`, attendance for 37 billable ones and 7 clients, then answered 65045 from unrecorded arithmetic. Passed in 5 requests. ($0.0050, 5 requests, 24 s)
- Right: Paid the tutor for the 4 billable lessons whose only student was `missed` (the step code mode got wrong)
- Right: Treated non-taxable clients on gross lessons correctly
- Right: Parallel `get_client` calls

**Code mode: failed.** Loaded 39 lessons, 37 attendance rows and 7 clients, but added tutor pay inside the loop over charged attendance rows only. Answered 76533 instead of 65045. ($0.0029, 7 requests, 16 s)
- Right: Client-side net pricing was right, including non-taxable clients on gross lessons
- Right: Printed `Counter({'attended': 31, 'missed': 4, 'missed_chargeable': 2})`, so the 4 missed rows were visible
- Mistake: Final snippet: `if a["status"] not in ("attended","missed_chargeable"): continue` ran before `tutor=rnd(...)`, so the 4 billable lessons with a `missed` student (`LS-001419`, `LS-001445`, `LS-001491`, `LS-001541`) got no tutor pay: 3350 + 1688 + 3350 + 3100 = 11488, exactly the error
- Mistake: Handbook: the tutor is paid for each billable lesson; pay should be summed over the 37 lessons, as its own large-case code did
- Mistake: Printed `33` rows against 37 billable lessons and did not question it
- Mistake: Re-fetched lessons and attendance in each of three snippets

### large-duplicate_lines-1

**Tool calling: failed.** Paged all 394 October invoices, then called `get_invoice` on only 10 of the 384 non-void ones (`INV-06145`–`INV-06154`) and answered `{"ids": []}`. Failed; expected `INV-06060`, `INV-06073`, `INV-06097`. ($0.0074, 4 requests, 19 s)
- Right: Fetched pages 2-4 of `list_invoices` in parallel
- Mistake: Turn 3: sampled 10 invoices instead of fetching the lines of all 384; none of the three duplicated invoices was ever opened
- Mistake: Final turn: reported an empty list as if the check were complete, with no caveat

**Code mode: passed.** Paged 394 invoices, fetched all 384 non-void ones in four `asyncio.gather` batches of 100, and counted `(lesson_id, student_id)` pairs per invoice. Returned the three correct ids in 9 requests. ($0.0037, 9 requests, 18 s)
- Right: Checked every invoice, not a sample
- Right: Extra verification step printed the duplicated lines and checked for cross-invoice duplicates (0)
- Mistake: First call returned a full 14 KB invoice page into context instead of a count
- Mistake: One request lost to `dir()` not existing in the sandbox (`NameError: Unknown function: dir`)

### large-missed_billed-1

**Tool calling: failed.** Read page 1 of `list_invoices`, two single pages of `list_lessons` and one `get_invoice` (`INV-05761`), then answered `{"ids": []}`. Failed; expected `INV-05821`, `INV-05846`, `INV-06080`. ($0.0083, 5 requests, 33 s)
- Mistake: Never called `list_attendance`, the only source of `missed` status, so the question could not be answered
- Mistake: Never fetched pages 2-4 of the invoice list, and opened 1 of 384 invoices
- Mistake: `list_lessons` for 2026-01-01..2026-10-31 with `status=complete` (page 1 only) was an irrelevant 21 KB read
- Mistake: Returned an empty list rather than saying the work was not done

**Code mode: passed.** Fetched 384 invoices in batches of 95, then attendance for 2655 lessons in 27 chunks, and matched invoice lines to `missed` attendance. Returned the three correct ids in 10 requests. ($0.0051, 10 requests, 24 s)
- Right: Recovered from the 100-nested-call limit by splitting attendance fetches across two calls
- Right: Verified no invoice line lacked an attendance row (`missing` = 0) and printed the three offending lines
- Mistake: First call printed a whole 16 KB invoice page
- Mistake: One request lost when 99 `get_invoice` calls plus 27 `list_attendance` calls exceeded the 100-call cap

### large-wrong_invoices-1

**Tool calling: failed.** Paged all 394 invoices, read one page of September lessons, then opened only three invoices whose header tax looked odd and confirmed their clients were non-taxable. Returned 3 of the 12 expected rows; failed. ($0.013, 6 requests, 46 s)
- Right: Spotted tax-on-non-taxable invoices `INV-05851` (1050), `INV-06016` (1150), `INV-06105` (1875) from list headers alone, with correct amounts
- Mistake: Only checked the one error type visible in invoice headers; never fetched lines, lessons or attendance for the other 381 invoices
- Mistake: Missed 9 invoices: duplicate lines (`INV-06060`, `INV-06073`, `INV-06097`), missed-but-billed (`INV-05821`, `INV-05846`, `INV-06080`) and wrong-rate lines (`INV-05791`, `INV-05877`, `INV-06017`)
- Mistake: `list_lessons` for September without paging was a 21 KB read that was not used

**Code mode: passed.** Loaded 384 invoices, 2655 lessons and 3148 attendance rows, hit the 100-call cap once and the sandbox's 1000-suspension limit, restarted twice, and still returned all 12 correct rows. Passed in 38 requests at $0.0288. ($0.029, 38 requests, 2.9 min)
- Right: Covered every error type: line pricing, duplicate pairs, lines for uncharged students
- Right: Worked around having no call budget for clients by computing both taxable (`eT`) and non-taxable (`eN`) expected totals per invoice
- Mistake: Request 6: `asyncio.gather` over 384 `get_invoice` calls broke the 100-nested-call limit
- Mistake: Request 16: `suspension limit 1000 exceeded` wiped the session; all invoices, lessons and attendance were re-fetched (about 20 extra requests)
- Mistake: Request 17: `run_code` with `{"restart": true}` and no `code` was rejected
- Mistake: Final restart dropped the computed tables, so the 74 non-taxable clients were matched against ~14 KB of printed rows by eye rather than in code; correct, but lucky

### small-wrong_invoices-1

**Tool calling: passed.** Fetched all 37 invoices in one parallel turn, then lessons and attendance for all 280 lessons in batches and 6 clients, and returned the four correct rows. Passed in 7 requests at $0.0864, the costliest case. ($0.086, 7 requests, 2.2 min)
- Right: Complete data: every invoice line, lesson and attendance row was read
- Right: Found all four error types, including the duplicate line on `INV-00158` (4050)
- Mistake: Only 6 of 37 clients were checked for `is_taxable`; it got away with it
- Mistake: About 170 KB of raw records pulled into context; cost 16× the code-mode run of the same case

**Code mode: failed.** Loaded all 37 invoices, 280 lessons, 331 attendance rows and 37 clients, and checked line pricing, uncharged-student lines and header totals. Returned 3 of 4 rows, missing `INV-00158` (4050). ($0.0055, 7 requests, 29 s)
- Right: Found `INV-00162` (tax on non-taxable, 863), `INV-00172` (rate 6500 vs 6000, 600) and `INV-00176` (missed student billed, 6000)
- Right: Fixed a noisy first check that flagged other clients' students by adding `a['client_id']!=d['client_id']`
- Mistake: No check for the same `(lesson_id, student_id)` appearing twice in one invoice; `inv_has` is collapsed to a bool and `exp_lines` is a dict keyed by the pair, so a repeated line is invisible
- Mistake: Header check `d['total']!=sum(l['total'] ...)` cannot catch a duplicate because the header includes it; comparing the invoice total to the sum of expected lines would have
- Mistake: First check printed 14 KB of false `setmismatch` rows

### large-correction-2

**Tool calling: passed.** Looked up the client and `INV-06372`, then ran `update_attendance` (LS-045235 → `missed`), `void_invoice` and `create_invoice` dated 2026-11-13 with the three remaining lessons. Passed in 5 requests. ($0.0017, 5 requests, 11 s)
- Right: Parallel `search_clients` + `get_invoice` in the first turn
- Right: Correct order: attendance, void, reissue with only `LS-045914`, `LS-046583`, `LS-047246`
- Right: All writes dated today; new invoice auto-paid from released credit
- Mistake: Summary hedges ('appears to have covered it') because it never checked allocations, and does not mention the 5700 of credit left over

**Code mode: passed.** Gathered client, invoice, lessons, attendance and allocations, then ran `update_attendance`, `void_invoice` and `create_invoice` dated 2026-11-13. Passed in 6 requests. ($0.0016, 6 requests, 13 s)
- Right: Used `asyncio.gather` for reads
- Right: Summary correctly states 5700 left as unallocated credit
- Mistake: One wasted request: a `run_code` call containing only `"done"`
- Mistake: `get_lessons`, `list_attendance` and `get_settings` were not needed for the change

### large-record_payment-1

**Tool calling: failed.** Worked out the correct oldest-first allocation (37626 to `INV-02840`, 12500 to `INV-03247`) and recorded it as `LE-013560`, then immediately called `record_payment` again with `allocations: []`, creating duplicate payment `LE-013561` of 50126. Failed on the extra ledger entry. ($0.0022, 6 requests, 14 s)
- Right: Subtracted the existing 21152 allocation on `INV-02840` before allocating
- Right: First `record_payment` call exactly matched the expected change
- Right: Admitted the duplicate in the summary and did not compound it with an unrequested refund
- Mistake: Request 5: a second `record_payment` for the same 50126 right after the first succeeded; it should have stopped or verified with `list_allocations`
- Mistake: The duplicate leaves 50126 of false unallocated credit on `CL-0294`

**Code mode: passed.** Looked up `CL-0294`, read unpaid invoices and allocations, called `record_payment` once with the right split, then verified with `list_allocations`. Passed in 6 requests. ($0.0021, 6 requests, 15 s)
- Right: Single `record_payment` call, then a read-back check instead of a repeat write
- Mistake: Summary says £250.04 is outstanding on `INV-03247`; the true figure is 25004 − 12500 = 12504 (£125.04)
- Mistake: One wasted request containing only `"ok"`
- Mistake: `get_settings` was not needed
