2xx reply.
How a call is priced
A call’s cost is the sum of up to three parts:- Fee per call: a fixed amount for every charged call.
- Units × price per unit: a quantity read from the call (credits, pages, characters, bytes) times what one unit costs.
- Cost the API reports: some APIs return what the call cost them. Bifrost can add that amount.
$0.001 per call plus $0.008 per credit the API says it used:
If a charged call has no units to read, it still costs the fee per call.
Set the price
The relay’s price applies to every route, unless a route sets its own.- Web UI
- config.json
- Helm
- Open Relays, select the relay and select Edit Relay Config.
- On the General tab, under Pricing, fill in Fee per Call (USD), Price per Unit (USD) and where the units come from (see Where units come from).
- Check the line under the fields, which spells out the price as you type, for example Each counted call costs $0.001 / call + $0.008 / unit.
- Select Save General Configuration.

usage with Update relay.Where units come from
Three settings say what one “unit” is: Units Read From (units_source) picks which body to read:
Measure (
units_measure) picks what to count:
Units Path (
units_path) is where the value sits in a JSON body, written with dots: usage.credits, DocumentMetadata.Pages. Paths are case-sensitive. If the path points at a list, the values are added up: results.#.credits sums credits over every item of results.
A response body is read as JSON when its content type contains json, or when it has no content type and is valid JSON. For request-side units, Bifrost reads valid JSON regardless of the caller’s Content-Type. A missing or negative number counts as no units.
On a charged route that reads units from the request, a body that has the key only in different letter case (text when Units Path is Text) is refused with 400 before the call is sent, since the API would likely accept it but nothing could be billed.
Blocks and minimums
Some APIs charge per block of units, or have a minimum charge. Two optional fields cover that:- Block Size (
units_block_size) charges per started block. With100, sending 250 characters is 3 blocks. - Minimum Units (
units_minimum) is the fewest units charged once any units were read.
$0.01 per 100 characters with a 3-unit minimum:
Cost the API reports
If the API’s reply says what the call cost, set Reported Cost Path (cost_path) on the Advanced tab to where that number is. Bifrost adds it to the price. If the path points at a list of numbers, they are added up.
For example, this pricing charges a $0.0005 fee per call plus whatever the API reports at usage.cost:
{"usage": {"cost": 0.0021}} then costs 0.0005 + 0.0021 = $0.0026.
Ignore Reported Cost (ignore_upstream_cost: true, set on the relay rather than inside usage) turns off reported cost on every route of the relay at once, while your fee and unit price still apply.

Model and token fields
The same Usage Extraction section has fields that only add detail to Relay Logs. They never change the price.
Virtual-key model restrictions do not apply to relay calls, even when a model path is set.
Price one route differently
A route can have its own price. Any field the route leaves empty uses the relay’s value. Set a numeric field (fee, price per unit, minimum units) to0 to drop it on that route. Reported Cost Path is a path, not a number, so a route cannot waive it this way: an empty route path always inherits the relay’s path. To stop charging reported cost on only some routes, set cost_path per route instead of on the relay, and leave it out of the routes you don’t want it on.
- Web UI
- config.json
- Helm
- Open the route from the ⋯ menu in the route table.
- Expand Pricing Override. The relay’s values are shown in grey as hints.
- Fill in only the fields that differ for this route, such as Price per Unit (USD).
- Select Save Route.

Streamed replies
A streamed call is priced when the stream ends:- Server-sent events: Bifrost reads the events that carry a mapped field (units, reported cost, tokens) as they pass. For each field it keeps the last value reported, which is how most APIs report running totals.
- Priced by size (
body_bytesorbody_charsfrom the response):body_bytescounts the bytes forwarded;body_charscounts their characters, read as they arrive. Either way, a streamed audio reply is charged the same as a normal one. - Units from the request: known before the stream starts, so they work exactly as for normal calls.
- Other streams (not events, not priced by size) are passed through without being read, so only the fee per call and any request-side units apply.
Examples
- Per credit
- Per page, SigV4
- Per character sent
- Whole body
- Reported cost
The API says how many credits a call used.Reply
{"usage": {"credits": 4}}: 0.001 + 4 × 0.008 = $0.033.Test pricing
Test Pricing shows what a sample call would cost without sending anything to the API. Use it to check a new price before callers hit it.- Open Relays, select the relay and select Test Pricing.
- Enter the Method, Path and expected Status. Add Request Headers if a route matches on a header.
- Paste a sample Request Body and Response Body, and set the Response Content-Type.
- Select Run Test.
Next steps
- Virtual keys: relay access: who may call the relay, and which budgets the cost lands on.
- Troubleshooting: a call’s cost is not what you expected.

