Skip to main content

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:
ColumnDescription
StatusSuccess or error
GateWhich gate handled the request
ModelThe model that was used (may differ from requested model if fallback triggered)
TokensInput + output token count
CostEstimated cost in USD
LatencyResponse time in milliseconds
TimeWhen the request was made

Filtering

Filter logs by:
  • Gate — See requests for a specific gate
  • Status — Show only successful or failed requests

Pagination

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:
FieldDescription
model_requestedModel specified in the request
model_usedModel that actually handled the request (may differ with fallback routing)
prompt_tokensInput token count
completion_tokensOutput token count
cost_usdEstimated cost
latency_msResponse time
successWhether the request completed successfully
error_messageError details (if failed)
session_idSession identifier (agent gates only)
inferred_actionWhich sub-gate or action handled the request (agent gates only)
tool_callsExtracted tool use blocks from the response
tool_resultsExtracted 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).