Skyline Nexus ERP Skyline Nexus ERP
AI and automation

Automate accounting with the Claude API

A build guide for finance developers: models, tool use, structured journal drafts, PDF invoices, caching, batches for month-end, costs and the approval gate.

Last reviewed 14 min

What automating accounting with the Claude API means

Automating accounting with the Claude API means writing software that sends finance documents and data to Claude, receives structured proposals such as coded invoices, journal drafts or variance notes, validates them in code and routes them to a person for approval before anything reaches the ledger. It matters because the API, unlike a chat window, runs the same checked procedure on thousands of items every month.

This guide is for finance-operations developers and technically minded controllers. It describes requests in words rather than code, names the API parameters plainly, and states every Anthropic model name, price and limit as of September 2026 from Anthropic's documentation. Check those pages again before you budget or build, because models and prices change.

One design rule runs through every section: Claude proposes, your code validates, a person approves, and the ERP remains the system of record. The model never holds posting rights.

The architecture of a safe automation

Most accounting automations share the same six parts. Keeping them separate is what makes the system auditable, because each part can be tested and logged on its own.

  • Intake: documents and data arrive from a mailbox, an upload folder or an ERP export, each with a stable identifier.
  • Context: the chart of accounts, tax codes, posting policy and supplier master data, prepared as text your code controls.
  • Model call: a Messages API request that returns either a tool call or a schema-constrained JSON proposal.
  • Validation: deterministic code that checks arithmetic, account codes, tax rates, periods and duplicates.
  • Approval queue: a screen where a person accepts, edits or rejects each proposal, with the source document beside it.
  • Posting and log: approved items are entered in the ERP by the approver or through its API, and every step is written to an append-only log.

Choosing a Claude model (as of September 2026)

Anthropic's models overview lists four current models. Claude Opus 5.5 (model ID claude-opus-5-5) is the recommended starting point for most workloads, at USD 4 per million input tokens and USD 20 per million output tokens. Claude Sonnet 5 (claude-sonnet-5) costs USD 2 and USD 10 and is described as the best combination of speed and intelligence. Claude Haiku 4.5 (model ID claude-haiku-4-5-20251001, alias claude-haiku-4-5) costs USD 1 and USD 5 and is described as the fastest. Claude Fable 5.1 (claude-fable-5-1), at USD 10 and USD 50, is aimed at demanding reasoning and long-horizon agentic work. Claude Fable 5.1, Claude Opus 5.5 and Claude Sonnet 5 have a 1 million token context window; Claude Haiku 4.5 has 200,000.

A practical split for finance work: Claude Haiku 4.5 for high-volume extraction, classification and screening; Claude Sonnet 5 as the default for coding, matching and drafting; Claude Opus 5.5 for judgement-heavy review such as accrual reasonableness or unusual transactions. Anthropic states that every Claude model ID is a pinned snapshot, which is what you want for a controlled process: behaviour changes only when you change the ID and re-run your tests. For Claude Haiku 4.5 use the dated ID, because for models before the 4.6 generation the alias is only a pointer.

Two details affect planning. Anthropic lists Claude Haiku 4.5's retirement as not sooner than 15 October 2026, so check the deprecations page before building on it. And Claude 4.7 and later models use a tokenizer that produces roughly 30 percent more tokens for the same text than earlier models, so measure token counts on your own documents rather than reusing old estimates.

The request and the tool use loop

A Messages API request for accounting work usually carries a small set of fields. Anthropic calls the ability to call your functions tool use: you describe each tool with a name, a description and an input_schema, Claude decides when to call it, and the response stops with stop_reason set to tool_use and a tool_use block holding the arguments. Your code runs the function and sends the answer back in a tool_result block with the matching tool_use_id, and Claude continues. Adding strict set to true to a tool definition makes Claude's tool inputs match your schema exactly.

  • model: for example claude-sonnet-5.
  • max_tokens: the ceiling on the length of the reply.
  • system: the stable instructions, posting policy and chart of accounts.
  • messages: the document or data for this item, and any earlier turns.
  • tools: read tools such as find_supplier, get_open_purchase_orders and get_account_list.
  • One draft tool, such as propose_journal, that only stores a proposal in your approval queue.
  • No tool that posts, pays or changes master data; those actions stay with people in the ERP.
  • output_config: a JSON schema when you want a structured answer instead of a tool call.

Structured outputs for journal drafts

Structured outputs constrain Claude's reply to a JSON schema you supply in output_config.format with type json_schema. As of September 2026 Anthropic lists the feature as generally available and states that responses are always valid against the schema, with required fields present and correct types. A journal draft schema might hold the entry date, a description, the source document reference, a list of lines each with account code, debit, credit, tax code and cost centre, a confidence note and a list of assumptions.

Schema validity is not accounting validity. The documentation lists numerical constraints such as minimum and maximum as unsupported, so the schema cannot enforce that debits equal credits, that an account code exists or that a period is open. Your validator must check that total debits equal total credits, that every account is a postable account in your chart, that tax arithmetic reconciles to the document, that the date falls in an open period and that the document has not been processed before. Anything that fails goes to a person with the reason attached.

One restriction shapes the design: citations and structured outputs cannot be used in the same request, and the API returns an error if you combine them. Where you need page-level evidence for each extracted figure, run an extraction request with citations first, then a second request that turns the cited facts into the structured journal draft.

PDF input for supplier invoices

Claude reads PDFs sent as a document content block, by URL, as base64 data or as a file_id from the Files API. As of September 2026 the limits are 32 MB per request and 600 pages per request, or 100 pages when the request's context window is under 1 million tokens. Each page is converted into an image and its text is extracted alongside, so Claude sees tables and stamps as well as text; Anthropic estimates 1,500 to 3,000 text tokens per page plus the image tokens. Spreadsheets such as xlsx are not accepted in document blocks and should be converted to plain text, such as CSV, first.

The Files API lets you upload once and reference a file_id, up to 500 MB per file. Anthropic warns that uploaded files are visible to the whole workspace and that you should never accept a file_id from an end user; for several clients, use a workspace per client.

Worked example. A supplier invoice shows net EUR 2,400, VAT at 19 percent EUR 456 and a total of EUR 2,856. Claude returns a draft: Dr Consumables 2,400 / Dr Input VAT 456 / Cr Trade payables 2,856. On a second invoice the model reads the VAT as 465, a transposition. The validator recomputes 2,400 plus 465 as 2,865, which does not equal the printed total of 2,856, and also finds that 465 is not 19 percent of 2,400, so the draft goes to the review queue marked VAT mismatch. The reviewer opens the PDF, confirms 456, corrects the draft and approves it. Invoices that pass every check still reach the approval queue; the reviewer inspects a sample and approves them in bulk.

Prompt caching for the chart of accounts

Every request in a coding pipeline repeats the same long prefix: tool definitions, posting policy and the chart of accounts. Prompt caching stores that prefix so later requests read it at a fraction of the price. As of September 2026, a 5-minute cache write costs 1.25 times the base input price, a 1-hour write costs 2 times, and a cache read costs 0.1 times, or 0.05 times on Claude Opus 5.5. Caching pays for itself after one read on the 5-minute cache.

The cache follows a fixed order, tools then system then messages, and a change at one level invalidates everything after it. Put the chart of accounts and policy in the system prompt, keep them byte-identical between requests, sort accounts in a fixed order, and put the per-invoice document last. The prefix must meet a minimum length, 512 tokens on Claude Opus 5.5, Claude Sonnet 5 and Claude Haiku 4.5; a shorter prefix is simply not cached, without an error. You can place up to four explicit cache breakpoints, or add a single top-level cache_control field for automatic caching, and the usage fields cache_creation_input_tokens and cache_read_input_tokens show whether caching worked.

How to automate month-end close with Message Batches

Much month-end work does not need an answer in seconds: coding a backlog of bank lines, drafting commentary for every account with a large movement, or reviewing every open purchase order for accrual. The Message Batches API processes these asynchronously at a 50 percent discount on input and output tokens. As of September 2026 a batch can hold up to 100,000 requests or 256 MB, most batches finish within an hour, a batch expires if processing is not complete within 24 hours, and results remain available for 29 days. Each request carries a custom_id so you can match results back to your items.

A workable close pipeline runs on working day one: export the trial balance, the ledger detail and open purchase orders; submit a batch of variance-commentary and accrual-review requests; validate the results overnight; and present the controller with a queue sorted by amount. The controller signs off the accruals in the ERP, and the commentary goes into the close pack after review. Any time the automation saves comes from drafting, never from removing sign-off.

Estimating the cost with dated list prices

Prices below are Anthropic's API list prices in US dollars as of September 2026, before any negotiated discount, tax or data-residency multiplier. Assume 2,000 supplier invoices a month, two pages each. Measured with token counting, say each page uses about 3,500 input tokens including the page image, so 7,000 tokens per invoice, plus a 6,000-token prefix of instructions and chart of accounts, giving 13,000 input tokens and about 600 output tokens per invoice. The month totals 26 million input tokens and 1.2 million output tokens.

On Claude Sonnet 5 at standard prices the month costs 26 times USD 2, which is USD 52, plus 1.2 times USD 10, which is USD 12: USD 64 in total. Run as a batch at USD 1 and USD 5 per million, the same work costs USD 26 plus USD 6, or USD 32. Run synchronously with the 6,000-token prefix cached, the 12 million prefix tokens are read at USD 0.20 per million, or USD 2.40, the 14 million document tokens cost USD 28 and the output USD 12, about USD 42.40 before a few small cache writes. On Claude Haiku 4.5 in a batch the month costs USD 13 plus USD 3, or USD 16; on Claude Opus 5.5 in a batch, USD 52 plus USD 12, or USD 64.

Tool definitions add a small fixed overhead, 354 system tokens per request on Claude Sonnet 5 when tools are present and tool_choice is auto. The model bill is rarely the largest cost; the reviewer's time is. Design the queue so that clean items are approved in bulk and attention goes to exceptions.

Approval gate, logging, security and data protection

The approval gate is the control that makes the automation acceptable to an auditor. The approver should not be the developer who maintains the prompts, approvals above a threshold should need a second person, and the ERP should record who approved each entry. Log every model call with the request identifier, model ID, prompt version, a hash of the input document, the raw output, the validator result, the approver and the timestamps. Keep the log for as long as the accounting records it supports.

Supplier documents are untrusted input. A PDF can carry hidden text such as an instruction to change the payee's bank account. Anthropic's guidance on prompt injection is to deliver third-party content in tool results rather than in the system prompt, to tell Claude in the system prompt that such content is data and never instructions, to JSON-encode untrusted strings, to screen tool outputs with a small classifier call on Claude Haiku 4.5, and to apply least privilege. In accounting terms: no tool that changes supplier bank details, and every bank-detail change verified by a call to a known contact.

On data use, Anthropic states for the API that retained data is never used for model training without express permission and that conversation content is not retained by default, except for covered models, which as of September 2026 include Claude Fable 5.1 and require 30-day retention. Batches keep data for 29 days and Files API files persist until deleted, and neither is eligible for zero data retention. For GDPR, identify the lawful basis, put processor terms in place, assess international transfers and send only the fields the task needs. The API is global by default; the first-party residency option priced on Anthropic's page is US-only inference at 1.1 times the standard price, and cloud platforms offer regional endpoints at their own prices.

Testing with a golden set before go-live

Before any automation touches live work, build a golden set: 200 to 500 historical items with the answer your team actually posted, including the awkward cases such as credit notes, mixed VAT rates, foreign-currency invoices, duplicates and prepayments. Run the pipeline over the set, compare every field, and measure where it disagrees. Record the results against the model ID and prompt version, and re-run the set whenever either changes.

Set acceptance rules in advance, such as zero unbalanced drafts reaching the queue and every VAT mismatch caught by validation, and have the finance lead sign the test result. Then run in shadow mode for one close, where proposals are produced but people still process manually, and compare. Only then switch the queue on for real work.

Connecting the automation to Skyline Nexus ERP

Skyline Nexus ERP offers a REST API, secured with OAuth tokens, that covers operational data such as business locations, contacts, products, tax rates, sales and sales returns, and expenses, which is enough for a pipeline to read master data and match documents. A general-ledger API, and Claude drafting journals, bills and bank matches for human approval inside the product, are being rolled out on the Skyline Nexus ERP roadmap; ask us for your go-live date. Until then, an approver keys each approved journal through New Journal Entry, where, with journal approval switched on, Save and Submit sends entries at or above the approval threshold to an approver before posting.

For questions rather than automation, Skyline Nexus ERP already runs an AI help assistant in the app and an MCP server that Claude Desktop connects to with a personal token issued by an administrator, returning help answers and eight permission-checked live business figures.

Common questions

How do you automate month-end close with AI?

Automating month-end close with AI works best for drafting and review, not posting. Export the trial balance, ledger detail and open orders, send variance-commentary and accrual-review requests to Claude through the Message Batches API at half price, validate the results in code, and give the controller a queue to approve in the ERP. Month-end close automation removes drafting time while keeping sign-off.

Which Claude model is best for accounting automation?

The Claude model for accounting automation depends on the task. As of September 2026, Claude Haiku 4.5 suits high-volume extraction and classification, Claude Sonnet 5 suits most coding and matching, and Claude Opus 5.5 suits judgement-heavy review. Test each Claude model against a golden set of your own historical transactions before choosing.

Can the Claude API read PDF invoices?

The Claude API reads PDF invoices sent as document blocks, by URL, base64 or Files API reference. As of September 2026 the limits are 32 MB and 600 pages per request, or 100 pages below a 1 million token context. Claude API extraction still needs validation: recompute net plus VAT against the total and check the supplier and period.

How much does it cost to process invoices with the Claude API?

Processing 2,000 two-page invoices a month with the Claude API costs roughly USD 32 on Claude Sonnet 5 through Message Batches, using September 2026 list prices and about 13,000 input and 600 output tokens per invoice. Claude API costs vary with page density, so measure your own documents with token counting before budgeting.

How is the Claude API used in accounting software?

The Claude API is used in accounting software to read documents and data and return structured proposals: coded supplier invoices, journal drafts, bank-match suggestions and variance notes. In Claude API accounting pipelines, code then checks that debits equal credits and that accounts, tax and periods are valid, and a person approves each entry in the ERP, which stays the system of record.

Is data sent to the Claude API used for training?

Data sent to the Claude API is not used for model training without express permission, according to Anthropic's API data retention page as of September 2026. Conversation content is not retained by default except for certain covered models, while Message Batches and the Files API store data for their own documented periods. Claude API users still need GDPR processor terms.

What is prompt caching and why does it help accounting pipelines?

Prompt caching stores a repeated request prefix, such as the chart of accounts and posting policy, so later requests read it at 10 percent of the input price, or 5 percent on Claude Opus 5.5, as of September 2026. Prompt caching suits accounting pipelines because thousands of requests share the same instructions.

This guide is general information, not tax, accounting or legal advice. Rules differ from country to country and change over time; confirm the current position with your tax authority or a qualified adviser before acting on anything here.

Ready to run your operation on a single workspace?

Talk to us about your business

Tell us what you run and we will come back with a straight answer about fit, timeline and price.

No card, no obligation. We reply within one business day.