Inspect

Get session cost

Best-effort refresh the session durable-object export and return the latest persisted token totals and cost for a specific session. This can be used while a session is still running, without waiting for the scheduled export job. Laminar-runtime sessions return Laminar usage totals, including the usage of the session's subagents such as Verification agent runs, and messageCount is always 0 for them. Use GET /sessions/{session_id}/subagents/{subagent_id}/cost for a single subagent's usage. A Laminar-runtime session that was never bound to a Laminar session returns zero totals.

Base URL
GET
/api/public/v1/sessions/{session_id}/cost

Best-effort refresh the session durable-object export and return the latest persisted token totals and cost for a specific session. This can be used while a session is still running, without waiting for the scheduled export job. Laminar-runtime sessions return Laminar usage totals, including the usage of the session's subagents such as Verification agent runs, and messageCount is always 0 for them. Use GET /sessions/{session_id}/subagents/{subagent_id}/cost for a single subagent's usage. A Laminar-runtime session that was never bound to a Laminar session returns zero totals.

Authorization

bearerAuth
headerAuthorizationBearer <token>

API key authentication. Use your API key as the bearer token.

Path Parameters

session_id*string

The unique identifier of the session

Response Body

Latest session cost and token totals

application/json
  1. response
data*
Example Request
curl -X GET 'https://your-org.inspect.com/api/public/v1/sessions/string/cost'
Example Response
{  "data": {    "sessionId": "string",    "messageCount": 0,    "totalInputTokens": 0,    "totalOutputTokens": 0,    "totalReasoningTokens": 0,    "totalCacheReadTokens": 0,    "totalCacheWriteTokens": 0,    "totalTokens": 0,    "totalCost": 0.1,    "updatedAt": "2019-08-24T14:15:22Z"  }}