Integrations
Pipedream
Read your AI-coding spend, savings, allowance and cost alerts from a Pipedream workflow, and send the numbers on to any of the thousands of apps Pipedream already connects.
No Lineman app in Pipedream's directory, and this is not something we can fix on our own. Only Pipedream can add an app to their directory, and we have asked. In the meantime their built-in HTTP / Webhook app calls the Lineman API directly, which works today and needs nothing from anybody.
Set it up
- 1In Lineman, go to Dashboard → Keys and create an API key, then copy it. It starts with
fa_live_. - 2In Pipedream, open Settings → Environment Variables and add one called
LINEMAN_API_KEYwith the key as its value. Keeping it here rather than in the step means it is stored once and never appears in a workflow's saved configuration. - 3Add the HTTP / Webhook app to a workflow and choose Send any HTTP Request. Set the method to
GETand the URL to the report you want, for examplehttps://api.lineman.io/v1/spend/summary?days=30. - 4docs.pipedream.setup.step4
The word Bearer and a space belong in the header, in front of the key. Putting it inside the key itself is the mistake people make, and the failure that follows looks like a rejected key rather than a mis-paste, so the usual next move is to go and create a second key that fails the same way.
What you can read
Fourteen reports, all of them read-only. Nothing reachable this way will change a budget, dismiss an alert or edit a cost centre. The full list is in the API reference; these are the four people start with:
- Spend -
/v1/spend/summaryfor the headline number and how it compares with the window before,/v1/spend/breakdownto split it by developer, repository, branch, ticket, model or cost centre. - Savings -
/v1/savings/summaryfor what Lineman saved you in a calendar month. - Alerts -
/v1/alertsfor budget breaches and cost spikes, so a workflow can route them to whoever should act on them. - Allowance -
/v1/allowancefor how much of your plan's monthly tokens you have used.
What the key can see
A workflow can do only what the person who created the key can do in Lineman. Their role, not the workflow, decides what comes back:
- Administrator - company-wide figures, across every member and repository.
- Auditor - the same company-wide figures.
- Everyone else - their own spend and savings only.
Four reports fail rather than narrow. Alerts, company, members and cost centres return an error to a key that is not an administrator's or an auditor's, instead of quietly shrinking to one person's figures. A narrowed number in a finance report is worse than a workflow that stops. Every other report tells you which you got in its scope field.
Reading the numbers
- Every amount comes back twice. One field ends in
_usdand is meant for display; the other ends in_microand is a whole number of millionths of a dollar, meant for arithmetic. Add up the_microfield and convert once at the end, because summing display values across a long list drifts as the rounding accumulates. Lineman never returns cents. - Two fields are text that contains JSON. An alert's detail and a cost centre's rules arrive as a string, because their contents differ from row to row. Run
JSON.parseover those two before reading inside them. - Spend takes days, savings takes a month. Spend reports accept a
daysvalue from 1 to 92 and use 7 if you leave it out. Savings reports take a calendarmonthwritten asYYYY-MMinstead. Anything longer than 92 days is refused rather than quietly truncated, so a bigger export has to be fetched in chunks.
Why there is no Lineman app to pick
Pipedream apps carry their own sign-in definition, and only Pipedream can create one. Outside contributors add steps inside an app Pipedream has already set up, so nobody can add Lineman to the directory except Pipedream themselves. We have asked them to. Until they do, the HTTP request above is the supported route, and it is not a lesser one: it reaches every report a Lineman app would.