Skip to Content
How-to guidesRead your logs and costs

Read your logs and costs

PlainField records every request you send. This guide shows the two ways to read that data back: visually in the dashboard, or programmatically through the REST API.

In the dashboard

Open Analytics in the dashboard for the complete picture: an overview of spend, request counts, latency, error rates, and token usage, with charts over time, a per-prompt breakdown, and a request log. Filter by model, provider, and date range. This is the recommended way to explore your usage and history.

Through the REST API

The REST API returns your most recent requests and a cost summary. Authenticate every call with your PlainField API key.

List recent logs

curl 'https://api.plainfield-ai.com/api/logs?limit=10&provider=openai' \ -H 'Authorization: Bearer pt_live_...'

Returns the most recent entries first (default limit 100). Filter with:

ParamDescription
start, endRFC3339 time bounds
modelFilter by model
providerFilter by provider
limitMax entries (default 100)
offsetSkip N entries

Get one log entry

curl 'https://api.plainfield-ai.com/api/logs/<uuid>' \ -H 'Authorization: Bearer pt_live_...'

Returns a single entry by its UUID.

Get a cost summary

curl 'https://api.plainfield-ai.com/api/costs?start=2026-01-01T00:00:00Z' \ -H 'Authorization: Bearer pt_live_...'

Response, broken down by model:

{ "total_requests": 42, "total_cost_usd": 0.0123, "total_input_tokens": 10000, "total_output_tokens": 5000, "by_model": { "gpt-4o-mini": { "requests": 42, "cost_usd": 0.0123, "input_tokens": 10000, "output_tokens": 5000 } } }

REST API vs the dashboard

The REST API is fast and convenient for scripts and lightweight checks, but it returns only recent activity. For complete, durable history and rich breakdowns, use the Analytics view in the dashboard.

Common errors

SymptomCauseFix
401Missing or invalid API keySend Authorization: Bearer pt_live_....
Older entries missingAPI returns recent activity onlyUse the dashboard Analytics view for full history.
total_cost_usd is 0Model missing from the pricing tableUse a listed model. See Providers and models.

Next steps

Last updated on