NylorunDocsBeta
Runtime APISessions

Read a session's recorded model usage

GET
/v1/sessions/{sessionId}/usage

Authorization

applicationKey
headerAuthorizationBearer <token>

An application key of the Tenant (PUT /v1/tenant/keys/{keyId}), or Studio's key, derived from the admin key. With Nylorun-Subject and Nylorun-Scopes, it acts for that person, narrowed to those scopes. Never accepted from a browser (Origin).

Path Parameters

sessionId*string

Query Parameters

turnId?string

Header Parameters

Nylorun-Protocol*string

The protocol version, 8

Response Body

Recorded usage, including duplicate billed calls

application/json
  1. response
sessionId*string
turnId*string|null
asOf*string
inputTokens*integer
Range0 <= value
outputTokens*integer
Range0 <= value
totalTokens*integer
Range0 <= value
cachedTokens*integer
Range0 <= value
cacheWriteTokens*integer
Range0 <= value
reasoningTokens*integer
Range0 <= value
costUsd*number
Range0 <= value
calls*integer
Range0 <= value
duplicates*integer
Range0 <= value
unpricedCalls*integer
Range0 <= value
unreportedCalls*integer
Range0 <= value
unknownQualityCalls*integer
Range0 <= value
import { createClient } from "@nylorun/agents";const client = await createClient();const usage = await client.session("ses_123").usage();
{  "sessionId": "string",  "turnId": "string",  "asOf": "string",  "inputTokens": 0,  "outputTokens": 0,  "totalTokens": 0,  "cachedTokens": 0,  "cacheWriteTokens": 0,  "reasoningTokens": 0,  "costUsd": 0,  "calls": 0,  "duplicates": 0,  "unpricedCalls": 0,  "unreportedCalls": 0,  "unknownQualityCalls": 0}