---
title: "DeepSeek V4 Flash 0423 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 70%; rank 31 of 44."
canonical: https://pydantic.dev/models/list/deepseek-v4-flash/billing_ops/
---

# DeepSeek V4 Flash 0423 on Pydantic AI - Billing ops

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

| Mode         | Score | Tasks passed | Cost   | Requests | Tool calls | Time     |
| ------------ | ----- | ------------ | ------ | -------- | ---------- | -------- |
| Tool calling | 60%   | 6 of 10      | $0.29  | 163      | 680        | 15.4 min |
| Code mode    | 70%   | 7 of 10      | $0.080 | 185      | 186        | 9.7 min  |

Each task was run once per mode.

## Review

Written by an LLM from the runs' transcripts.

#### Overall

deepseek-v4-flash passed 13 of 20 runs: 6 of 10 in tools mode and 7 of 10 in code mode. The change tasks (correction, record payment) and the simple lookups (invoice total, amount owed) passed in both modes. All the failures were analysis tasks over many records: tutor margin, wrong invoices and missed-but-billed.

#### Where it does well

- **Changes to the books:** all 4 change runs matched the expected diff exactly. That includes the multi-step void → credit note → re-invoice → pay-from-released-credit sequence in `large-correction-2`, and allocating payments oldest due date first.
- **Rounding:** half-up rounding of split shares, tutor pay (1687.5 → 1688) and gross tax extraction were right in every margin run.
- **Cost:** most runs cost well under $0.01.

#### Mistakes it makes

- **Ignoring `is_taxable` (3 failures).** Three of the four tutor-margin runs never called `get_client`, so tax came out of gross lessons for non-taxable clients. In `small-tutor_margin-3` (tools) the answer was short by 4 × 917 = 3668. In `large-tutor_margin-3` both modes gave the same wrong 116741. The only margin run that fetched clients passed.
- **Incomplete coverage and giving up (2 failures in tools mode).** In `large-missed_billed-1` it checked attendance on guessed runs of consecutive lesson IDs and found 1 of the 3 invoices. In `large-wrong_invoices-1` it checked invoices by hand, assumed 3 charged students on a split lesson that had 2 (which created false positives on INV-05890 and INV-06015), and handed over 'what I've found so far'. It got 3 of 12 rows right.
- **Too narrow a check (1 failure).** In `small-wrong_invoices-1` (code mode) it recomputed each line on its own, so a duplicated line where both copies were correct went unnoticed.
- **Budget (1 failure).** In `large-wrong_invoices-1` (code mode) it fetched clients piecemeal and then fetched them all again, and hit the 60-request limit without answering.

#### Tool calling compared with code mode

Code mode did better on the large scans. It solved `large-missed_billed-1` with a systematic join, and it did `large-duplicate_lines-1` for $0.0058 against $0.1288 in tools mode. It also passed `small-tutor_margin-3`, though that came from checking clients, not from the mode itself. The model does not use code mode efficiently: it spreads fetches over many small `run_code` calls, which is what ran out the request budget. Tools mode was better on the small wrong-invoices case, where reading each invoice turned up the duplicate line. Neither mode guarded against the `is_taxable` mistake.

## Runs

### small-invoice_total-1

**Tool calling: passed.** Read the invoice and returned 89700 in 2 requests. Correct. ($0.0006, 2 requests, 3 s)
- Right: Took the shortest possible path

**Code mode: passed.** Returned 89700. Correct, in 3 requests. ($0.0011, 3 requests, 5 s)
- Right: Direct lookup

### small-owed_on_invoices-1

**Tool calling: passed.** Added up each unpaid invoice's total less its live allocations and got 85204. Correct. ($0.0017, 6 requests, 13 s)
- Right: Applied the 'total less allocations' rule correctly

**Code mode: passed.** Returned 85204. Correct. ($0.0013, 7 requests, 10 s)
- Right: Correct outstanding-balance logic

### large-tutor_margin-3

**Tool calling: failed.** Worked out the margin for Chen Mensah's October lessons by hand in its reasoning and got 116741. The expected figure was 120741. ($0.0084, 6 requests, 2.9 min)
- Right: Billable statuses, split rounding, gross tax extraction and tutor pay were all handled correctly
- Mistake: It never called `get_client` and never checked `is_taxable`, so it took tax out of gross lessons for non-taxable clients. The answer was 4000 too low. Both modes gave the same wrong figure
- Mistake: It added up 67 margins by hand in its reasoning, a risky method on top of the rule error

**Code mode: failed.** Worked out the margin in Python and returned 116741, the same wrong figure as tools mode (expected 120741). ($0.0044, 8 requests, 38 s)
- Right: `round_half_up` was right, as were split and gross tax handling and tutor pay
- Mistake: The code never fetched the clients or applied `is_taxable` (neither string appears in the run), so it took tax out of gross lessons for non-taxable clients. Its spot checks at messages 11 and 15 checked the same wrong assumption

### small-tutor_margin-3

**Tool calling: failed.** Worked out Kai Iyer's October margin lesson by lesson in its reasoning and got 61377. The expected figure was 65045. ($0.0035, 5 requests, 46 s)
- Right: Left out the cancelled lessons, still paid the tutor for lessons where the student was `missed`, charged `missed_chargeable` students, and rounded 1687.5 up to 1688
- Mistake: It never fetched the clients to check `is_taxable`. It took 917 of tax out of each of the 4 charged 5500 gross lessons (ST-0059), and 4 × 917 = 3668 is exactly the shortfall

**Code mode: passed.** Fetched each client with `get_client`, applied `is_taxable`, and got 65045. Correct. ($0.011, 12 requests, 2.8 min)
- Right: Unlike the other 3 margin runs, it checked taxability
- Mistake: Took 12 requests for a 37-lesson calculation

### large-duplicate_lines-1

**Tool calling: passed.** Found the three invoices with duplicate lines: INV-06060, INV-06073 and INV-06097. Correct. ($0.13, 43 requests, 3.8 min)
- Right: Correct and complete id list
- Mistake: Took 43 requests of `get_invoice`-style browsing and cost $0.1288, about 22× the code-mode run of the same case ($0.0058)

**Code mode: passed.** Returned the correct three invoice IDs in 15 requests for $0.0058. ($0.0058, 15 requests, 36 s)
- Right: Scanning in code was far cheaper than in tools mode

### large-missed_billed-1

**Tool calling: failed.** Answered only INV-05846 when the expected answer was INV-05821, INV-05846 and INV-06080. It checked attendance in guessed batches of consecutive lesson IDs, not from the lessons on each October invoice. ($0.057, 36 requests, 2.0 min)
- Right: Correctly left out the 10 void invoices
- Right: Correctly matched LS-041761 / ST-0127 (`missed`, but billed) on INV-05846
- Mistake: From message 15 onward it called `list_attendance` on runs of consecutive IDs (e.g. `LS-041884`…`LS-041915`, and later `LS-044743`…`LS-044772`) when it should have collected the lesson_id/student_id of every line on the non-void invoices
- Mistake: At message 71 it stopped with 'based on my extensive checking' even though most invoices had not been checked

**Code mode: passed.** Joined invoice lines to attendance in code and returned all three expected invoices. ($0.012, 30 requests, 74 s)
- Right: Systematic join of lines to attendance, so nothing was skipped (the tools run missed 2 of the 3)
- Mistake: Used 30 requests, a lot for a single join

### large-wrong_invoices-1

**Tool calling: failed.** Returned 6 rows. Only 4 matched the expected 12, and one of those had the wrong amount. It also reported two invoices that were in fact correct, and admitted it was handing over 'what I've found so far'. ($0.060, 30 requests, 2.6 min)
- Right: Correctly found INV-05877 (750), INV-06016 (1150) and INV-06105 (1875), and spotted that tax had been charged to non-taxable clients
- Mistake: On split lesson LS-042142 it assumed 3 charged students (4250/3 = 1417), but the invoice's 2125 means 2 were charged. This gave false overcharges of 708 per line, so INV-05890 and INV-06015 were reported wrongly and INV-05851 came out at 3882 when it should have been 1050
- Mistake: It checked invoices by hand and in part (message 21: 'This is going to take forever'), missing INV-05791, 05821, 05846, 06017, 06060, 06073, 06080 and 06097
- Mistake: It gave up at message 59 without checking every invoice

**Code mode: error.** Hit the 60-request limit before giving any answer. ($0.027, 60 requests, 2.2 min)
- Right: It did collect the invoices and clients in code
- Mistake: It fetched clients in many small `run_code` calls (e.g. message 59: `client_ids_list[200:240]`), then fetched all of them again in batches of 20 at message 99, and was still calling `get_client` for a single client (CL-0004) at message 117. It should have fetched invoices, lessons, attendance and clients once each in a single script and compared every line

### small-wrong_invoices-1

**Tool calling: passed.** Found all four wrong invoices with the correct amounts, including the duplicated line on INV-00158 (4050). ($0.030, 18 requests, 2.4 min)
- Right: Caught all four kinds of error: a duplicate line, tax on a non-taxable client, the wrong rate, and a charged `missed` student

**Code mode: failed.** Returned three of the four wrong invoices and missed INV-00158 (4050). ($0.012, 28 requests, 77 s)
- Right: Its `calculate_line_cost` comparison found INV-00162, 00172 and 00176 with the correct amounts
- Mistake: It only checked each line against a recomputed value (messages 47–53). Both copies of the duplicated LS-001226 line on INV-00158 matched, so the duplicate went unnoticed. It should also have checked for repeated (lesson_id, student_id) pairs or lessons that were already invoiced

### large-correction-2

**Tool calling: passed.** Changed Yara Baker's 7 Oct attendance to `missed`, voided INV-06372 with a credit note, and raised a new invoice (14250 net, 17100 total) that the released credit paid. The diff matched the expected one exactly. ($0.0016, 10 requests, 19 s)
- Right: Did the full void, re-invoice and credit sequence in 10 requests for $0.0016
- Right: The released allocation on INV-06372 carries `released_on` 2026-11-13, and the new invoice was paid from credit

**Code mode: passed.** Made the same correct correction as in tools mode: attendance change, void with credit note, new invoice paid from credit. Matched exactly. ($0.0033, 16 requests, 27 s)
- Right: Correct diff
- Mistake: Took 16 requests where tools mode needed 10, though it cost only $0.0033

### large-record_payment-1

**Tool calling: passed.** Recorded the 50126 payment, which paid off INV-02840 (37626) and put 12500 toward INV-03247, oldest due date first. Matched the expected diff. ($0.0025, 7 requests, 23 s)
- Right: Allocated in the right order, worked out the remaining balance correctly, and needed only 7 requests

**Code mode: passed.** Recorded the payment and allocated it oldest due date first. Correct, in 6 requests. ($0.0016, 6 requests, 14 s)
- Right: Allocations and invoice status were correct
- Mistake: Its summary has a muddled line: 'remaining £0.26 was fully allocated'
