Usage detail for a chat
GET
/api/workspaces/{workspaceId}/usage/by-chat/{chatId}
const url = 'http://localhost:8080/api/workspaces/example/usage/by-chat/example';const options = {method: 'GET', headers: {cookie: 'auth_session=<auth_session>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:8080/api/workspaces/example/usage/by-chat/example \ --cookie auth_session=<auth_session>Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
chatId
required
string
Responses
Section titled “Responses”Per-chat usage detail.
Media typeapplication/json
object
chatId
required
string
totals
required
object
inputTokens
required
number
outputTokens
required
number
cacheReadTokens
required
number
cacheWriteTokens
required
number
reasoningTokens
required
number
totalTokens
required
number
costUsd
required
number
invocations
required
Array<object>
object
key
additional properties
Example generated
{ "chatId": "example", "totals": { "inputTokens": 1, "outputTokens": 1, "cacheReadTokens": 1, "cacheWriteTokens": 1, "reasoningTokens": 1, "totalTokens": 1, "costUsd": 1 }, "invocations": [ { "additionalProperty": "example" } ]}Invalid request
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}Authentication required
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}Forbidden
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}Not found
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}Conflict
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}Internal server error
Media typeapplication/json
object
success
boolean
error
required
string
Example
{ "error": "Human-readable error message"}