---
title: "GLM 5.3 Flash on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 70%, code mode 70%; rank 21 of 44."
canonical: https://pydantic.dev/models/list/glm-5.3-flash/billing_ops/
---

# GLM 5.3 Flash on Pydantic AI - Billing ops

> Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 70%, code mode 70%; rank 21 of 44.
>
> Markdown copy of https://pydantic.dev/models/list/glm-5.3-flash/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/glm-5.3-flash/pydantic_ai.md

| Mode         | Score | Tasks passed | Cost  | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ----- | -------- | ---------- | -------- |
| Tool calling | 70%   | 7 of 10      | $1.03 | 145      | 1275       | 20.3 min |
| Code mode    | 70%   | 7 of 10      | $0.18 | 184      | 196        | 6.9 min  |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

GLM-5.3-Flash passed 7 of 10 cases in each mode (14 of 20), but not the same seven. Small lookups and both write tasks are within reach. The large audit questions over 384 invoices are where it breaks: 5 of the 7 failures are there. Tool calling cost $1.03 in total, code mode $0.18.

#### Where it does well

- **Applying the handbook rules.** All four tutor-margin runs were right, including gross pricing for non-taxable clients and paying the tutor for lessons where the only student was `missed`.
- **Checking against system records.** In code mode `large-tutor_margin-3` it first got 68510, compared its lines with real invoice lines, found it was deducting tax from net-priced lines, and corrected to 120741.
- **Write tasks, when it gets to them.** Both `large-correction-2` runs and code-mode `large-record_payment-1` read allocations first, wrote in the right order and verified afterwards.

#### Mistakes it makes

- **The call it emits does not match its reasoning.** This is the main weakness and appears in most runs. Three failures ended with `final_result` while the reasoning said to continue: an empty summary with no `record_payment`, `["INV-05841"]` after about 60 of 384 invoices, and `INV-05841..05843` with the data loaded but never compared. A fourth returned the placeholder `{"id": "invoice", "pence": 1}`.
- **Dropped or repeated arguments.** `list_invoices` and `list_lessons` went out without their filters, and earlier calls were re-sent verbatim. In `large-correction-2` (tools) it re-sent `void_invoice` after it had succeeded.
- **Junk calls.** `search_tutors("startup_burn")`, arguments of `"Array"`, snippets such as `print('placeholder')` or English prose. One passing read-only run made a stray `record_payment` call that only failed because the invoice did not exist.
- **One real logic miss.** Code-mode `small-wrong_invoices-1` priced each line correctly but never checked for a repeated lesson and student, so it missed INV-00158.

#### Tool calling compared with code mode

Code mode is far cheaper on the big cases: `large-duplicate_lines-1` cost $0.0075 and passed, against $0.07 and a fail with tools; `large-wrong_invoices-1` cost $0.05 against $0.62. With tools, the model reads megabytes of invoice JSON and matches by eye, which worked once (`large-missed_billed-1`, $0.21) and ran out of 60 requests once.

Code mode gathers the data reliably, but in two of its three failures the model then answered without running the final computation. It also loses requests to sandbox limits (`globals()`, the 100-call cap, function-local variables) and to guessed field names. On small cases code mode gives no benefit and took more requests (20 against 9 on `small-tutor_margin-3`).

## Runs

### small-invoice_total-1

**Tool calling: passed.** One `get_invoice("INV-00084")` call, summed the 14 line totals to confirm 89700, and answered. Passed in 2 requests. ($0.0013, 2 requests, 3 s)
- Right: Minimal path, and it checked the header total against the lines.

**Code mode: passed.** Fetched INV-00084 with `get_invoice`, summed net, tax and total over the lines in a second snippet, and answered 89700. Passed in 3 requests. ($0.0011, 3 requests, 3 s)
- Right: Confirmed the line sums (74752, 14948, 89700) equal the header.

### small-owed_on_invoices-1

**Tool calling: passed.** Found CL-0007's two unpaid invoices, subtracted the 3563 credit allocation on INV-00155 and answered 85204. Passed in 6 requests. ($0.0016, 6 requests, 6 s)
- Right: Subtracted the unreleased allocation (payment_id null) from INV-00155: 39452 − 3563 = 35889, plus 49315.
- Mistake: Message 3 repeated the identical `search_clients("Emeka Brown")` call.
- Mistake: Message 9 re-fetched `list_allocations` for both invoices after it already had the full client list; two wasted requests out of six.

**Code mode: passed.** Listed CL-0007's unpaid invoices and allocations, computed total less unreleased allocations in code, and answered 85204. Passed in 6 requests. ($0.0013, 6 requests, 5 s)
- Right: Filtered allocations on `released_on is None` in the code.
- Mistake: One snippet only re-printed `summary` and `outstanding_total` that the previous snippet had already returned.
- Mistake: Four separate snippets where one would have done.

### large-tutor_margin-3

**Tool calling: passed.** Listed TU-002's 75 October lessons, pulled attendance and 18 clients' tax status, and worked the margin out by hand as 360316 − 239575 = 120741. Passed in 8 requests. ($0.023, 8 requests, 1.6 min)
- Right: Excluded the 8 `cancelled` lessons and kept `cancelled_chargeable` ones.
- Right: Handled gross-priced lessons for the non-taxable client CL-0097 correctly (net = cost, 6000 each), which is the easy rule to miss.
- Right: Counted tutor pay once per billable lesson.
- Mistake: Messages 3 and 5: two `list_lessons` calls were emitted as `{"end": "2026-10-31", "page": 1}` without `tutor_id` or `start`, returning May 2025 lessons from a 47,676-lesson list; the third call had the right arguments.
- Mistake: All arithmetic over 67 lessons was done in prose; it was right, but there was no independent check.

**Code mode: passed.** First computed 68510, then caught its own error by comparing against real invoice lines and corrected to 120741. Passed, but took 34 requests. ($0.044, 34 requests, 1.6 min)
- Right: Compared its line pricing with invoices INV-06270, INV-06406 and INV-06500; the split-lesson line showed `net` 1750 where it had 1400, exposing that it was subtracting tax from net-priced lines.
- Right: After the fix, matched all 74 charged lines against the system's November invoices (0 missing, 0 mismatched, net sum 360316) and tutor pay against PO-0678 (239575).
- Mistake: The first computation (message 24) gave 68510 because tax was deducted from net-priced lines; without the cross-check it would have answered wrong.
- Mistake: Wasted snippets: `import tkinter`, prose as code (message 52), `net myself = 0` (message 62), a stub that did no work (message 57), a duplicated `list_invoices` call, and a `NameError` because `clients` was local to `main()`.
- Mistake: Roughly 20 of 34 requests went on verification after the correct figure was reached at message 50.

### small-tutor_margin-3

**Tool calling: passed.** Computed TU-001's October margin by hand as 187435 − 122390 = 65045 and confirmed the tutor pay against payment order PO-0041. Passed in 9 requests. ($0.018, 9 requests, 73 s)
- Right: Paid the tutor for the four complete lessons where the only student was `missed`, while charging no client for them.
- Right: Handled gross lessons for non-taxable CL-0037 and taxable CL-0002/CL-0008 separately.
- Right: Cross-checked tutor pay of 122390 against the November payment order.
- Mistake: Message 3 repeated `search_tutors("Kai Iyer")` although the reasoning said it was about to list lessons.
- Mistake: One `list_lessons` call went out without the tutor filter (noted by the model at message 9).
- Mistake: Message 15 called `list_lessons(student_id="ST-0059")` after the answer was already settled.

**Code mode: passed.** Computed 187435 net charges and 122390 tutor pay in code for TU-001's 37 billable lessons and answered 65045. Passed in 20 requests. ($0.011, 20 requests, 42 s)
- Right: Stopped to check that the four lessons with only a `missed` student were already inside the tutor pay figure and did not add 11488 twice.
- Right: Validated gross-line pricing against INV-00187 (net 4687, tax 938, total 5625).
- Mistake: Guessed response shapes three times: `resp["lessons"]`, `l["date"]` and `a['attendance']` all raised errors before it printed a sample row.
- Mistake: One syntax error from `await` inside a generator expression.
- Mistake: 20 requests for a 39-lesson question; the tool-calling run took 9.

### large-duplicate_lines-1

**Tool calling: failed.** Listed the 394 October invoices, lost the date filters on later pages, started fetching invoices one by one and then answered `INV-05841` after checking roughly 60 of 384 with no duplicate found. Failed. ($0.073, 15 requests, 67 s)
- Right: Correct plan: fetch every non-void October invoice and look for a repeated (`lesson_id`, `student_id`) pair.
- Right: Worked out that the October block is INV-05761..INV-06154 by probing `get_invoice` on INV-05961, INV-06100, INV-06154, INV-06155 and INV-06160.
- Mistake: Messages 5-15: every `list_invoices` call for pages 3 and 4 was emitted as `{"page": 3}` or `{"page": 4}` without `sent_from`/`sent_to`, including one turn with seven such calls. Its reasoning said it had included the filters and blamed the environment for stripping them.
- Mistake: Message 29: the reasoning said "No duplicates so far. Continue: INV-05823..05859", but the call emitted was `final_result` with `["INV-05841"]`, an invoice it had not fetched. The three real answers (INV-06060, INV-06073, INV-06097) lay in the range it never reached.
- Mistake: It should have kept fetching the remaining ~320 invoices; nothing in the run justified stopping.

**Code mode: passed.** Paged the 394 invoices, fetched the 384 non-void ones in batches of 90 with `asyncio.gather`, and found the three invoices with repeated (lesson, student) pairs in code. Passed in 15 requests at $0.0075. ($0.0075, 15 requests, 28 s)
- Right: Recovered properly when a 270-call snippet hit the 100-call limit: computed which ids were missing from `lines_map` and fetched only those.
- Right: Printed the three duplicate lines to confirm before answering.
- Mistake: Two snippets were sent wrapped in markdown fences and failed with syntax errors (messages 11 and 23).
- Mistake: Message 7 tried 270 nested calls in one snippet despite having noted the 100-call cap two messages earlier.
- Mistake: Used `next()` on a generator, which the sandbox does not support.

### large-missed_billed-1

**Tool calling: passed.** Fetched all 384 non-void October invoices with `get_invoice`, swept attendance for LS-041700..LS-044699, and found the three lines with status `missed` and `invoiced` true. Passed in 21 requests at $0.21. ($0.21, 21 requests, 5.6 min)
- Right: Complete coverage: every non-void invoice's lines and the whole September lesson range of attendance were read.
- Right: Used the `invoiced` flag on `missed` attendance rows to find LS-041761/ST-0127, LS-043071/ST-0491 and LS-044224/ST-0088, then mapped them to INV-05846, INV-06080 and INV-05821.
- Right: Noticed that one `get_invoice` had a leading space in the id (" INV-06113") and refetched it.
- Mistake: Several stray calls it acknowledged itself: `list_attendance` with invented ids "L-901", "L-902" (twice), an unneeded `get_settings`, re-fetching `list_invoices` page 4 and page 1, and a `record_payment` call against a non-existent invoice (message 35). That last one is a write call on a read-only question and was harmless only because it failed.
- Mistake: Message 31: intended a batch of 88 `get_invoice` calls but emitted one.
- Mistake: The match of attendance rows to invoices was done by reading ~1.3 MB of tool output, with no check beyond its own scan; the most expensive passing run.

**Code mode: failed.** Loaded all 3108 lines and 3148 attendance rows into the sandbox twice, then answered `INV-05841`, `INV-05842`, `INV-05843` without ever running the comparison. Failed after 39 requests. ($0.030, 39 requests, 63 s)
- Right: Data collection was correct and complete: 384 invoices, 2655 lessons, 27 attendance batches.
- Right: Understood the question: a line whose attendance status is `missed`.
- Mistake: Sent English prose as code four times (messages 3, 31, 47, 49), plus an empty snippet and one in markdown fences.
- Mistake: Message 39: with everything loaded, the snippet began `lines_map = {}` and re-listed invoices with an unsupported `page_size` argument. It wiped the loaded lines and forced a full re-fetch of 384 invoices.
- Mistake: Message 77: straight after attendance was rebuilt, it called `final_result` with three consecutive ids that no code had produced. One more snippet filtering `att_status[(lesson_id, student_id)] == 'missed'` over `lines_map` would have given INV-05821, INV-05846 and INV-06080.

### large-wrong_invoices-1

**Tool calling: error.** Spent all 60 requests fetching invoices by hand and probing tools, and hit `UsageLimitExceeded` with no answer. It had spotted three of the twelve wrong invoices by eye. Cost $0.62, the most expensive run. ($0.62, 60 requests, 6.8 min)
- Right: Found real errors while reading: the taxed line on non-taxable CL-0097's INV-05851 (1050), and duplicate lines on INV-06060 and INV-06073 (4500).
- Right: Checked with `list_attendance` that a lesson shared across several clients' invoices is legitimate and not a duplicate.
- Mistake: Message 1 started from the wrong test (invoice total against the sum of its lines) and only later moved to recomputing lines.
- Mistake: Repeatedly emitted calls that did not match its plan: `list_invoices` with `{}` or only `page`, `get_invoice` with underscore ids, arguments of the literal string "Array", `search_tutors(name="startup_burn")`, `list_invoices(page=38)`.
- Mistake: Messages 103-109: four consecutive requests each carried a single `get_invoice` (INV-06088..INV-06091) when it had been batching 40-58 per request.
- Mistake: Never fetched lessons, attendance and client tax status for the full set, so it could not have produced the twelve rows even with more requests at that pace. It should have batched the remaining `get_invoice` calls, then `get_lessons` and `list_attendance` 100 ids at a time.

**Code mode: failed.** Loaded all 384 invoices, 2655 lessons, attendance and 384 clients into the sandbox over 37 requests, then returned the placeholder `{"id": "invoice", "pence": 1}` without running the pricing. Failed. ($0.052, 38 requests, 78 s)
- Right: Every input needed was in memory: `details`, `lessons_by_id`, `att_by_lesson`, `client_taxes`.
- Right: Message 71 laid out the correct per-line pricing and tax rules.
- Mistake: About a dozen no-op snippets between real steps: `print('waiting jog')`, `empty` (twice), `c=2+2`, `print('placeholder')`, `def add(a, b)`, `print('go')`. Its own notes say "I keep triggering junk placeholders".
- Mistake: Used `globals()`, which the sandbox lacks, twice.
- Mistake: Messages 71-75: after writing the plan, the emitted code was `print('wait placeholder')`, then `print('go')`, then `final_result` with a dummy row. It should have run the recomputation over `details` and reported the twelve invoices.

### small-wrong_invoices-1

**Tool calling: passed.** Fetched all 37 October invoices, their lessons, attendance and clients, recomputed every line by hand and returned the four correct rows. Passed in 8 requests at $0.07. ($0.071, 8 requests, 3.2 min)
- Right: Caught all four error types: duplicate line LS-001226/ST-0016 on INV-00158 (4050), tax on non-taxable CL-0014 (863), wrong rate on INV-00172 (600) and a `missed` student billed on INV-00176 (6000).
- Right: Identified the six non-taxable clients before pricing.
- Mistake: Messages 7 and 9 note duplicated tool calls sent by mistake.
- Mistake: Recomputing 325 lines in prose (one reasoning message is 82,000 characters) is fragile, though it was right here.

**Code mode: failed.** Recomputed every line of the 37 October invoices in code and reported three of the four wrong invoices; it missed INV-00158 (4050), which bills the same lesson and student twice. Failed. ($0.015, 12 requests, 59 s)
- Right: Per-line pricing was exact: found the tax on non-taxable CL-0014 (863), the wrong rate on INV-00172 (600) and the `missed` student on INV-00176 (6000).
- Right: Used integer half-up rounding `(2*num + den) // (2*den)` and checked header totals against lines.
- Mistake: The check compared each line with its own correct price, so a line that appears twice passes both times. It never tested for a repeated (`lesson_id`, `student_id`) pair within an invoice, although the handbook says an invoice has one line per charged student per lesson.
- Mistake: A clue was in its output and went unexamined: 325 lines but 280 unique lessons, and `get_lessons` returned 310 rows. It put this down to the API returning extras.
- Mistake: Used `globals()` once and lost `att_map` to function scope once; the second-last snippet was `print('checks complete')`.

### large-correction-2

**Tool calling: passed.** Marked ST-0332 `missed` on LS-045235, voided INV-06372 dated 2026-11-13 and reissued the other three lessons as INV-06548; the changes matched the expected state exactly. ($0.0078, 11 requests, 28 s)
- Right: Resolved Yara Baker as student ST-0332 under client CL-0234 via `search_clients` and `get_invoice`, then checked `list_allocations` and `list_attendance` before writing.
- Right: Correct order: `update_attendance` and `void_invoice` first, then `create_invoice` with lines LS-045914, LS-046583, LS-047246.
- Right: Verified the 17100 credit allocation with `list_allocations` and reported the 5700 left as unallocated credit.
- Mistake: Message 5 re-sent the identical `search_clients`, `get_invoice` and `get_settings` calls from the first turn.
- Mistake: Message 13 re-sent `update_attendance` and `void_invoice` after both had already succeeded; the second void returned an already-void error, so it was harmless only because of that. Message 15 sent `update_attendance` a third time.

**Code mode: passed.** Same correction done in sandbox code: `update_attendance` and `void_invoice` in one snippet, then `create_invoice` for the three remaining lessons, then a verification read. Passed in 8 requests. ($0.0092, 8 requests, 24 s)
- Right: Checked lesson LS-045235, attendance and allocations before any write.
- Right: Final snippet re-read the new invoice, allocations, November ledger and attendance to confirm the state.
- Right: No write was repeated, unlike the tool-calling run.
- Mistake: First turn sent two `run_code` calls that both fetched INV-06372.
- Mistake: Message 9: the reasoning said it would create the invoice but the code only listed ledger entries with `type='invoice'`, costing one request.

### large-record_payment-1

**Tool calling: failed.** Found client CL-0294 and her ten unpaid invoices, then called `final_result` with an empty summary without ever calling `record_payment`. Failed with no changes made. ($0.0026, 5 requests, 8 s)
- Right: Converted £501.26 to 50126 and found the right client and unpaid invoices in due-date order.
- Right: Its last reasoning correctly noted that it needed existing allocations before splitting the payment.
- Mistake: Messages 3 and 5 repeated the same `search_clients` and `get_settings` pair three times in a row.
- Mistake: Message 9: the reasoning ended "Let me check allocations for this client", but the call emitted was `final_result` with `{"summary": ""}`. It should have called `list_allocations(client_id="CL-0294")`, found 21152 already on INV-02840, and recorded 50126 with 37626 to INV-02840 and 12500 to INV-03247.

**Code mode: passed.** Found 21152 already allocated to INV-02840, computed the split in code and called `record_payment` for 50126 with 37626 to INV-02840 and 12500 to INV-03247. Passed in 9 requests. ($0.0056, 9 requests, 18 s)
- Right: Noticed another payment dated the same day (LE-013542, 56252) and checked the ledger to confirm it was a different payment, not a duplicate of this one.
- Right: Allocated against what was still owed, not invoice totals, oldest due date first.
- Right: Verified the invoice statuses after the write.
- Mistake: First invoice snippet guessed field names `sent_on`/`due_on` and failed; the fields are `date_sent`/`due_date`.
