To calculate the cost of AI routing in support, divide OpenAI API expenses by the number of unique cases the model successfully routed to the queue. Include calls for cases that were ultimately handed off to an agent in the expense total as well. If you count only successful calls, retries will drop out of the calculation and automation will appear cheaper than it is.
This guide is for a team that already uses the Responses API for text classification. Using one project as an example, we show how to match attempts to cases, reconcile the total with OpenAI Spend, and understand where the discrepancy comes from. Documentation and pricing were verified on November 26, 2026.
1. Prepare data for one UTC day
Take the previous day and the OpenAI project that handles case routing only. Use a half-open interval from 00:00 UTC inclusive to 00:00 UTC on the next day. If the support report is built in local time, first convert event timestamps to UTC. The ticket creation time and the model call time may fall on different days.
For a training reconciliation, choose a day in which all attempts and final routes for the cases in question fit within the interval. For an operational metric over a period with carryover cases, it is better to maintain two reports. The first reconciles spend by call date. The second calculates the cost of a case cohort by intake date and includes attempts from subsequent days up to a preselected cutoff. You cannot directly divide one day's Spend total by the results of such a cohort.
| Data | What to keep | Why |
|---|---|---|
| Model calls | Internal attempt ID, case ID, UTC timestamp, project, model, actual service mode, status, usage and x-request-id if received |
Link calls to the route and identify a retry |
| Routing outcome | Case ID, outcome time, queue, routing decision | Count each successfully assigned case once |
| Expenses | A Cost data export for the same project and period, preferably broken out by line item | Reconcile the calculation with vendor charges |
Store operational IDs and counters without conversation text. A single case may have multiple separate requests. Remove a duplicate record of the same event by attempt ID. A new network call after a timeout gets its own attempt ID. The response header x-request-id is useful for troubleshooting a specific request with the vendor. If there is no response, save the status and any available IDs, and mark usage as unknown. OpenAI request ID reference
Step result. Two calls for one case will have one case ID and two attempt IDs. Each case has one final routing outcome or an explicit waiting status.
2. Calculate costs for each call using usage
For a text request without paid tools, use input_tokens, input_tokens_details.cached_tokens, input_tokens_details.cache_write_tokens if the model reports a cache write, and output_tokens. Reading and writing tokens are part of total input. Subtract both categories to get standard input. Reasoning tokens are included in output, so for output cost, output_tokensis sufficient. Responses API fields, caching guide, reasoning token accounting
In the formula, multiply standard input, cache read, cache write, and output by the corresponding rates per million tokens. If a record has different rates for 30 minutes and 12 hours, calculate those two parts separately. Add the products and divide by one million. Use zero for a field when the counter is zero or when the model documentation states that there is no separate billable field in the selected mode. If the required breakdown is missing, mark the row as incomplete. Verify the rate by model, mode, context length, and project terms as of the call date. OpenAI pricing table
In the training example, we use the published rates for gpt-6.2-sol in Standard with short context and no surcharges. As of the reconciliation date, standard input costs $2, cache read costs $0.10, 30-minute write costs $2.50, and output costs $10 per million tokens in the relevant category. All calls and outcomes in the table are fictional. The two A calls belong to one case.
| Attempt | Total input | Read | 30-min write | Output | Calculation, USD | Outcome |
|---|---|---|---|---|---|---|
| A-1 | 2,000 | 0 | 1,536 | 100 | 0.005768 | Retry |
| A-2 | 2,200 | 1,536 | 0 | 80 | 0.0022816 | Route accepted |
| B-1 | 1,800 | 1,536 | 0 | 70 | 0.0013816 | Route accepted |
| C-1 | 1,800 | 1,536 | 0 | 45 | 0.0011316 | Operator |
| D-1 | — | — | — | — | unknown | Timeout, operator |
For A-1, the standard input is 464 tokens. The row calculation is (464 × 2 + 1536 × 2,50 + 100 × 10) / 1 000 000, which is $0.005768. Across four rows with full counters, the total comes to $0.0105628. We checked the arithmetic in this table locally in Python using decimal numbers. No requests were sent to OpenAI, and the account data in the next step serves as a training example.
Step result. There is a sum of known calls and a separate counter for rows with unknown cost. Keep fractional precision until after summing, especially if the cost of each request is less than a cent.
3. Compare the daily total with OpenAI Spend
Open the following in the dashboard: Analytics → Spend for the selected project. To export data, use Cost data, and to analyze activity by models and keys, use Activity data. Check the filters and UTC boundaries. OpenAI documentation warns that the available Usage and Spend filters differ. For automatic export, call with the organization admin key GET /v1/organization/costs: set start_time and end_time in Unix seconds, the filter project_ids and, if needed, the grouping line_item. If the API returns the next page, process that as well. Sum amount.value only within a single amount.currency. Spend documentation, Costs API reference
Suppose Spend shows $0.0115628. The remainder will be $0.001. You cannot derive the price of D-1 from this difference: the consolidated expense row is not tied to the request ID. Check whether the organization, project, time, and currency match, whether all attempts were included in the export, and whether mode pricing, cache writes, and paid tools were accounted for. If another scenario is running in the project, the project expense will be shared. Until both scenarios are separated using the available data, the cost of routing specifically from the total cannot be determined.
For the diagnostic section, LLM call and outcome monitoring breakdown. For comparison with a model whose input length changes, useful tokenization and cost relationship analysis.
Step result. Keep the charge, the sum of known attempts, the difference, and the number of attempts without full counters together. For monthly reconciliation with the invoice, use the documented export and the rules for matching its line items. OpenAI help on monthly export
4. Calculate the cost of the accepted route
First, define a criterion that can be verified in the ticketing system. For example, the model selected an allowed queue, the assignment passed local rules, and it was saved without manual correction during the specified review window. The technical status completed by itself does not confirm this result. If routing correctness is checked only on a sample, calculate the selected operational metric and the sample accuracy separately.
In the training example, the route was accepted for A and B. A had two calls, but in the denominator that is one case. C and D were sent to manual handling. The denominator is two, and automation coverage is two out of four cases, or 50%. If all of the isolated project's expense relates to these four cases, the cost of the accepted route by Spend is $0.0115628 ÷ 2 = $0.0057814. Operator time, integration support, and infrastructure outside OpenAI are not included in this figure.
Before passing along the number, check three cases:
- If there are expenses and no accepted routes, show the total, the number of cases, and the value "undefined" for the route cost.
- If one call selects a queue for multiple cases at once, preserve the links to all IDs. Count the call once and count accepted routes by unique cases.
- If you are comparing two models, use the same definition of accepted route and show the manual handling share alongside it. Otherwise, a lower cost may come with lower coverage.
How to connect costs with support queues
Vladimir Lomtev's AI Studio helps break down the routing scenario, link call events to the final queues, and prepare a pilot cost reconciliation. For the first discussion, it is enough to describe one queue, the source of events, and the rule by which a route is considered accepted. Discuss the task
What to pass on to support leadership
Prepare one row per project and UTC window. Here is the header for a tab-delimited export.
project_id start_utc end_utc currency spend known_attempt_cost difference unknown_attempts tickets accepted_routes cost_per_accepted_route auto_route_share
Look at the cost of the accepted route together with the share of automated routing. For example, after a retry rule change, the first number may go down, while the second shows that more cases are now going to operators.



