Business Case Builder API
Reading the lines, the NPV, IRR, payback, scenarios, checks, verdict and the downloads all run free in the browser and are not part of this API. The API runs the one metered step: writing the executive summary, risks and assumptions for one business case.
Base URL: https://api.skillsafe.ai/v1/app-api. Every response is an envelope {"data": ..., "error": null} or {"data": null, "error": {"code", "message"}}.
The task field
This app has one task. Always send "task": "case".
| task | What it does | Reply |
|---|---|---|
case | Reads the cost and benefit lines, the figures and the verdict against a description of the investment and writes an executive summary, the rationale for the verdict, 2 to 5 risks with likelihood, impact and mitigation, 1 to 4 assumptions to test and up to 3 questions. | One JSON object |
The input
All values are strings. task, project, lines, figures and verdict are required; send "" for anything else you do not have.
| Field | What to send |
|---|---|
task | "case" |
project | What the investment is, in your own words (at most 1,200 characters). The only source of facts about it. |
name | The investment's name, or empty. |
lines | One line per cost or benefit: id | cost or benefit | name | as typed: ... | $X a year or $X once | confidence (confidence on benefits only, high, medium or low). Ids are c1, c2... and b1, b2... |
figures | The figures, one per line: horizon and rates, totals, TCO, NPV, risk-adjusted NPV, IRR, payback, ROI, each year, each scenario, break-even. |
verdict | GO, GO IF or NO-GO, then | and the reason. |
checks | The checks, one per line: fix | ..., watch | ... or note | .... |
clip_note | Empty, or a sentence saying how many lines were left out. |
The reply
job.output.output is text holding one JSON object: summary, decision (the verdict word, copied), rationale, risks ({risk, likelihood, impact, mitigation, line}), assumptions ({line, why, test}) and questions. Before using it, check that the decision equals your verdict, that every line is an id you sent, and that no sentence has a number, name or claim your input does not have. The page does exactly that, and shows what it refused.
Worked examples
The three examples on the page, each with the exact input the page sends and a model reply.
Search upgrade
Input:
{
"task": "case",
"project": "We want to rebuild product search so customers find items faster. Today about a third of searches return nothing useful and support gets tickets about it every week. Sales thinks better search will lift conversion, but we have no test yet.",
"name": "Search upgrade",
"lines": "c1 | cost | Engineering | as typed: Engineering, 4 engineers x 160 hours x $100, once | $64,000 once\nc2 | cost | Design | as typed: Design, $7,200, once | $7,200 once\nc3 | cost | QA and testing | as typed: QA and testing, $12,800, once | $12,800 once\nc4 | cost | Hosting | as typed: Hosting, $1,000 a month | $12,000 a year\nc5 | cost | Maintenance | as typed: Maintenance, $14,490 a year | $14,490 a year\nb1 | benefit | New revenue from better search | as typed: New revenue from better search, $60,000 a year, low | $60,000 a year | low confidence\nb2 | benefit | Fewer support tickets | as typed: Fewer support tickets, 50 tickets a month x $20, high | $12,000 a year | high confidence\nb3 | benefit | Faster onboarding | as typed: Faster onboarding, 10 hours a week x $45, medium | $23,400 a year | medium confidence",
"figures": "Horizon: 3 years; discount rate 10%; hurdle rate 10%; benefits start right away\nOne-time costs: $84,000; running costs per year: $26,490; benefits per full year: $95,400\n3-year total cost (TCO): $163,470\n3-year benefits: $286,200\nNPV (10% discount): $87,369\nRisk-adjusted NPV: -$1,785\nIRR: 63.1%\nPayback period: 14.6 months\nDiscounted payback: 15.6 months\nROI: 75%\nYear 1: costs $110,490, benefits $95,400, net -$15,090, cumulative -$15,090\nYear 2: costs $26,490, benefits $95,400, net $68,910, cumulative $53,820\nYear 3: costs $26,490, benefits $95,400, net $68,910, cumulative $122,730\nBase case (benefits x1, 10%): NPV $87,369, payback 14.6 months\nConservative (benefits x0.75, 15%): NPV $18,882, payback 22.4 months\nOptimistic (benefits x1.25, 8%): NPV $155,052, payback 10.9 months\nPessimistic (benefits x0.6, 12%): NPV -$10,144, payback 32.8 months\nBenefits can fall 37% before NPV reaches zero",
"verdict": "GO | Go: the case holds even in the conservative scenario",
"checks": "note | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nwatch | Most of the benefit (63%) is marked low confidence. The risk-adjusted NPV, -$1,785, counts low-confidence benefits at half.\nnote | \"New revenue from better search\" counts in full. If that revenue costs something to deliver, enter the margin you keep, not the top line.",
"clip_note": ""
}
Reply:
{
"summary": "Rebuilding product search so customers find items faster costs $163,470 over three years and returns $286,200 in benefits, an NPV of $87,369 with payback in 14.6 months. The decision is GO, since the case holds even in the conservative scenario. The biggest uncertainty is that most of the benefit (63%) is new revenue marked low confidence, and the team has no test yet of whether better search lifts conversion.",
"decision": "GO",
"rationale": "The conservative scenario still shows an NPV of $18,882, and benefits can fall 37% before the NPV reaches zero, though the pessimistic scenario turns negative at -$10,144.",
"risks": [
{
"risk": "Better search may lift conversion far less than the $60,000 a year assumed, since there is no test yet and the benefit is marked low confidence.",
"likelihood": "medium",
"impact": "high",
"mitigation": "Run a small A/B test of the new search on part of the traffic before committing the full build.",
"line": "b1"
},
{
"risk": "The revenue counted in full may be top line, so the margin actually kept could be lower than the case assumes.",
"likelihood": "medium",
"impact": "medium",
"mitigation": "Enter the margin kept on that revenue and recheck the risk-adjusted NPV, now -$1,785.",
"line": "b1"
},
{
"risk": "Training, change management and delays are often left out, so the one-time Engineering cost could overrun the $64,000 planned.",
"likelihood": "medium",
"impact": "medium",
"mitigation": "Turn on the 30% buffer in the model and ask the engineers to re-estimate with a contingency.",
"line": "c1"
},
{
"risk": "Faster onboarding may deliver less than 10 hours a week of saved time if the gain is hard to measure or is absorbed elsewhere.",
"likelihood": "medium",
"impact": "low",
"mitigation": "Measure current onboarding time on a few recent cases and agree with the owner how savings will be tracked.",
"line": "b3"
}
],
"assumptions": [
{
"line": "b1",
"why": "New revenue from better search is the largest benefit at $60,000 a year and carries most of the case, yet it is marked low confidence.",
"test": "Run a short A/B test on a slice of customers and compare conversion for the old and new search."
},
{
"line": "b2",
"why": "The ticket savings are rated high confidence, and they give the case a steadier floor if revenue disappoints.",
"test": "Count this month's search-related tickets and confirm what each one costs to handle."
},
{
"line": "b3",
"why": "Faster onboarding adds $23,400 a year, and it is not obvious how better search produces it.",
"test": "Ask the people who onboard how much of their time goes to searching, and time a few typical cases."
}
],
"questions": [
"What share of the new revenue could realistically be traced to search rather than other changes?",
"What margin do you keep on that revenue once the cost of delivering it is counted?",
"Who saves the onboarding hours, and how were the 10 hours a week measured?"
]
}
On the page, the decision is matched against the verdict, every line id against the lines sent, and every sentence for numbers and names the input does not have.
Helpdesk tool
Input:
{
"task": "case",
"project": "Our 40 support agents work from a shared inbox. Replies are slow and things get lost, and engineering gets pulled into escalations. We are looking at buying a helpdesk tool instead of the shared inbox.",
"name": "Helpdesk software",
"lines": "c1 | cost | Licences | as typed: Licences, 40 seats x $55 a month | $26,400 a year\nc2 | cost | Implementation partner | as typed: Implementation partner, $45,000 once | $45,000 once\nc3 | cost | Training | as typed: Training, $12,000 once | $12,000 once\nc4 | cost | Integration upkeep | as typed: Integration upkeep, $9,000 a year | $9,000 a year\nb1 | benefit | Agent time saved | as typed: Agent time saved, 12 hours a week x $38, medium | $23,712 a year | medium confidence\nb2 | benefit | Fewer escalations to engineering | as typed: Fewer escalations to engineering, $25,000 a year, low | $25,000 a year | low confidence\nb3 | benefit | Customers kept by faster replies | as typed: Customers kept by faster replies, $30,000 a year, low | $30,000 a year | low confidence",
"figures": "Horizon: 3 years; discount rate 10%; hurdle rate 10%; benefits start right away\nOne-time costs: $57,000; running costs per year: $35,400; benefits per full year: $78,712\n3-year total cost (TCO): $163,200\n3-year benefits: $236,136\nNPV (10% discount): $50,711\nRisk-adjusted NPV: -$32,420\nIRR: 56.0%\nPayback period: 15.8 months\nDiscounted payback: 16.9 months\nROI: 45%\nYear 1: costs $92,400, benefits $78,712, net -$13,688, cumulative -$13,688\nYear 2: costs $35,400, benefits $78,712, net $43,312, cumulative $29,624\nYear 3: costs $35,400, benefits $78,712, net $43,312, cumulative $72,936\nBase case (benefits x1, 10%): NPV $50,711, payback 15.8 months\nConservative (benefits x0.75, 15%): NPV -$3,038, payback 28.9 months\nOptimistic (benefits x1.25, 8%): NPV $105,331, payback 10.9 months\nPessimistic (benefits x0.6, 12%): NPV -$28,593, payback not within 3 years\nBenefits can fall 26% before NPV reaches zero",
"verdict": "GO IF | Go, if the assumptions hold: positive in the base case, negative in the conservative one",
"checks": "note | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nwatch | Most of the benefit (70%) is marked low confidence. The risk-adjusted NPV, -$32,420, counts low-confidence benefits at half.\nwatch | The conservative scenario (benefits x0.75 at 15%) turns NPV negative: -$3,038. Test the biggest benefit before committing.",
"clip_note": ""
}
Reply:
{
"summary": "Replacing the shared inbox used by 40 support agents with a helpdesk tool costs $163,200 over three years and returns $236,136 in benefits, for an NPV of $50,711 and a payback of 15.8 months. The decision is GO IF: the base case is positive but turns negative in the conservative scenario, and the biggest uncertainty is that most of the benefit is marked low confidence.",
"decision": "GO IF",
"rationale": "The base case NPV is $50,711, but the conservative scenario falls to -$3,038 and benefits can fall 26% before NPV reaches zero.",
"risks": [
{
"risk": "Customers kept by faster replies may be worth less than the $30,000 a year assumed, since it is the largest benefit and is marked low confidence.",
"likelihood": "medium",
"impact": "high",
"mitigation": "Compare churn among customers with slow replies against those with fast ones before signing.",
"line": "b3"
},
{
"risk": "Fewer escalations to engineering may fall short of the $25,000 a year planned, because engineering may still be pulled in for hard cases.",
"likelihood": "medium",
"impact": "high",
"mitigation": "Count current escalations over a few weeks and agree with engineering which ones the tool should remove.",
"line": "b2"
},
{
"risk": "Training, change management and delays may cost more than the $12,000 once planned, which would push payback later.",
"likelihood": "medium",
"impact": "medium",
"mitigation": "Ask the Implementation partner for a fixed-scope quote and rerun the case with a cost buffer.",
"line": "c3"
},
{
"risk": "Integration upkeep could grow beyond $9,000 a year as the tool is connected to more systems.",
"likelihood": "low",
"impact": "medium",
"mitigation": "Get the upkeep scope and a price cap in writing from the partner before committing.",
"line": "c4"
}
],
"assumptions": [
{
"line": "b3",
"why": "Customers kept by faster replies is the largest benefit at $30,000 a year, and the verdict depends on it holding.",
"test": "Review a sample of lost customers and check how many cited slow replies as the reason."
},
{
"line": "b2",
"why": "Fewer escalations to engineering is a low confidence benefit that adds $25,000 a year to the case.",
"test": "Ask engineering to log escalation time for a few weeks to see what the tool could realistically remove."
},
{
"line": "b1",
"why": "Agent time saved is the only medium confidence benefit and underpins the base case.",
"test": "Time a handful of typical tickets in the shared inbox and in a trial of the tool."
}
],
"questions": [
"How many customers are lost today because of slow replies, and what is each one worth?",
"How much engineering time do escalations take today, and which kinds would the tool actually remove?",
"Does the Implementation partner's quote cover training and change management or only setup?"
]
}
On the page, the decision is matched against the verdict, every line id against the lines sent, and every sentence for numbers and names the input does not have.
Warehouse scanners
Input:
{
"task": "case",
"project": "The warehouse picks orders from paper lists. The operations manager wants handheld scanners for all 60 pickers. Mis-picks cost us refunds and reshipping, but the error rate is already low.",
"name": "Warehouse scanners",
"lines": "c1 | cost | Handheld scanners | as typed: Handheld scanners, 60 x $1,400, once | $84,000 once\nc2 | cost | Scanning software | as typed: Scanning software, $2,500 a month | $30,000 a year\nc3 | cost | Rollout and training | as typed: Rollout and training, $30,000 once | $30,000 once\nb1 | benefit | Picking errors avoided | as typed: Picking errors avoided, $18,000 a year, medium | $18,000 a year | medium confidence\nb2 | benefit | Time saved | as typed: Time saved, 5 hours a week x $25, high | $6,500 a year | high confidence\nbenefit with no amount (not counted) | Better stock accuracy",
"figures": "Horizon: 3 years; discount rate 12%; hurdle rate 12%; benefits start right away\nOne-time costs: $114,000; running costs per year: $30,000; benefits per full year: $24,500\n3-year total cost (TCO): $204,000\n3-year benefits: $73,500\nNPV (12% discount): -$127,210\nRisk-adjusted NPV: -$138,018\nIRR: n/a\nPayback period: not within 3 years\nDiscounted payback: not within 3 years\nROI: -64%\nYear 1: costs $144,000, benefits $24,500, net -$119,500, cumulative -$119,500\nYear 2: costs $30,000, benefits $24,500, net -$5,500, cumulative -$125,000\nYear 3: costs $30,000, benefits $24,500, net -$5,500, cumulative -$130,500\nBase case (benefits x1, 12%): NPV -$127,210, payback not within 3 years\nConservative (benefits x0.75, 17%): NPV -$139,686, payback not within 3 years\nOptimistic (benefits x1.25, 10%): NPV -$112,446, payback not within 3 years\nPessimistic (benefits x0.6, 14%): NPV -$149,521, payback not within 3 years",
"verdict": "NO-GO | No-go on these numbers: the investment loses value at this discount rate",
"checks": "note | \"Better stock accuracy\" has no amount, so it is not counted. It is listed as a benefit you cannot put a number on.\nnote | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nfix | It does not pay back within 3 years.\nfix | NPV is negative at 12%: -$127,210. The investment loses value at this discount rate.\nnote | There is no IRR: the cash flows never turn from negative to positive within 3 years.",
"clip_note": ""
}
Reply:
{
"summary": "Handheld scanners for all 60 pickers would cost $204,000 over three years and return $73,500 in benefits, for an NPV of -$127,210 at 12%. The investment does not pay back within the three years, so the decision is NO-GO. The biggest uncertainty is whether Picking errors avoided is really worth $18,000 a year when the error rate is already low.",
"decision": "NO-GO",
"rationale": "Every scenario stays negative, from -$112,446 in the optimistic case to -$149,521 in the pessimistic case, and payback falls outside the three-year horizon.",
"risks": [
{
"risk": "Picking errors avoided may be worth less than the $18,000 a year typed, because the error rate is already low and there may be few mis-picks left to remove.",
"likelihood": "high",
"impact": "high",
"mitigation": "Count the refunds and reshipping caused by mis-picks over a recent period before spending anything.",
"line": "b1"
},
{
"risk": "Rollout and training could run over, since training, change management and delays are often left out of estimates.",
"likelihood": "medium",
"impact": "medium",
"mitigation": "Ask the vendor for a fixed-price rollout quote and plan training in small groups of pickers.",
"line": "c3"
},
{
"risk": "The monthly cost of Scanning software could rise if the vendor reprices or more users are added, and it runs every year of the horizon.",
"likelihood": "medium",
"impact": "medium",
"mitigation": "Negotiate a multi-year price lock before signing.",
"line": "c2"
},
{
"risk": "Time saved may not materialise if pickers need time to adapt to the handhelds, which would widen the loss already shown by the risk-adjusted NPV of -$138,018.",
"likelihood": "low",
"impact": "low",
"mitigation": "Time a few pickers on paper lists and on a borrowed handheld to see the real difference.",
"line": "b2"
}
],
"assumptions": [
{
"line": "b1",
"why": "Picking errors avoided is the largest benefit and carries most of the case, yet it is rated medium confidence and the error rate is already low.",
"test": "Add up the cost of refunds and reshipping from mis-picks over a recent period and compare it with the amount typed."
},
{
"line": "b2",
"why": "Time saved is the second benefit and the only one rated high confidence, so it anchors the lower end of the case.",
"test": "Measure picking time for a small group of pickers with and without a handheld scanner."
}
],
"questions": [
"How much do mis-picks actually cost the warehouse in refunds and reshipping today?",
"Could a smaller rollout to fewer pickers or a cheaper scanning option deliver most of the benefit?"
]
}
On the page, the decision is matched against the verdict, every line id against the lines sent, and every sentence for numbers and names the input does not have.
Errors
| HTTP | What to do |
|---|---|
| 401 | The token is missing, expired or a guest token on a run. Get a personal token on the token page. |
| 402 | The balance is below what the run reserves. Top up at skillsafe.ai/account/billing. |
| 400 | The body is not a JSON object of the fields above, or a required field is missing. |
| 429 | Wait and retry with the same Idempotency-Key. |
Step 1 — a tiny client helper
One function that sends JSON and unwraps the {data, error} envelope.
BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here" # from https://business-case-builder.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}import json, urllib.request
BASE = "https://api.skillsafe.ai/v1/app-api"
TOKEN = "paste-your-token-here" # from https://business-case-builder.skillsafe.ai/tokens.html
def api(method, path, body=None, headers=None):
req = urllib.request.Request(BASE + path, method=method,
data=None if body is None else json.dumps(body).encode(),
headers={"Content-Type": "application/json", **({"Authorization": "Bearer " + TOKEN} if TOKEN else {}), **(headers or {})})
with urllib.request.urlopen(req) as r:
env = json.load(r)
if env.get("error"):
raise RuntimeError(env["error"])
return env["data"]// business-case-builder.mjs -- Node 18+ (global fetch)
const BASE = "https://api.skillsafe.ai/v1/app-api";
let TOKEN = "paste-your-token-here"; // from https://business-case-builder.skillsafe.ai/tokens.html
async function api(method, path, body, headers = {}) {
const r = await fetch(BASE + path, { method, headers: { "Content-Type": "application/json",
...(TOKEN ? { Authorization: "Bearer " + TOKEN } : {}), ...headers },
body: body === undefined ? undefined : JSON.stringify(body) });
const env = await r.json();
if (env.error) throw new Error(env.error.code + ": " + env.error.message);
return env.data;
}package main
import ("bytes"; "encoding/json"; "fmt"; "net/http")
const base = "https://api.skillsafe.ai/v1/app-api"
var token = "paste-your-token-here" // from https://business-case-builder.skillsafe.ai/tokens.html
func api(method, path string, body any, headers map[string]string) (map[string]any, error) {
var buf bytes.Buffer
if body != nil { json.NewEncoder(&buf).Encode(body) }
req, _ := http.NewRequest(method, base+path, &buf)
req.Header.Set("Content-Type", "application/json")
if token != "" { req.Header.Set("Authorization", "Bearer "+token) }
for k, v := range headers { req.Header.Set(k, v) }
res, err := http.DefaultClient.Do(req)
if err != nil { return nil, err }
defer res.Body.Close()
var env struct { Data map[string]any; Error map[string]any }
json.NewDecoder(res.Body).Decode(&env)
if env.Error != nil { return nil, fmt.Errorf("%v", env.Error) }
return env.Data, nil
}// BusinessCaseBuilder.java -- Java 17+, with com.fasterxml.jackson.core:jackson-databind
import com.fasterxml.jackson.databind.*;
import java.net.URI; import java.net.http.*; import java.util.*;
public class BusinessCaseBuilder {
static final String BASE = "https://api.skillsafe.ai/v1/app-api";
static String token = "paste-your-token-here"; // from https://business-case-builder.skillsafe.ai/tokens.html
static final ObjectMapper M = new ObjectMapper();
static final HttpClient C = HttpClient.newHttpClient();
static JsonNode api(String method, String path, Object body, Map<String, String> headers) throws Exception {
var b = HttpRequest.newBuilder(URI.create(BASE + path)).header("Content-Type", "application/json");
if (!token.isEmpty()) b.header("Authorization", "Bearer " + token);
if (headers != null) headers.forEach(b::header);
b.method(method, body == null ? HttpRequest.BodyPublishers.noBody() : HttpRequest.BodyPublishers.ofString(M.writeValueAsString(body)));
JsonNode env = M.readTree(C.send(b.build(), HttpResponse.BodyHandlers.ofString()).body());
if (env.hasNonNull("error")) throw new RuntimeException(env.get("error").toString());
return env.get("data");
}
}require "json"
require "net/http"
BASE = "https://api.skillsafe.ai/v1/app-api"
TOKEN = "paste-your-token-here" # from https://business-case-builder.skillsafe.ai/tokens.html
def api(method, path, body = nil, headers = {})
uri = URI(BASE + path)
req = Net::HTTPGenericRequest.new(method, !body.nil?, true, uri.request_uri,
{ "Content-Type" => "application/json" }.merge(TOKEN.empty? ? {} : { "Authorization" => "Bearer #{TOKEN}" }).merge(headers))
req.body = JSON.generate(body) unless body.nil?
env = JSON.parse(Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }.body)
raise env["error"].to_s if env["error"]
env["data"]
end<?php
const BASE = "https://api.skillsafe.ai/v1/app-api";
$TOKEN = "paste-your-token-here"; // from https://business-case-builder.skillsafe.ai/tokens.html
function api(string $method, string $path, $body = null, array $headers = []) {
global $TOKEN;
$h = ["Content-Type: application/json"];
if ($TOKEN) $h[] = "Authorization: Bearer $TOKEN";
foreach ($headers as $k => $v) $h[] = "$k: $v";
$ch = curl_init(BASE . $path);
curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $h, CURLOPT_RETURNTRANSFER => true]);
if ($body !== null) curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
$env = json_decode(curl_exec($ch), true);
if (!empty($env["error"])) throw new Exception(json_encode($env["error"]));
return $env["data"];
}// Program.cs -- .NET 6+ console app
using System.Net.Http.Json; using System.Text.Json; using System.Text.Json.Nodes;
static class Api {
public const string Base = "https://api.skillsafe.ai/v1/app-api";
public static string Token = "paste-your-token-here"; // from https://business-case-builder.skillsafe.ai/tokens.html
static readonly HttpClient C = new();
public static async Task<JsonNode?> Call(string method, string path, object? body = null, Dictionary<string, string>? headers = null) {
var req = new HttpRequestMessage(new HttpMethod(method), Base + path);
if (Token != "") req.Headers.Add("Authorization", "Bearer " + Token);
if (headers != null) foreach (var h in headers) req.Headers.Add(h.Key, h.Value);
if (body != null) req.Content = JsonContent.Create(body);
var env = JsonNode.Parse(await (await C.SendAsync(req)).Content.ReadAsStringAsync())!;
if (env["error"] is JsonNode e && e.GetValueKind() != JsonValueKind.Null) throw new Exception(e.ToJsonString());
return env["data"];
}
}Step 2 — a token
A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.
# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"business-case-builder"}' | jq -r '.data.token')# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN = ""
TOKEN = api("POST", "/guest", {"slug": "business-case-builder"})["token"]// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN = "";
TOKEN = (await api("POST", "/guest", { slug: "business-case-builder" })).token;// inside main: a guest token (enough for /me and /estimate); a run needs your personal token
token = ""
g, err := api("POST", "/guest", map[string]string{"slug": "business-case-builder"}, nil)
if err != nil { panic(err) }
token = g["token"].(string)// inside main: a guest token (enough for /me and /estimate); a run needs your personal token
token = "";
token = api("POST", "/guest", Map.of("slug", "business-case-builder"), null).get("token").asText();# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN.replace("")
TOKEN.replace(api("POST", "/guest", { slug: "business-case-builder" })["token"])// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
$TOKEN = "";
$TOKEN = api("POST", "/guest", ["slug" => "business-case-builder"])["token"];// a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
Api.Token = "";
Api.Token = (await Api.Call("POST", "/guest", new { slug = "business-case-builder" }))!["token"]!.GetValue<string>();Step 3 — who am I, and my balance
subject_type is guest or user; credits is the balance (1 credit = $0.0001).
api GET /me | jq '.data | {subject_type, credits}' me = api("GET", "/me")
print(me["subject_type"], me.get("credits"))const me = await api("GET", "/me");
console.log(me.subject_type, me.credits);me, _ := api("GET", "/me", nil, nil)
fmt.Println(me["subject_type"], me["credits"])JsonNode me = api("GET", "/me", null, null);
System.out.println(me.get("subject_type") + " " + me.get("credits"));me = api("GET", "/me")
puts [me["subject_type"], me["credits"]].inspect$me = api("GET", "/me");
echo $me["subject_type"], " ", $me["credits"] ?? "", "\n";var me = await Api.Call("GET", "/me");
Console.WriteLine($"{me!["subject_type"]} {me["credits"]}");Step 4 — price a run for free
/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.
# input.json: the run input object - {"task": "case", "project": "Our 40 support agents work from a shared inbox. Replies are slow and things get lost, and engineering gets pulled into escalations. We are looking at buying a helpdesk tool instead of the shared inbox.", "name": "Helpdesk software", "lines": "c1 | cost | Licences | as typed: Licences, 40 seats x $55 a month | $26,400 a year\nc2 | cost | Implementation partner | as typed: Implementation partner, $45,000 once | $45,000 once\nc3 | cost | Training | as typed: Training, $12,000 once | $12,000 once\nc4 | cost | Integration upkeep | as typed: Integration upkeep, $9,000 a year | $9,000 a year\nb1 | benefit | Agent time saved | as typed: Agent time saved, 12 hours a week x $38, medium | $23,712 a year | medium confidence\nb2 | benefit | Fewer escalations to engineering | as typed: Fewer escalations to engineering, $25,000 a year, low | $25,000 a year | low confidence\nb3 | benefit | Customers kept by faster replies | as typed: Customers kept by faster replies, $30,000 a year, low | $30,000 a year | low confidence", "figures": "Horizon: 3 years; discount rate 10%; hurdle rate 10%; benefits start right away\nOne-time costs: $57,000; running costs per year: $35,400; benefits per full year: $78,712\n3-year total cost (TCO): $163,200\n3-year benefits: $236,136\nNPV (10% discount): $50,711\nRisk-adjusted NPV: -$32,420\nIRR: 56.0%\nPayback period: 15.8 months\nDiscounted payback: 16.9 months\nROI: 45%\nYear 1: costs $92,400, benefits $78,712, net -$13,688, cumulative -$13,688\nYear 2: costs $35,400, benefits $78,712, net $43,312, cumulative $29,624\nYear 3: costs $35,400, benefits $78,712, net $43,312, cumulative $72,936\nBase case (benefits x1, 10%): NPV $50,711, payback 15.8 months\nConservative (benefits x0.75, 15%): NPV -$3,038, payback 28.9 months\nOptimistic (benefits x1.25, 8%): NPV $105,331, payback 10.9 months\nPessimistic (benefits x0.6, 12%): NPV -$28,593, payback not within 3 years\nBenefits can fall 26% before NPV reaches zero", "verdict": "GO IF | Go, if the assumptions hold: positive in the base case, negative in the conservative one", "checks": "note | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nwatch | Most of the benefit (70%) is marked low confidence. The risk-adjusted NPV, -$32,420, counts low-confidence benefits at half.\nwatch | The conservative scenario (benefits x0.75 at 15%) turns NPV negative: -$3,038. Test the biggest benefit before committing.", "clip_note": ""}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' inp = json.load(open("input.json")) # {"task": "case", "project": "Our 40 support agents work from a shared inbox. Replies are slow and things get lost, and engineering gets pulled into escalations. We are looking at buying a helpdesk tool instead of the shared inbox.", "name": "Helpdesk software", "lines": "c1 | cost | Licences | as typed: Licences, 40 seats x $55 a month | $26,400 a year\nc2 | cost | Implementation partner | as typed: Implementation partner, $45,000 once | $45,000 once\nc3 | cost | Training | as typed: Training, $12,000 once | $12,000 once\nc4 | cost | Integration upkeep | as typed: Integration upkeep, $9,000 a year | $9,000 a year\nb1 | benefit | Agent time saved | as typed: Agent time saved, 12 hours a week x $38, medium | $23,712 a year | medium confidence\nb2 | benefit | Fewer escalations to engineering | as typed: Fewer escalations to engineering, $25,000 a year, low | $25,000 a year | low confidence\nb3 | benefit | Customers kept by faster replies | as typed: Customers kept by faster replies, $30,000 a year, low | $30,000 a year | low confidence", "figures": "Horizon: 3 years; discount rate 10%; hurdle rate 10%; benefits start right away\nOne-time costs: $57,000; running costs per year: $35,400; benefits per full year: $78,712\n3-year total cost (TCO): $163,200\n3-year benefits: $236,136\nNPV (10% discount): $50,711\nRisk-adjusted NPV: -$32,420\nIRR: 56.0%\nPayback period: 15.8 months\nDiscounted payback: 16.9 months\nROI: 45%\nYear 1: costs $92,400, benefits $78,712, net -$13,688, cumulative -$13,688\nYear 2: costs $35,400, benefits $78,712, net $43,312, cumulative $29,624\nYear 3: costs $35,400, benefits $78,712, net $43,312, cumulative $72,936\nBase case (benefits x1, 10%): NPV $50,711, payback 15.8 months\nConservative (benefits x0.75, 15%): NPV -$3,038, payback 28.9 months\nOptimistic (benefits x1.25, 8%): NPV $105,331, payback 10.9 months\nPessimistic (benefits x0.6, 12%): NPV -$28,593, payback not within 3 years\nBenefits can fall 26% before NPV reaches zero", "verdict": "GO IF | Go, if the assumptions hold: positive in the base case, negative in the conservative one", "checks": "note | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nwatch | Most of the benefit (70%) is marked low confidence. The risk-adjusted NPV, -$32,420, counts low-confidence benefits at half.\nwatch | The conservative scenario (benefits x0.75 at 15%) turns NPV negative: -$3,038. Test the biggest benefit before committing.", "clip_note": ""}
est = api("POST", "/estimate", inp)
print(est["hold_credits"], est["min_credits"], est["model"], est.get("warnings"))import { readFileSync } from "node:fs";
const input = JSON.parse(readFileSync("input.json", "utf8")); // {task, project, name, lines, figures, verdict, checks, clip_note}
const est = await api("POST", "/estimate", input);
console.log(est.hold_credits, est.min_credits, est.model, est.warnings);raw, _ := os.ReadFile("input.json") // add "os" to the imports
var input map[string]any
json.Unmarshal(raw, &input)
est, _ := api("POST", "/estimate", input, nil)
fmt.Println(est["hold_credits"], est["min_credits"], est["model"])Map<String, Object> input = M.readValue(new java.io.File("input.json"), Map.class);
JsonNode est = api("POST", "/estimate", input, null);
System.out.println(est.get("hold_credits") + " " + est.get("min_credits") + " " + est.get("model"));input = JSON.parse(File.read("input.json"))
est = api("POST", "/estimate", input)
puts [est["hold_credits"], est["min_credits"], est["model"]].inspect$input = json_decode(file_get_contents("input.json"), true);
$est = api("POST", "/estimate", $input);
echo $est["hold_credits"], " ", $est["min_credits"], " ", $est["model"], "\n";var input = JsonNode.Parse(File.ReadAllText("input.json"))!;
var est = await Api.Call("POST", "/estimate", input);
Console.WriteLine($"{est!["hold_credits"]} {est["min_credits"]} {est["model"]}");Step 5 — run it and wait for the job
Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.
KEY="business-case-builder:case:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json # one JSON object: summary, decision, rationale, risks, assumptions, questions
echo "$J" | jq '.data | {charged_credits, truncated}' import hashlib, time
key = "business-case-builder:" + inp["task"] + ":" + hashlib.sha256(json.dumps(inp).encode()).hexdigest()[:16] + ":a1"
job = api("POST", "/run", inp, {"Idempotency-Key": key})
while True:
j = api("GET", "/jobs/" + job["job_id"])
if j["status"] in ("succeeded", "failed", "cancelled"):
break
time.sleep(2)
reply = json.loads(j["output"]["output"]) # {summary, decision, rationale, risks, assumptions, questions}
print(j["charged_credits"], j.get("truncated"), reply.get("summary"))import { createHash } from "node:crypto";
const key = `business-case-builder:${input.task}:${createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 16)}:a1`;
const job = await api("POST", "/run", input, { "Idempotency-Key": key });
let j;
do { await new Promise((r) => setTimeout(r, 2000)); j = await api("GET", "/jobs/" + job.job_id); }
while (!["succeeded", "failed", "cancelled"].includes(j.status));
const reply = JSON.parse(j.output.output);
console.log(j.charged_credits, j.truncated, reply.summary);sum := sha256.Sum256(raw) // add "crypto/sha256", "encoding/hex", "time" to the imports
key := "business-case-builder:" + input["task"].(string) + ":" + hex.EncodeToString(sum[:8]) + ":a1"
job, _ := api("POST", "/run", input, map[string]string{"Idempotency-Key": key})
var j map[string]any
for {
time.Sleep(2 * time.Second)
j, _ = api("GET", "/jobs/"+job["job_id"].(string), nil, nil)
if s := j["status"]; s == "succeeded" || s == "failed" || s == "cancelled" { break }
}
fmt.Println(j["charged_credits"], j["truncated"], j["output"].(map[string]any)["output"])var digest = java.security.MessageDigest.getInstance("SHA-256").digest(M.writeValueAsBytes(input));
String key = "business-case-builder:" + input.get("task") + ":" + HexFormat.of().formatHex(digest, 0, 8) + ":a1";
JsonNode job = api("POST", "/run", input, Map.of("Idempotency-Key", key)), j;
do { Thread.sleep(2000); j = api("GET", "/jobs/" + job.get("job_id").asText(), null, null); }
while (!Set.of("succeeded", "failed", "cancelled").contains(j.get("status").asText()));
JsonNode reply = M.readTree(j.get("output").get("output").asText());
System.out.println(j.get("charged_credits") + " " + reply);require "digest"
key = "business-case-builder:#{input["task"]}:#{Digest::SHA256.hexdigest(JSON.generate(input))[0, 16]}:a1"
job = api("POST", "/run", input, { "Idempotency-Key" => key })
j = nil
loop do
sleep 2
j = api("GET", "/jobs/#{job["job_id"]}")
break if %w[succeeded failed cancelled].include?(j["status"])
end
reply = JSON.parse(j["output"]["output"])
puts [j["charged_credits"], j["truncated"], reply["summary"]].inspect$key = "business-case-builder:" . $input["task"] . ":" . substr(hash("sha256", json_encode($input)), 0, 16) . ":a1";
$job = api("POST", "/run", $input, ["Idempotency-Key" => $key]);
do { sleep(2); $j = api("GET", "/jobs/" . $job["job_id"]); }
while (!in_array($j["status"], ["succeeded", "failed", "cancelled"]));
$reply = json_decode($j["output"]["output"], true);
echo $j["charged_credits"], " ", $reply["summary"], "\n";var digest = System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(input.ToJsonString()));
var key = $"business-case-builder:{input["task"]}:{Convert.ToHexString(digest, 0, 8).ToLowerInvariant()}:a1";
var job = await Api.Call("POST", "/run", input, new() { ["Idempotency-Key"] = key });
JsonNode j;
do { await Task.Delay(2000); j = (await Api.Call("GET", "/jobs/" + job!["job_id"]))!; }
while (!new[] { "succeeded", "failed", "cancelled" }.Contains(j["status"]!.GetValue<string>()));
var reply = JsonNode.Parse(j["output"]!["output"]!.GetValue<string>());
Console.WriteLine($"{j["charged_credits"]} {reply}");Step 6 — or stream it
/run-stream sends Server-Sent Events while the job runs and the finished job at the end.
# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: business-case-builder:case:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.jsonrin = json.load(open("input.json")) # {"task": "case", "project": "Our 40 support agents work from a shared inbox. Replies are slow and things get lost, and engineering gets pulled into escalations. We are looking at buying a helpdesk tool instead of the shared inbox.", "name": "Helpdesk software", "lines": "c1 | cost | Licences | as typed: Licences, 40 seats x $55 a month | $26,400 a year\nc2 | cost | Implementation partner | as typed: Implementation partner, $45,000 once | $45,000 once\nc3 | cost | Training | as typed: Training, $12,000 once | $12,000 once\nc4 | cost | Integration upkeep | as typed: Integration upkeep, $9,000 a year | $9,000 a year\nb1 | benefit | Agent time saved | as typed: Agent time saved, 12 hours a week x $38, medium | $23,712 a year | medium confidence\nb2 | benefit | Fewer escalations to engineering | as typed: Fewer escalations to engineering, $25,000 a year, low | $25,000 a year | low confidence\nb3 | benefit | Customers kept by faster replies | as typed: Customers kept by faster replies, $30,000 a year, low | $30,000 a year | low confidence", "figures": "Horizon: 3 years; discount rate 10%; hurdle rate 10%; benefits start right away\nOne-time costs: $57,000; running costs per year: $35,400; benefits per full year: $78,712\n3-year total cost (TCO): $163,200\n3-year benefits: $236,136\nNPV (10% discount): $50,711\nRisk-adjusted NPV: -$32,420\nIRR: 56.0%\nPayback period: 15.8 months\nDiscounted payback: 16.9 months\nROI: 45%\nYear 1: costs $92,400, benefits $78,712, net -$13,688, cumulative -$13,688\nYear 2: costs $35,400, benefits $78,712, net $43,312, cumulative $29,624\nYear 3: costs $35,400, benefits $78,712, net $43,312, cumulative $72,936\nBase case (benefits x1, 10%): NPV $50,711, payback 15.8 months\nConservative (benefits x0.75, 15%): NPV -$3,038, payback 28.9 months\nOptimistic (benefits x1.25, 8%): NPV $105,331, payback 10.9 months\nPessimistic (benefits x0.6, 12%): NPV -$28,593, payback not within 3 years\nBenefits can fall 26% before NPV reaches zero", "verdict": "GO IF | Go, if the assumptions hold: positive in the base case, negative in the conservative one", "checks": "note | Training, change management and delays are often left out. Turn on the 30% buffer under More options to see if the case still holds.\nwatch | Most of the benefit (70%) is marked low confidence. The risk-adjusted NPV, -$32,420, counts low-confidence benefits at half.\nwatch | The conservative scenario (benefits x0.75 at 15%) turns NPV negative: -$3,038. Test the biggest benefit before committing.", "clip_note": ""}
req = urllib.request.Request(BASE + "/run-stream", method="POST", data=json.dumps(rin).encode(),
headers={"Content-Type": "application/json", "Authorization": "Bearer " + TOKEN,
"Idempotency-Key": "business-case-builder:case:" + hashlib.sha256(json.dumps(rin).encode()).hexdigest()[:16] + ":a1"})
with urllib.request.urlopen(req) as r:
for line in r:
line = line.decode().strip()
if line.startswith("data:"):
print(line[5:].strip()[:200])const rin = JSON.parse(readFileSync("input.json", "utf8"));
const r = await fetch(BASE + "/run-stream", { method: "POST", body: JSON.stringify(rin), headers: {
"Content-Type": "application/json", Authorization: "Bearer " + TOKEN,
"Idempotency-Key": `business-case-builder:case:${createHash("sha256").update(JSON.stringify(rin)).digest("hex").slice(0, 16)}:a1` } });
const dec = new TextDecoder();
for await (const chunk of r.body) for (const line of dec.decode(chunk).split("\n"))
if (line.startsWith("data:")) console.log(line.slice(5).trim().slice(0, 200));rraw, _ := os.ReadFile("input.json") // add "bufio", "strings" to the imports
rs := sha256.Sum256(rraw)
req, _ := http.NewRequest("POST", base+"/run-stream", bytes.NewReader(rraw))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "business-case-builder:case:"+hex.EncodeToString(rs[:8])+":a1")
res, _ := http.DefaultClient.Do(req)
sc := bufio.NewScanner(res.Body)
for sc.Scan() { if l := sc.Text(); strings.HasPrefix(l, "data:") { fmt.Println(l[5:]) } }String rin = java.nio.file.Files.readString(java.nio.file.Path.of("input.json"));
var rd = java.security.MessageDigest.getInstance("SHA-256").digest(rin.getBytes());
var sreq = HttpRequest.newBuilder(URI.create(BASE + "/run-stream")).header("Content-Type", "application/json")
.header("Authorization", "Bearer " + token).header("Idempotency-Key", "business-case-builder:case:" + HexFormat.of().formatHex(rd, 0, 8) + ":a1")
.POST(HttpRequest.BodyPublishers.ofString(rin)).build();
C.send(sreq, HttpResponse.BodyHandlers.ofLines()).body().filter(l -> l.startsWith("data:")).forEach(System.out::println);rin = File.read("input.json")
uri = URI(BASE + "/run-stream")
req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json", "Authorization" => "Bearer #{TOKEN}",
"Idempotency-Key" => "business-case-builder:case:#{Digest::SHA256.hexdigest(rin)[0, 16]}:a1")
req.body = rin
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |h|
h.request(req) { |res| res.read_body { |chunk| chunk.each_line { |l| puts l if l.start_with?("data:") } } }
end$rin = file_get_contents("input.json");
$ch = curl_init(BASE . "/run-stream");
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => $rin, CURLOPT_HTTPHEADER => [
"Content-Type: application/json", "Authorization: Bearer $TOKEN",
"Idempotency-Key: business-case-builder:case:" . substr(hash("sha256", $rin), 0, 16) . ":a1"],
CURLOPT_WRITEFUNCTION => function ($ch, $chunk) { foreach (explode("\n", $chunk) as $l) if (str_starts_with($l, "data:")) echo $l, "\n"; return strlen($chunk); }]);
curl_exec($ch);var rin = File.ReadAllText("input.json");
var rd = System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes(rin));
var sreq = new HttpRequestMessage(HttpMethod.Post, Api.Base + "/run-stream") { Content = new StringContent(rin, System.Text.Encoding.UTF8, "application/json") };
sreq.Headers.Add("Authorization", "Bearer " + Api.Token);
sreq.Headers.Add("Idempotency-Key", $"business-case-builder:case:{Convert.ToHexString(rd, 0, 8).ToLowerInvariant()}:a1");
using var http = new HttpClient();
using var res = await http.SendAsync(sreq, HttpCompletionOption.ResponseHeadersRead);
using var rdr = new StreamReader(await res.Content.ReadAsStreamAsync());
for (string? l; (l = await rdr.ReadLineAsync()) != null;) if (l.StartsWith("data:")) Console.WriteLine(l);