Budgeting 'free' Adapters #10400
Replies: 2 comments
|
You're not missing a setting. On current The only enforceable budget metric is currently For a self-hosted Ollama adapter, the clean solution is to calculate the cost inside the adapter and return it with the execution result: const usdPerHour =
(gpuWatts / 1000) * electricityUsdPerKwh +
depreciationUsdPerHour +
coolingUsdPerHour;
return {
...result,
costUsd: (elapsedMs / 3_600_000) * usdPerHour,
billingType: "metered_api",
biller: "local-ollama",
};The rate can also depend on the time of day, measured power consumption, or room-cooling cost. Relevant code:
If modifying the adapter is not possible, one calculated cost event per run can be submitted through Token-budget routing and native time-of-use or thermal pricing are not built in yet; those would require a Paperclip feature addition. |
|
thanks a lot for this insight. this made it clear for me.
I'll compare it with the adapters I can use and see if I can modify them.
German Abrikosov ***@***.***> schrieb am Mi., 29. Juli 2026,
21:11:
… You're not missing a setting. On current master, Paperclip does not
calculate an internal per-minute price.
The only enforceable budget metric is currently billed_cents, and the
heartbeat ledger expects the adapter to provide costUsd. If an adapter
reports token usage without a cost, Paperclip marks the event as unpriced
and records zero cost, so it cannot consume a dollar budget.
For a self-hosted Ollama adapter, the clean solution is to calculate the
cost inside the adapter and return it with the execution result:
const usdPerHour =
(gpuWatts / 1000) * electricityUsdPerKwh +
depreciationUsdPerHour +
coolingUsdPerHour;
return {
...result,
costUsd: (elapsedMs / 3_600_000) * usdPerHour,
billingType: "metered_api",
biller: "local-ollama",};
The rate can also depend on the time of day, measured power consumption,
or room-cooling cost.
Relevant code:
- costUsd is part of AdapterExecutionResult
<https://github.com/paperclipai/paperclip/blob/9574cad3e85a641ef6314843676d8b8dd75848f9/packages/adapter-utils/src/types.ts#L76-L104>
- The only current budget metric is billed_cents
<https://github.com/paperclipai/paperclip/blob/9574cad3e85a641ef6314843676d8b8dd75848f9/packages/shared/src/constants.ts#L796-L803>
- Missing adapter cost becomes unpriced
<https://github.com/paperclipai/paperclip/blob/9574cad3e85a641ef6314843676d8b8dd75848f9/server/src/services/heartbeat.ts#L2930-L2944>
If modifying the adapter is not possible, one calculated cost event per
run can be submitted through POST /api/companies/:companyId/cost-events.
Use either adapter reporting or manual events, not both, to avoid
double-counting.
Token-budget routing and native time-of-use or thermal pricing are not
built in yet; those would require a Paperclip feature addition.
—
Reply to this email directly, view it on GitHub
<#10400?email_source=notifications&email_token=AAVSVG7HNHGEFZXCV5Y3KK35HJD7PA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZYGMYTIOBUUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-17831484>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVSVG4LDQ25765S4ZEDJJT5HJD7PAVCNFSNUABJKJSXA33TNF2G64TZHMYTCNZQHAZDCMBWGQ5UI2LTMN2XG43JN5XDWMJQGUYTIMJZGWQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAVSVG7QUCXNK25OXGLO3J35HJD7PA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZYGMYTIOBUUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/AAVSVG4HU4DUBLNEZMF7SKD5HJD7PA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNZYGMYTIOBUUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm really confused!
I have tried with the opencode adapter (from holycode, paperclip from there as well) and now also with the ollama adapter (paperclip-ollama-adapter) and I'm able to set up budget constraints for my agents, give them different caps, but I cannot not set any cost anywhere. I suppose this is normally relayed by the API providers?
Still, a per-minute or similar rate must be calculated internally in paperclip so I'm wondering why I can't find where to set that number manually.
some background:
I'm running an ollama server (ollama-mi50) and want to add the pricing based off the electricity cost and some random crap for annual devaluation.
That way I can make sure to be able to have budget-concsious token caps and later when such features are added, also use the day/night power schedulers (i.e. via cheaper nighttime rates or alternatively daytime solar), and - probably more useful if i'm being all too honest - it'll allow routing low quality/low effort work to a different host with an integrated GPU where the watt/token is better.
and tbh we're having a heat wave ahead, I might even need to account based on BTU wasted instead of just electrictity, then I can stay under the room's thermal cap.
All reactions