curl --request GET \
--url https://api.pre.dev/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pre.dev/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pre.dev/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_URL => "https://api.pre.dev/v1/usage",
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://api.pre.dev/v1/usage"
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://api.pre.dev/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/v1/usage")
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_bodyUsage
Per-call headers, GET /v1/usage for totals by model, and GET /v1/generation for one call.
curl --request GET \
--url https://api.pre.dev/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pre.dev/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pre.dev/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_URL => "https://api.pre.dev/v1/usage",
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://api.pre.dev/v1/usage"
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://api.pre.dev/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/v1/usage")
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_bodyPer-call headers
| Header | Meaning |
|---|---|
x-predev-request-id | pdr_…, on every inference call; quote it when contacting support |
x-predev-credits-charged | Credits charged for this call, on completed non-streaming calls |
x-predev-credits-remaining | Workspace balance after the call; omitted when the workspace has no credit limit |
x-predev-project-id: <projectId> on a request to attribute it to one of the workspace’s projects. Ids of projects the workspace does not own are ignored.
Usage totals
GET /v1/usage returns totals for the last days days (1 to 90, default 30), broken down by model and path. The read is not charged.
curl --fail-with-body "https://api.pre.dev/v1/usage?days=30" \
-H "Authorization: Bearer $PREDEV_API_KEY"
{
"workspace": "ws_3f9a1c07b2e4d5a8",
"project": null,
"credits_remaining": 412.5,
"tier": "SoloPro",
"since": "2026-08-28T00:00:00.000Z",
"totals": { "requests": 1840, "credits": 87.5 },
"by_model": [
{
"model": "deepseek/deepseek-v4.1-flash",
"path": "/chat/completions",
"requests": 1702,
"credits": 41.2,
"prompt_tokens": 9120000,
"completion_tokens": 1410000,
"errors": 3
},
{
"model": "anthropic/claude-sonnet-5",
"path": "/messages",
"requests": 138,
"credits": 46.3,
"prompt_tokens": 610000,
"completion_tokens": 92000,
"errors": 0
}
]
}
| Field | Meaning |
|---|---|
workspace | An opaque, stable id (ws_ and 16 hex characters) for the workspace the key belongs to |
project | The project named by x-predev-project-id, or null |
credits_remaining | Current balance; null when the workspace has no credit limit |
tier | Plan tier |
since | Start of the window |
totals.requests, totals.credits | Window totals |
by_model[].model, path | One row per model and endpoint |
by_model[].requests, credits | Volume and credits for that row |
by_model[].prompt_tokens, completion_tokens | Token totals |
by_model[].errors | Requests that returned an error |
One generation
GET /v1/generation?id=<id> returns the record of one call, using the pdg-… id from the response body, or from a stream chunk once the stream ends. Only this workspace’s generations are visible. Stats can take a few seconds to appear after a call; a 404 with code not_ready means retry shortly.
curl --fail-with-body "https://api.pre.dev/v1/generation?id=pdg-7c1e4b52-9a3d-4f8e-b0c6-2d5a8e913f47" \
-H "Authorization: Bearer $PREDEV_API_KEY"
data object reports the model, timing (latency, generation_time), finish_reason, whether the call streamed or was cancelled, token counts including reasoning and cached tokens, counts of images and other attachments, and credits: the credits charged for the call.Authorizations
The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.
Headers
Attribute this call to one of the workspace's projects. An id the workspace does not own is ignored.
Query Parameters
Window length. Values outside 1 to 90 are clamped.
1 <= x <= 90Response
Usage totals.
An opaque, stable id for the workspace the key belongs to (a personal account or a team).
^ws_[0-9a-f]{16}$The project from x-predev-project-id when the workspace owns it, else null. The totals always cover the whole workspace.
Current balance. null on plans without a credit limit.
Plan tier, for example Trial or SoloPro.
Start of the window.
Show child attributes
Show child attributes
One row per model and endpoint, most credits first.
Show child attributes
Show child attributes
Was this page helpful?

