curl -sS -X POST https://www.vantageai.cc/api/ci/finops-report \
-H "Content-Type: application/json" \
-d '{
"current": {"runs": [{
"scenario_id": "de_sql_optimization_v1",
"model_id": "openai/gpt-4o-mini",
"rubric_total_25": 20,
"llm_calls": 2,
"cost_usd_per_run": 0.0012,
"passed": true
}]},
"baseline": {"runs": [{
"scenario_id": "de_sql_optimization_v1",
"model_id": "openai/gpt-4o-mini",
"rubric_total_25": 19,
"llm_calls": 2,
"cost_usd_per_run": 0.0015,
"passed": true
}]},
"traffic": {"interactions_per_biz_day": 5000, "biz_days_per_month": 22, "label": "internal SQL agents"}
}'
- name: RuntimeAI FinOps PR comment
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install -q requests || true
python3 <<'PY'
import json, os, urllib.request
# pr-results.json / main-results.json — export from vantage-core or RuntimeAI batch
current = json.load(open("pr-results.json"))
baseline = json.load(open("main-results.json")) if os.path.isfile("main-results.json") else {"runs": []}
payload = {
"current": current.get("runs", current),
"baseline": baseline.get("runs", baseline),
"traffic": {"interactions_per_biz_day": 5000, "biz_days_per_month": 22, "label": "enterprise CS"},
}
req = urllib.request.Request(
"https://www.vantageai.cc/api/ci/finops-report",
data=json.dumps(payload).encode(),
headers={"Content-Type": "application/json"},
method="POST",
)
report = json.loads(urllib.request.urlopen(req, timeout=60).read())
body = report["markdown_pr_comment"]
pr = os.environ["GITHUB_EVENT_PATH"]
event = json.load(open(pr))
pr_number = event["pull_request"]["number"]
repo = os.environ["GITHUB_REPOSITORY"]
post = urllib.request.Request(
f"https://api.github.com/repos/{repo}/issues/{pr_number}/comments",
data=json.dumps({"body": body}).encode(),
headers={
"Authorization": f"Bearer {os.environ['GITHUB_TOKEN']}",
"Accept": "application/vnd.github+json",
"Content-Type": "application/json",
},
method="POST",
)
urllib.request.urlopen(post, timeout=30)
open("finops-report.md", "w").write(report["markdown_artifact"])
print("Posted FinOps comment; wrote finops-report.md")
PY
# Upload finops-report.md as a workflow artifact in a follow-up step if desired.