curl --request GET \
--url https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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 := "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics"
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))
}HttpResponse<String> response = Unirest.get("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"by_api_key": [
{
"api_key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"api_key_name": "<string>",
"cost_usd": 123,
"requests": 123
}
],
"by_model": [
{
"cache_read_tokens": 123,
"cost_usd": 123,
"input_tokens": 123,
"model_name": "<string>",
"output_tokens": 123,
"requests": 123,
"ttft_measured_requests": 123,
"ttft_under_10s_requests": 123,
"ttft_under_5s_requests": 123,
"ttft_under_60s_requests": 123,
"avg_itl_ms": 123,
"avg_ttft_ms": 123,
"p95_itl_ms": 123,
"p95_ttft_ms": 123
}
],
"by_workspace": [
{
"cache_read_tokens": 123,
"cost_usd": 123,
"input_tokens": 123,
"output_tokens": 123,
"requests": 123,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_name": "<string>"
}
],
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_name": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"summary": {
"total_cache_read_tokens": 123,
"total_cost_usd": 123,
"total_input_tokens": 123,
"total_output_tokens": 123,
"total_requests": 123,
"ttft_measured_requests": 123,
"ttft_under_10s_requests": 123,
"ttft_under_5s_requests": 123,
"ttft_under_60s_requests": 123,
"unique_api_keys": 123
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Get organization metrics (Admin only)
Deprecated: this endpoint is moving to cloud-platform at the same path; the cloud-platform base URL will be announced. Behaviour may differ in edge cases.
Returns usage metrics for an organization including summary totals, and breakdowns by workspace, API key, and model.
Percentiles across hours are approximate (sample-weighted means of hourly percentiles).
TTFT threshold counts are exact; divide them by ttft_measured_requests, not requests / total_requests.
Admin permissions: admin session, read_write token, or read_only token. Approved read across organizations; does not mutate business state.
curl --request GET \
--url https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics \
--header 'Authorization: Bearer <token>'import requests
url = "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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 := "https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics"
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))
}HttpResponse<String> response = Unirest.get("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/admin/organizations/{org_id}/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"by_api_key": [
{
"api_key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"api_key_name": "<string>",
"cost_usd": 123,
"requests": 123
}
],
"by_model": [
{
"cache_read_tokens": 123,
"cost_usd": 123,
"input_tokens": 123,
"model_name": "<string>",
"output_tokens": 123,
"requests": 123,
"ttft_measured_requests": 123,
"ttft_under_10s_requests": 123,
"ttft_under_5s_requests": 123,
"ttft_under_60s_requests": 123,
"avg_itl_ms": 123,
"avg_ttft_ms": 123,
"p95_itl_ms": 123,
"p95_ttft_ms": 123
}
],
"by_workspace": [
{
"cache_read_tokens": 123,
"cost_usd": 123,
"input_tokens": 123,
"output_tokens": 123,
"requests": 123,
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_name": "<string>"
}
],
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organization_name": "<string>",
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"summary": {
"total_cache_read_tokens": 123,
"total_cost_usd": 123,
"total_input_tokens": 123,
"total_output_tokens": 123,
"total_requests": 123,
"ttft_measured_requests": 123,
"ttft_under_10s_requests": 123,
"ttft_under_5s_requests": 123,
"ttft_under_60s_requests": 123,
"unique_api_keys": 123
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Query Parameters
Filter consumed inference usage by grant, staking_farm, transfer, payment, or postpay. Costs include only saved matching allocations, including settlements. Each matching request and its full tokens count once; counts are not additive across credit types. Unattributed historical usage is excluded. Period totals may increase until outstanding unfunded usage is settled. Omit for all usage. Credit type for organization limits
- grant: Free credits provided by the platform
- payment: Credits purchased by the organization
- staking_farm: House of Stake farm reward units converted into credits
- postpay: Contract billing safety ceiling; usage is invoiced separately
grant, payment, staking_farm, transfer, postpay Response
Organization metrics retrieved successfully
Complete organization metrics response