Usage
Generation stats
Stats and the credits charged for one call, by its pdg- id. Use it for streamed calls.
curl -X GET "https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb"fetch("https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb", { method: "GET"})package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}import requestsurl = "https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb"response = requests.request("GET", url)print(response.text)import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.net.http.HttpResponse.BodyHandlers;import java.time.Duration;HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build();HttpRequest.Builder requestBuilder = HttpRequest.newBuilder() .uri(URI.create("https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb")) .GET() .build();try { HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString()); System.out.println("Status code: " + response.statusCode()); System.out.println("Response body: " + response.body());} catch (Exception e) { e.printStackTrace();}using System;using System.Net.Http;using System.Text;var client = new HttpClient();var response = await client.GetAsync("https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb");var responseBody = await response.Content.ReadAsStringAsync();use reqwest::{Result, Client};async fn main() -> Result<()> { let client = Client::new(); let url = "https://api.pre.dev/v1/generation?id=pdg-043293a6-d1a8-4695-81fe-603ad4661ebb"; let res = client .get(url) .send() .await? .text() .await?; println!("{}", res); Ok(())}{ "data": { "id": "pdg-043293a6-d1a8-4695-81fe-603ad4661ebb", "model": "anthropic/claude-sonnet-5", "created_at": "2026-09-27T12:00:00.000Z", "streamed": true, "cancelled": false, "latency": 1830, "generation_time": 1620, "finish_reason": "stop", "tokens_prompt": 21, "tokens_completion": 14, "native_tokens_prompt": 23, "native_tokens_completion": 14, "native_tokens_reasoning": 0, "native_tokens_cached": 0, "num_media_prompt": 0, "num_media_completion": 0, "num_search_results": 0, "credits": 0.005 }}The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.
In: header
Query Parameters
Response Body
application/json
The stats.
TypeScript Definitions
Use the response body type in TypeScript.
application/json
id is missing.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.
application/json
Missing or invalid API key.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.
application/json
not_found: no call with that id in this workspace, a call that recorded no stats (a failed call, for example), or a streamed call that is still running. not_ready: the call is found, but its stats are not available yet.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.
application/json
More than 30 failed key attempts from this IP address in the current minute.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.
application/json
Unexpected error.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.
application/json
Stats could not be read. Retry in a few seconds.
TypeScript Definitions
Use the response body type in TypeScript.
An error raised by pre.dev, in the OpenAI error shape with an extra predev object (absent on catalog_unavailable from the catalog listings). Branch on error.code.