Where the credits went this month
By product AND by origin, so you can tell your script from your team's browser. Origin is read from the debit that paid for a job: a refund does not record which surface made it.
curl https://api.auray.ai/v1/usage \
-H "Authorization: Bearer $AURAY_API_KEY"import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
console.log(await auray.platform.usage());from auray_client import Client
auray = Client() # reads AURAY_API_KEY
print(auray.platform.usage()){
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_account",
"arguments": {
"usage": true
}
}
}const res = await fetch("https://api.auray.ai/v1/usage", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.AURAY_API_KEY}` },
});
console.log(await res.json());import os, requests
r = requests.get(
"https://api.auray.ai/v1/usage",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
)
r.raise_for_status()
print(r.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.auray.ai/v1/usage", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AURAY_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("https://api.auray.ai/v1/usage");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AURAY_API_KEY"),
],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;require "net/http"
uri = URI("https://api.auray.ai/v1/usage")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.bodyimport java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.auray.ai/v1/usage"))
.header("Authorization", "Bearer " + System.getenv("AURAY_API_KEY"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AURAY_API_KEY"));
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.auray.ai/v1/usage");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");{
"object": "<string>",
"period": "<string>",
"window": "<string>",
"credits": {
"balance": 123,
"monthly_allowance": 123,
"spent_this_period": 123,
"refunded_this_period": 123,
"net_this_period": 123,
"waived_this_period": 123,
"waived_jobs_this_period": 123
},
"by_product": [
{
"product": "<string>",
"origin": "<string>",
"spent": 123,
"refunded": 123,
"net": 123,
"jobs": 123,
"waived": 123,
"waived_jobs": 123
}
],
"keys": {},
"keys_truncated": true,
"rate_limits": {},
"warmup_ends_at": "<string>",
"report": {},
"note": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}Authorizations
Bearer auray_sk_… — Any key. The read bucket paces it.
Query Parameters
report covers: this calendar month (the default), the last one, the last ninety days, or the last twelve months. One of "month", "last_month", "90d", "12m".csv answers one row per charged job in the window — what it cost, what came back, the key it went through and where it came in (door, the last column: desktop, api, mcp, or unknown for a key's job charged before the API and MCP were recorded apart) — instead of the document. One of "json", "csv".OK
"usage".report covers. One of "month", "last_month", "90d", "12m".Show child attributes
Show child attributes
external is every model somebody else runs, submitted by its address; embeddings is POST /embeddings on the OpenAI-compatible server; the desktop's Code product charges it too, and there is no POST /code — code can be spent, but not submitted from this API. director is the AI Director's rounds in a Cinema Studio project, spent from the desktop and not submitted from this API; what it starts is charged to each model's own product. The monthly grant is not a product here; it is credits.monthly_allowance. One of "photo", "music", "video", "threed", "external", "chat", "code", "embeddings", "director".ui is the jobs tables' word for app and never reaches this field. The ledger's third origin, admin, marks an adjustment of ours, which is booked to the non-spendable platform product and so never appears in this list. One of "api", "app".credits_spent_period against its own ceiling (credit_ceiling, null when the key has none). The desktop's own session keys are not listed.keys is not all of them. The ones left out are the least recently used; the credit figures above are summed from the ledger and still count every key.read, write, generate, interactive and egress — as {capacity, refill_per_second}, at the strength the key is admitted at now: the plan's figures in force, and during the account's warm-up — the plan's own hours after sign-up — its warm-up share of them (limits.api.warmup on GET /v1/plans; see warmup_ends_at). egress is in megabytes. A capacity of zero is a bucket the plan does not have.rate_limits steps up to the plan's full figures; null once it has, or when the plan has no warm-up. May be null.window: totals, products, origins, doors (doors: desktop, api, mcp, and unknown for a key's jobs charged before the API and MCP were recorded apart), a series, keys, models, the language models' tokens by door, the balance's purchased and granted parts, the promotion seat, and the platform's grants and adjustments. Every figure is read from the credit ledger; one that could not be read is 503 usage_unavailable, never a zero.origin is taken from the debit that paid for a job, because a refund does not record which surface made it, and the numbers cover the current calendar month.Headers:
| Header | Description |
|---|---|
RateLimit-Limit | Burst capacity. |
RateLimit-Remaining | |
RateLimit-Reset | Seconds until refill. |
X-RateLimit-Limit | |
X-RateLimit-Remaining | |
X-RateLimit-Reset | Unix seconds. The X- spelling is what client libraries read. |
X-Request-Id |
export_too_large — the CSV for this window would carry more debits than one file holds. Or usage_window_too_large — the document for this window would read more of your ledger than one request is given time for. Either is the window, not a failed read: ask for a narrower one.
The error body: error, message, docs (the entry that explains it) and request_id.
profile_read_failed — the plan your account holds could not be resolved, so the allowance could not be stated.
The error body: error, message, docs (the entry that explains it) and request_id.
Was this page helpful?
curl https://api.auray.ai/v1/usage \
-H "Authorization: Bearer $AURAY_API_KEY"import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
console.log(await auray.platform.usage());from auray_client import Client
auray = Client() # reads AURAY_API_KEY
print(auray.platform.usage()){
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_account",
"arguments": {
"usage": true
}
}
}const res = await fetch("https://api.auray.ai/v1/usage", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.AURAY_API_KEY}` },
});
console.log(await res.json());import os, requests
r = requests.get(
"https://api.auray.ai/v1/usage",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
)
r.raise_for_status()
print(r.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.auray.ai/v1/usage", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AURAY_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("https://api.auray.ai/v1/usage");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AURAY_API_KEY"),
],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;require "net/http"
uri = URI("https://api.auray.ai/v1/usage")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.bodyimport java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.auray.ai/v1/usage"))
.header("Authorization", "Bearer " + System.getenv("AURAY_API_KEY"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AURAY_API_KEY"));
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.auray.ai/v1/usage");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");{
"object": "<string>",
"period": "<string>",
"window": "<string>",
"credits": {
"balance": 123,
"monthly_allowance": 123,
"spent_this_period": 123,
"refunded_this_period": 123,
"net_this_period": 123,
"waived_this_period": 123,
"waived_jobs_this_period": 123
},
"by_product": [
{
"product": "<string>",
"origin": "<string>",
"spent": 123,
"refunded": 123,
"net": 123,
"jobs": 123,
"waived": 123,
"waived_jobs": 123
}
],
"keys": {},
"keys_truncated": true,
"rate_limits": {},
"warmup_ends_at": "<string>",
"report": {},
"note": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"docs": "<string>",
"request_id": "<string>"
}