Relay365Multi-model API relay desk
← All desk bulletins
Spend watchEN1 desk reads

Shift note: AI spend assigned to each pull request

An AI coding bill tells you what you spent. It does not tell you what that spending produced. Cost per pull request connects those two things by assigning AI charges to a familiar unit of engineering work: a proposed code change.

You do not need a finance platform to start. A usage export, pull request identifiers, and a spreadsheet can reveal which workflows are economical and which keep consuming budget without reaching review.

Start with the question your PR cost should answer

For a first measurement, ask: how much direct AI spending supports each merged pull request? Use this calculation:

AI cost per merged PR = total AI coding charges for a defined group of work / number of merged PRs in that group.

Keep the numerator and denominator aligned. If you count charges from work started in April, follow those tasks through completion rather than dividing by every PR that happened to merge in April. Otherwise, long-running work can distort the result.

Also track costs for individual PRs. The overall average helps with budgeting; the individual records show where investigation is worthwhile.

Count the attempts that did not make the diff

A coding assistant may read files, propose a change, run tests, encounter an error, and try again. The final diff does not reveal all that activity. Billable usage can include input tokens, generated output, and other charge categories defined by the provider.

  • Include planning, implementation, debugging, and AI review calls associated with the task.
  • Include retries and failed calls whenever the usage records show a charge.
  • Keep abandoned tasks in the total instead of making unsuccessful work disappear.
  • Record shared AI charges separately until you have a reasonable allocation rule.

If a task never produces a PR, give it a task identifier anyway. Its cost still belongs in the workflow total. Otherwise, your merged-PR metric can look better simply because expensive failures were excluded.

Attach a task identifier before opening the PR

Start tracking when the coding session begins, not when the PR opens. Use a ticket number or temporary task ID, then connect it to the PR later.

A minimal record contains the task ID, PR ID when available, model, usage timestamp, billed amount, and outcome. Where your tooling supports it, pass the task identifier through request metadata or retain a local mapping between sessions and tasks. Avoid putting source code or secrets into billing labels.

Prefer recorded charges over estimates reconstructed from token counts. Cached input and other billing categories can have different rates. If you must estimate, preserve the rate information and clearly label the result as estimated.

Read a sample shift total without mistaking it for pricing

Suppose a completed group of tasks incurred $48 in direct AI charges and produced 12 merged PRs. Its AI cost per merged PR is $4. These are illustrative numbers, not model prices.

Now suppose $12 of that spending belonged to abandoned attempts. Keep it in the $48 total. Reporting only the $36 attached to merged changes would hide the cost of getting to those successful outcomes.

Compare similar work where possible. Dependency updates and architectural changes are different workloads. Pair spending with review time, rework, and defects rather than treating a cheaper PR as automatically better. Human effort, CI, and subscriptions are separate costs unless you explicitly include and allocate them.

Use one billing view without losing task attribution

If your team uses several model families, Relay365 is worth considering as a pay-as-you-go relay desk. It works with Claude Code, Codex, Gemini CLI, and OpenAI SDK clients, which can make it a practical fit across existing coding workflows.

A shared relay does not automatically solve PR attribution. Check which usage records you can access and how you will connect them to tasks. For example, if you test Claude Haiku 4.5 and Gemini 2.5 Flash, compare charges on similar tasks alongside review outcomes.

Create a Relay365 account if that setup fits your workflow, then begin with a small, clearly tagged batch of tasks.

Leave the next shift a usable spending record

Review the most expensive tasks, unassigned charges, and abandoned attempts regularly. The goal is not the lowest possible bill. It is a repeatable explanation of what the team spent, what shipped, and which workflow deserves adjustment next.

Further desk bulletins

Curious how it runs on your own code? Sign up →