Overview
Every request through Layer is logged with comprehensive metadata. Logs let you inspect individual requests, debug issues, and understand how your gates are performing.
Viewing Logs
Go to Dashboard → Logs to see a table of all requests with:
| Column | Description |
|---|
| Status | Success or error |
| Gate | Which gate handled the request |
| Model | The model that was used (may differ from requested model if fallback triggered) |
| Tokens | Input + output token count |
| Cost | Estimated cost in USD |
| Latency | Response time in milliseconds |
| Time | When the request was made |
Filtering
Filter logs by:
- Gate — See requests for a specific gate
- Status — Show only successful or failed requests
Logs are paginated with 50 entries per page by default.
Request Detail
Click any log entry to see full details:
Overview
- Status, timestamp, gate name, model used
- Token breakdown (input/output), cost, latency
Error Details
If the request failed, the error message and details are shown.
Request Payload
The full JSON request sent to the provider, including:
- Messages array
- System prompt
- Tool definitions
- Model parameters (temperature, max_tokens, etc.)
Response Payload
The full JSON response from the provider, including:
- Generated content
- Usage statistics
- For image generation: inline preview with copy/download options
- For tool calls: extracted tool use blocks
What’s Tracked
Every request log captures:
| Field | Description |
|---|
model_requested | Model specified in the request |
model_used | Model that actually handled the request (may differ with fallback routing) |
prompt_tokens | Input token count |
completion_tokens | Output token count |
cost_usd | Estimated cost |
latency_ms | Response time |
success | Whether the request completed successfully |
error_message | Error details (if failed) |
session_id | Session identifier (agent gates only) |
inferred_action | Which sub-gate or action handled the request (agent gates only) |
tool_calls | Extracted tool use blocks from the response |
tool_results | Extracted tool results from the request |
Logs API
Query logs programmatically:
# List recent logs
curl "https://api.uselayer.ai/v1/logs?limit=20" \
-H "Authorization: Bearer layer_your_key"
# Filter by gate
curl "https://api.uselayer.ai/v1/logs?gateId=your-gate-id&limit=20" \
-H "Authorization: Bearer layer_your_key"
# Get overview analytics
curl "https://api.uselayer.ai/v1/logs/overview" \
-H "Authorization: Bearer layer_your_key"
The overview endpoint returns aggregated stats:
- Total requests, total cost, average latency
- Active gate count
- Recent request summaries
Data Retention
Request logs, including full request and response payloads, are retained according to your plan tier. The payloads contain the actual prompts and completions sent to/from providers.
A future update will add privacy controls allowing you to opt out of storing request/response content while still tracking metadata (cost, latency, tokens, success).