Skip to content
Docs
GitHub

Show what a session spent

Preview

Show what a session spent: totals by cost category (uncached prompt, cache read, cache write, output), spend per hour and per turn, what started the turns, tool calls, and sandbox running time.

Public APIEverruns Cloud and self-hosted Platform

GET/v1/sessions/{session_id}/cost

See authentication for credentials and permissions.

session_id
required
string

Prefixed public identifier

Responses

200Success

Success

Media typeapplication/json

What a session spent, split by cost category, over time, by what started each turn, by tool, and by sandbox.

object
categories
required

Spend and tokens per cost category, in a fixed order: uncached_input, cache_read, cache_write, output.

Array<object>

Spend and tokens of one cost category.

object
key
required

uncached_input, cache_read, cache_write or output.

string
tokens
required

Tokens in this category across every model call.

integer format: int64
usd
required

USD, from each call’s cost split by the model’s price table.

number format: double
hours
required

Spend per UTC hour that had model calls, oldest first.

Array<object>

Spend in one UTC hour, by category.

object
cache_read_usd
required

USD of prompt tokens read from cache.

number format: double
cache_write_usd
required

USD of prompt tokens written to cache.

number format: double
hour
required

Start of the hour (UTC).

string format: date-time
model_calls
required

Model calls made in the hour.

integer format: int64
output_usd
required

USD of output tokens.

number format: double
unattributed_usd
required

Spend with no category split (see SessionCost.unattributed_usd).

number format: double
uncached_input_usd
required

USD of prompt tokens not read from cache.

number format: double
model_calls
required

Model calls recorded for the session.

integer format: int64
models
required

Spend per model, largest first.

Array<object>

Spend of one model.

object
calls
required

Model calls made with this model.

integer format: int64
model
required

Model id as the provider reported it.

string
provider

Provider driver that served the model, when known.

string | null
usd
required

Spend in USD on this model.

number format: double
sandboxes
required

Sandboxes the session ran, oldest first.

Array<object>

A sandbox the session ran and how long it ran.

object
created_at
required

When the sandbox was created.

string format: date-time
paused_seconds
required

Seconds the sandbox spent paused.

integer format: int64
profile_name

Sandbox template profile, when one was used.

string | null
provider
required

Sandbox provider, e.g. daytona or e2b.

string
running_seconds
required

Seconds the sandbox spent running.

integer format: int64
sandbox_id
required

Sandbox’s prefixed public identifier.

string
spans
required

Lifecycle spans, oldest first.

Array<object>

A span of time a Sandbox spent in one state.

object
current
required

The Sandbox is still in this state.

boolean
end
required
string format: date-time
generation
required

Incarnation during the span.

integer format: int64
start
required
string format: date-time
state
required

Fleet state during the span.

string
session_id
required

Session’s prefixed public identifier.

string
sources
required

Turns and spend by what started them, largest spend first.

Array<object>

Turns and spend of one origin.

object
active

The schedule still fires: enabled and not deleted.

boolean | null
cron

Cron expression of a recurring schedule.

string | null
kind
required

user, schedule, agent_trigger, channel, …

string
name

The schedule’s description, when it is a session schedule.

string | null
source_id

The schedule, trigger or channel, when there is one.

string | null
turns
required

Turns this origin started.

integer format: int64
usd
required

Spend in USD on those turns.

number format: double
tools
required

Tool calls across the session.

object
calls
required

Tool calls across the session.

integer format: int64
duration_ms
required

Summed running time of every call.

integer format: int64
failed
required

Tool calls that ended in an error.

integer format: int64
items
required

Per tool, most calls first.

Array<object>

Calls, failures and running time of one tool.

object
calls
required

Calls of this tool.

integer format: int64
duration_ms
required

Summed running time of its calls.

integer format: int64
failed
required

Calls of this tool that ended in an error.

integer format: int64
name
required

Tool name.

string
total_usd
required

Total spend in USD: the provider-reported cost of each model call where reported, otherwise the price-table estimate.

number format: double
turns
required

Spend per turn, oldest first; the newest turns when turns_truncated.

Array<object>

Spend of one turn.

object
prompt_tokens
required

Prompt tokens of the turn, cached and uncached.

integer format: int64
source_kind
required

What started the turn: user, schedule, agent_trigger, channel, …

string
started_at
required

When the turn started.

string format: date-time
status
required

running, completed, failed, cancelled or sealed.

string
turn
required

Per-session turn number, 1-based.

integer format: int32
turn_id
required

Turn’s prefixed public identifier.

string
usd
required

Spend in USD on the model calls of the turn.

number format: double
turns_truncated
required

Older turns were left out of turns.

boolean
unattributed_usd
required

Spend of model calls whose split by category is unknown: the provider reported a cost but the model has no price table.

number format: double
unpriced_calls
required

Model calls with no reported cost and no price-table estimate. They count tokens but add nothing to total_usd.

integer format: int64

Example

{
"categories": [
{
"key": "uncached_input",
"tokens": 1060877013,
"usd": 106.09
}
],
"model_calls": 3811,
"models": [
{
"calls": 3811,
"model": "meta/muse-spark-1.3-contributor",
"provider": "openrouter",
"usd": 106.26
}
],
"sandboxes": [
{
"paused_seconds": 1860,
"provider": "daytona",
"running_seconds": 4320,
"sandbox_id": "sandbox_01a1510c99c8714eabb22a463e7c1fa1",
"spans": [
{
"state": "running"
}
]
}
],
"session_id": "session_01a1510c99c8714eabb22a463e7c1fa1",
"sources": [
{
"cron": "*/5 * * * *",
"kind": "schedule",
"name": "Shipmail claim poll",
"source_id": "sched_01a1510ebffc7370a495ed68cc7f9ab3",
"turns": 1845,
"usd": 106.11
}
],
"tools": {
"calls": 1977,
"duration_ms": 645000,
"failed": 14,
"items": [
{
"calls": 1180,
"duration_ms": 627000,
"failed": 13,
"name": "web_fetch"
}
]
},
"total_usd": 106.26,
"turns": [
{
"prompt_tokens": 2034790,
"source_kind": "schedule",
"status": "completed",
"turn": 1162,
"turn_id": "turn_01a124cd7e9571ac95c312b3c6d0cd82",
"usd": 0.2
}
],
"unattributed_usd": 0,
"unpriced_calls": 0
}