---
title: "GPT-6 Luna on Pydantic AI - Billing ops"
description: "Questions about and changes to a tutoring agency's books, checked to the penny. Tool calling 40%, code mode 80%; rank 38 of 44."
canonical: https://pydantic.dev/models/list/gpt-6-luna/billing_ops/
---

# GPT-6 Luna on Pydantic AI - Billing ops

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

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time    |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | ------- |
| Tool calling | 40%   | 4 of 10      | $0.043 | 49       | 180        | 3.8 min |
| Code mode    | 80%   | 8 of 10      | $0.034 | 99       | 99         | 6.1 min |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

`gpt-6-luna` passed 12 of 20 runs: 4 of 10 with tool calling and 8 of 10 in code mode. Lookups and the two write tasks passed in both modes. Every audit or aggregation task failed with tool calling, and the "wrong invoices" audit failed in both modes at both sizes. Total cost was $0.043 for tools and $0.034 for code mode.

#### Where it does well

- **Write tasks (4/4).** `large-correction-2` and `large-record_payment-1` used the right order (`update_attendance`, `void_invoice`, `create_invoice`), today's date, and oldest-due-first allocations net of existing ones (37,626 then 12,500).
- **Simple lookups (4/4).** Invoice total and amount owed took 2–4 requests each.
- **Data gathering.** It pages lists fully and issues parallel calls in both modes.
- **Self-correction in code.** In `small-tutor_margin-3` it spotted that its first result (76,533) skipped tutor pay for lessons with no charged student, and fixed it to 65,045.

#### Mistakes it makes

- **Stops after a sample (3 tools runs).** On the large audits it opened 1, 11 and 4 of 384 invoices, then answered; two answers were an empty list.
- **Sums by hand (3 tools runs).** Both margin questions were answered with no working after the data was fetched: 118,416 vs 120,741, and 76,545 vs 65,045. `small-wrong_invoices-1` dropped INV-00172 after re-fetching its lesson.
- **Audit code with gaps (2 code runs).** The line-by-line price check never looks for repeated lines, and in the large run it also ignored `missed` students. It printed 3,105 keys for 3,108 lines and did not follow that up.
- **Sandbox limits.** It hit the 100-nested-call limit 9 times across three large runs; `large-wrong_invoices-1` took 31 requests.

#### Tool calling compared with code mode

Code mode passed everything tools passed, plus the two margin questions and the duplicate-line and missed-student audits. The gain comes from doing arithmetic and matching in Python instead of by hand, and from fetching all 384 invoices in batches rather than sampling. Code mode needed more requests on large cases (12, 17, 31 vs 4, 7, 5) but was cheaper overall because results stayed in the sandbox. On the two small lookups it brought no benefit, and `small-invoice_total-1` was sloppier: an unfiltered `list_invoices` instead of `get_invoice`.

## Runs

### small-invoice_total-1

**Tool calling: passed.** One `get_invoice(INV-00084)` call and read `total` 89700. Passed in 2 requests. ($0.0005, 2 requests, 2 s)
- Right: Shortest possible path

**Code mode: passed.** Called `list_invoices(page=1)` with no filter and read INV-00084's total, 89700, off the page. Passed in 2 requests. ($0.0012, 2 requests, 3 s)
- Right: Correct answer
- Mistake: Used an unfiltered list instead of `get_invoice(INV-00084)`; it worked because the invoice was on page 1, and the 15,000-character response made this cost $0.0012 against $0.0005 in tools mode

### small-owed_on_invoices-1

**Tool calling: passed.** `search_clients`, `list_invoices(status=unpaid)`, `list_allocations`, then 39,452 + 49,315 − 3,563 = 85204. Passed in 4 requests. ($0.0006, 4 requests, 5 s)
- Right: Subtracted the 3,563 credit allocation on `INV-00155` instead of summing invoice totals

**Code mode: passed.** Three one-call snippets (`search_clients`, `list_invoices`, `list_allocations`), then answered 85204. Passed in 4 requests. ($0.0004, 4 requests, 8 s)
- Right: Correct net of the 3,563 allocation
- Mistake: Used `run_code` as a plain tool caller and did the subtraction itself; no gain from code mode here

### large-tutor_margin-3

**Tool calling: failed.** Gathered 75 lessons, their attendance, settings and 16 clients, then answered 118416 with no visible working. Failed; expected 120741 (2,325 too low). ($0.0037, 5 requests, 28 s)
- Right: Data gathering was complete and efficient: one `list_attendance` call for all 75 lesson ids, 16 `get_client` calls in parallel
- Mistake: Final request: summed about 74 charged lines and 67 tutor payments without a calculator, with gross/net and split rules in play; the code-mode run on the same data got 120741

**Code mode: passed.** Fetched lessons, attendance and clients, then computed net revenue 360,316 less tutor pay 239,575 = 120741. Passed in 6 requests. ($0.0028, 6 requests, 29 s)
- Right: Integer half-up rounding with `(2*n+d)//(2*d)`
- Right: Paid the tutor for every billable lesson, including ones with no charged student, on the first attempt

### small-tutor_margin-3

**Tool calling: failed.** Fetched 39 lessons, attendance, settings and 7 clients, then answered 76545 with no visible working. Failed; expected 65045. ($0.0022, 5 requests, 20 s)
- Right: Complete data in 4 requests, with attendance and settings in parallel
- Mistake: Final request: the answer is 11,500 too high. The code-mode run got 76533 when it skipped tutor pay for the four billable lessons where the only student was `missed` (LS-001419, LS-001445, LS-001491, LS-001541, 11,488p), so this run most likely left out the same pay, plus a 12p slip
- Mistake: The handbook says the tutor is paid for each billable lesson however many students were charged

**Code mode: passed.** First calculation gave 76,533 by skipping lessons with no charged student; it noticed, recomputed tutor pay for all 37 billable lessons and answered 65045. Passed in 8 requests. ($0.0026, 8 requests, 37 s)
- Right: Caught its own mistake: the first snippet used `continue` before adding tutor pay, the second added pay first and listed the four affected lessons
- Mistake: One request spent only on printing the 7 client ids

### large-duplicate_lines-1

**Tool calling: failed.** Listed all 4 pages of October invoices (394), opened only `INV-05761`, then answered `{"ids": []}`. Failed; expected INV-06060, INV-06073, INV-06097. ($0.0047, 4 requests, 24 s)
- Right: Paged `list_invoices(sent_from=2026-10-01, sent_to=2026-10-31)` fully, pages 2-4 in parallel
- Mistake: Third request: called `get_invoice` for one invoice out of 384 non-void ones, then stopped
- Mistake: Final request: returned an empty list as if every invoice had been checked; it should have fetched the lines of every invoice and looked for repeated `(lesson_id, student_id)` pairs

**Code mode: passed.** Fetched all 384 non-void invoices in batches and counted `(student_id, lesson_id)` pairs per invoice with `Counter`. Passed in 12 requests. ($0.0029, 12 requests, 33 s)
- Right: Excluded the 10 void invoices before fetching
- Right: Duplicate check is a few lines of code and exact
- Mistake: Fifth request: put two 100-call `gather` batches in one snippet and hit `Code mode allows 100 nested tool calls per run_code call`
- Mistake: Sixth request: `'batch2' in globals()` failed in the sandbox; two requests spent finding out that `batch2` had survived

### large-missed_billed-1

**Tool calling: failed.** Listed the 394 October invoices and all September lessons, but fetched lines for only 11 invoices (`INV-05761` and `INV-06145`..`INV-06154`) and returned `{"ids": []}`. Failed; expected INV-05821, INV-05846, INV-06080. ($0.012, 7 requests, 41 s)
- Right: Paged invoices fully and knew attendance had to be compared with invoice lines (`list_attendance` on the lesson ids of the invoices it did open)
- Mistake: Fourth request: four pages of `list_lessons(2026-09-01..2026-09-30)` cost context and gave nothing the invoice lines did not
- Mistake: Fifth request: `get_invoice` for only the last 10 invoices in the list, leaving about 373 unchecked
- Mistake: Final request: answered empty rather than continuing through the rest; the most expensive tools run at $0.0121

**Code mode: passed.** Fetched 384 invoices (3,108 lines) and attendance for 2,655 lessons, then matched lines to `missed` attendance. Passed in 17 requests. ($0.0048, 17 requests, 43 s)
- Right: Lookup keyed on `(lesson_id, student_id)` gave exactly the three invoices
- Right: 27 `list_attendance` batches of 100 ids in one snippet
- Mistake: Fourth and sixth requests: hit the 100-nested-call limit twice by looping batches of 90 and 40 in one snippet
- Mistake: Then fetched invoices 40 at a time in six separate requests, where batches of 100 would have needed four

### large-wrong_invoices-1

**Tool calling: failed.** Listed the 394 invoices, then opened only four (`INV-05851`, `INV-06016`, `INV-06105`, `INV-06148`) and three clients, returning the 3 invoices where a non-taxable client was taxed. Failed; 3 of 12 found. ($0.0049, 5 requests, 27 s)
- Right: The three rows it returned have the right amounts (1050, 1150, 1875)
- Right: Confirmed `is_taxable` false with `get_client` before reporting
- Mistake: Third request: picked candidates from invoice headers only (tax that did not fit net), so it could only find tax errors
- Mistake: Never called `get_lessons` or `list_attendance`, so wrong rates (INV-05791, INV-05877, INV-06017), missed students (INV-05821, INV-05846, INV-06080) and duplicate lines (INV-06060, INV-06073, INV-06097) were all out of reach

**Code mode: failed.** Fetched all invoices, lessons and attendance, but its price check only caught wrong rates and wrong tax. Returned 6 of 12 invoices after 31 requests and $0.0131. Failed. ($0.013, 31 requests, 2.4 min)
- Right: All six returned rows have the right amounts
- Right: Found the three wrong-rate invoices (INV-05791, INV-05877, INV-06017) that the tools run could not see
- Mistake: `cost_expect` snippet: computes a cost for every line without checking that the line's student is `attended` or `missed_chargeable`, so the three missed-student invoices pass
- Mistake: Same snippet: keys on `(invoice, lesson_id, student_id)` and printed 3105 keys for 3,108 lines; that gap of 3 is the three duplicate lines, and it was not followed up
- Mistake: Hit the 100-nested-call limit four times, lost 114 clients' data to one failed batch and had to refetch them, and wrote one syntax error and one unsupported `next(generator)`

### small-wrong_invoices-1

**Tool calling: failed.** Opened all 37 invoices, the clients, lessons and attendance over 7 requests and returned INV-00158, INV-00162 and INV-00176. Failed; INV-00172 (600) is missing. ($0.011, 7 requests, 60 s)
- Right: Covered every invoice, unlike the large version
- Right: Found three different kinds of error with the right amounts (4050, 863, 6000)
- Mistake: Sixth request: re-fetched `LS-001295` (the INV-00172 lesson, billed 7800 against 7200 correct) with `get_lessons` and `list_attendance`, then still left the invoice out
- Mistake: Fourth and fifth requests: over 5,000 characters of hand-typed lesson ids per message for `list_attendance`; $0.0113 in all

**Code mode: failed.** Recomputed every line of the 37 invoices and returned INV-00162, INV-00172 and INV-00176. Failed; INV-00158 (4050) is missing. ($0.0044, 9 requests, 40 s)
- Right: Found INV-00172 (7800 billed, 7200 correct), which the tools run missed
- Right: Treated a line for a non-charged student as cost 0, which caught INV-00176
- Mistake: Audit snippets compare each line with its own expected cost, so a line that is repeated but priced correctly never differs; INV-00158, which the tools run found, slipped through, and it needed a check for repeated `(lesson_id, student_id)` pairs
- Mistake: One runtime error from `next()` on a generator, which the sandbox does not support

### large-correction-2

**Tool calling: passed.** Looked up the client, invoice and that day's lessons in one parallel step, then ran `update_attendance`, `void_invoice` and `create_invoice` in order. Passed in 5 requests. ($0.0018, 5 requests, 11 s)
- Right: Correct order: `update_attendance(LS-045235, ST-0332, missed)` before `void_invoice(INV-06372, date=2026-11-13)`, then `create_invoice` with the three remaining lessons
- Right: All changes dated today; summary reports INV-06548 for 17,100p, paid from the released credit
- Mistake: First step: `list_lessons(start=2026-10-07, end=2026-10-07)` with no filter was unnecessary, since `get_invoice` already gave the lesson id

**Code mode: passed.** Same sequence as tools: `update_attendance` and `void_invoice` in one snippet, then `create_invoice` for the three remaining lessons. Passed in 5 requests at $0.0008. ($0.0008, 5 requests, 18 s)
- Right: Used `asyncio.gather` for `get_client` and `get_invoice`
- Right: Correct order and dates; summary names INV-06548, 17,100p, due 27 November, paid

### large-record_payment-1

**Tool calling: passed.** Found the client, listed unpaid invoices and allocations, then called `record_payment` with 37,626 to `INV-02840` and 12,500 to `INV-03247`. Passed in 5 requests. ($0.0010, 5 requests, 11 s)
- Right: Subtracted the existing 21,152 allocation on `INV-02840` (58,778 total) to get 37,626 outstanding
- Right: Allocated oldest due date first and dated the payment 2026-11-13

**Code mode: passed.** Computed outstanding amounts in code, skipping released allocations, and called `record_payment` with 37,626 and 12,500. Passed in 5 requests. ($0.0012, 5 requests, 13 s)
- Right: Allocation code sorts by `due_date` and checks `released_on is None`, so it follows the handbook rather than relying on list order
