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:
| Param | Description |
|---|---|
start, end | RFC3339 time bounds |
model | Filter by model |
provider | Filter by provider |
limit | Max entries (default 100) |
offset | Skip 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
| Symptom | Cause | Fix |
|---|---|---|
401 | Missing or invalid API key | Send Authorization: Bearer pt_live_.... |
| Older entries missing | API returns recent activity only | Use the dashboard Analytics view for full history. |
total_cost_usd is 0 | Model missing from the pricing table | Use a listed model. See Providers and models. |
Next steps
- Full endpoint details: API reference
- Understand the cost numbers: Cost estimation