Read a subject's rolling AI spend
curl --request GET \
--url http://172.16.0.1:9090/rig/v1/usageimport requests
url = "http://172.16.0.1:9090/rig/v1/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://172.16.0.1:9090/rig/v1/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9090",
CURLOPT_URL => "http://172.16.0.1:9090/rig/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://172.16.0.1:9090/rig/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://172.16.0.1:9090/rig/v1/usage")
.asString();require 'uri'
require 'net/http'
url = URI("http://172.16.0.1:9090/rig/v1/usage")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"subject": "tenant-42",
"window_seconds": 86400,
"credits": 0.00072,
"credits_micro": 720,
"input_tokens": 8,
"output_tokens": 10,
"requests": 1
}"<string>"Managed Proxy
Get Subject Usage
Read one end-user (subject)‘s AI spend over a rolling window, from inside the workspace VM.
GET
/
rig
/
v1
/
usage
Read a subject's rolling AI spend
curl --request GET \
--url http://172.16.0.1:9090/rig/v1/usageimport requests
url = "http://172.16.0.1:9090/rig/v1/usage"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('http://172.16.0.1:9090/rig/v1/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9090",
CURLOPT_URL => "http://172.16.0.1:9090/rig/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://172.16.0.1:9090/rig/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://172.16.0.1:9090/rig/v1/usage")
.asString();require 'uri'
require 'net/http'
url = URI("http://172.16.0.1:9090/rig/v1/usage")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"subject": "tenant-42",
"window_seconds": 86400,
"credits": 0.00072,
"credits_micro": 720,
"input_tokens": 8,
"output_tokens": 10,
"requests": 1
}"<string>"This endpoint is served by the in-VM managed proxy at
http://172.16.0.1:9090, not the public api.rigbox.dev gateway. It is IP-attested and scoped to the calling workspace’s owner — you can only read your own subjects.Query Parameters
The end-user id (the value sent as X-Rigbox-Subject / OpenAI user).
Example:
"tenant-42"
Rolling window: 30s/15m/5h/7d or a bare number of seconds. Defaults to 86400 (24h).
Example:
"24h"
Response
The subject's usage over the window.