import weflayr
from weflayr.openapi.models import CostsInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_costs(body=CostsInput.from_dict({
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]},
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCosts({
client,
throwOnError: true,
body: {
dateFrom: '2026-06-01',
aggregate: 'week',
groupBy: 'customer',
customerTags: { region: ['EU', 'NA'], plan: 'premium' },
runTags: { agent: ['orchestrator', 'qa'] },
},
});
curl -X POST https://app.weflayr.com/api/costs/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]}
}'
{
"rows": [
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_123", "cost": 342.87, "avg_feature_run_cost": 1.42, "max_feature_run_cost": 6.10},
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_456", "cost": 128.05, "avg_feature_run_cost": 0.85, "max_feature_run_cost": 2.30},
{"date_from": "2026-06-08", "date_to": "2026-06-14", "customer": "c_123", "cost": 401.20, "avg_feature_run_cost": 1.55, "max_feature_run_cost": 7.40}
],
"next_cursor": null,
"has_more": false
}
Dashboard data
Get costs
Get your AI cost per day, week, month, quarter or year, optionally split by customer, feature, model, provider or call name.
POST
/
api
/
costs
/
import weflayr
from weflayr.openapi.models import CostsInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_costs(body=CostsInput.from_dict({
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]},
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCosts({
client,
throwOnError: true,
body: {
dateFrom: '2026-06-01',
aggregate: 'week',
groupBy: 'customer',
customerTags: { region: ['EU', 'NA'], plan: 'premium' },
runTags: { agent: ['orchestrator', 'qa'] },
},
});
curl -X POST https://app.weflayr.com/api/costs/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]}
}'
{
"rows": [
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_123", "cost": 342.87, "avg_feature_run_cost": 1.42, "max_feature_run_cost": 6.10},
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_456", "cost": 128.05, "avg_feature_run_cost": 0.85, "max_feature_run_cost": 2.30},
{"date_from": "2026-06-08", "date_to": "2026-06-14", "customer": "c_123", "cost": 401.20, "avg_feature_run_cost": 1.55, "max_feature_run_cost": 7.40}
],
"next_cursor": null,
"has_more": false
}
Each row carries only the dimension named by
group_by (customer in the example), and none when group_by is unset.
Parameters
Passed in the request body.string
required
Start of the period, inclusive.
YYYY-MM-DD.string
End of the period, inclusive. Defaults to today.
YYYY-MM-DD.string
default:"day"
One row per period;
"all" collapses the whole date range into a single row (per group_by, if set). One of day, week, month, quarter, year or all.string
Split each period into one row per dimension value. Omit for one row per period. One of
customer, feature, model, provider or call_name.string[]
Restrict to these customers. Omit for every customer. See Get customers.
string[]
Restrict to these feature tags. Omit for every feature. See Get features.
string[]
Restrict to these models. Omit for every model. See Get models.
string[]
Restrict to these providers. Omit for every provider. See Get providers.
object
Restrict to customers carrying these customer tags (AND across
tag_key, OR within a tag_key’s values).object
Restrict to runs carrying these tags (AND across
tag_key, OR within a tag_key’s values).boolean
default:"false"
Apply free AI credits discounts to
cost. Never applied to avg_feature_run_cost/max_feature_run_cost, which always report gross cost.integer
default:"100"
Number of rows per page. Max
1000.string
The route is paginated: pass the previous page’s
next_cursor, as is, to get the next page. has_more says whether another page exists.import weflayr
from weflayr.openapi.models import CostsInput
client = weflayr.client() # reads WEFLAYR_API_KEY
client.get_costs(body=CostsInput.from_dict({
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]},
}))
const weflayr = require('weflayr');
const client = weflayr.client(); // reads WEFLAYR_API_KEY
await weflayr.api.getCosts({
client,
throwOnError: true,
body: {
dateFrom: '2026-06-01',
aggregate: 'week',
groupBy: 'customer',
customerTags: { region: ['EU', 'NA'], plan: 'premium' },
runTags: { agent: ['orchestrator', 'qa'] },
},
});
curl -X POST https://app.weflayr.com/api/costs/ \
-H "Authorization: Bearer $WEFLAYR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"date_from": "2026-06-01",
"aggregate": "week",
"group_by": "customer",
"customer_tags": {"region": ["EU", "NA"], "plan": "premium"},
"run_tags": {"agent": ["orchestrator", "qa"]}
}'
{
"rows": [
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_123", "cost": 342.87, "avg_feature_run_cost": 1.42, "max_feature_run_cost": 6.10},
{"date_from": "2026-06-01", "date_to": "2026-06-07", "customer": "c_456", "cost": 128.05, "avg_feature_run_cost": 0.85, "max_feature_run_cost": 2.30},
{"date_from": "2026-06-08", "date_to": "2026-06-14", "customer": "c_123", "cost": 401.20, "avg_feature_run_cost": 1.55, "max_feature_run_cost": 7.40}
],
"next_cursor": null,
"has_more": false
}