curl --request GET \
--url https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {}
}{
"error": {
"code": "forbidden_scope",
"message": "API key is missing required scope: budgets:write",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "forbidden_scope",
"message": "API key is missing required scope: budgets:write",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}Get the AI cost of a pull request
The live AI cost of one GitHub pull request, open or merged, using the PR facts from the nightly ingest. method says how it was priced: agent (the nOps AI ROI Agent sessions linked to the PR), work_window (the author’s AI spend over the PR’s window, shared with their other PRs in progress) release (a release PR priced as the feature PRs it carries; executives only) or unmatched_author (no linked session and the author’s GitHub login is tied to no one, so costUsd is null). final and dataThrough say how settled the number is. Results are cached for 10 minutes (cached). GitHub pull requests only. An API key reads as an executive. Returns 404 when the PR has not reached the nightly ingest yet (send its details with the POST form) or AI ROI is not available, and 409 not_ready before the first nightly build.
curl --request GET \
--url https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nops.io/v1/ai-optimization/roi/pull-requests/cost"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {}
}{
"error": {
"code": "forbidden_scope",
"message": "API key is missing required scope: budgets:write",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"error": {
"code": "forbidden_scope",
"message": "API key is missing required scope: budgets:write",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}Authorizations
Query Parameters
Was this page helpful?