Skip to main content

Overview

The Logs API allows you to create, retrieve, and list conversation logs. Logs capture the complete context of interactions including messages, model information, token usage, and metadata.

Key Features

  • Create logs for conversations and API requests
  • Retrieve specific logs by ID
  • List logs with filtering and pagination
  • Track token usage and costs
  • Store custom metadata for analysis

Quick Start

Available Methods

Synchronous Methods

Asynchronous Methods

Update and delete operations are not supported for logs to maintain data integrity and audit trails.

Log Structure

A log entry contains the following key information:

Common Use Cases

1. Logging Chat Conversations

2. Tracking API Usage

3. Performance Monitoring

When listing logs, you can apply various filters:

Best Practices

1. Include Relevant Metadata

2. Log Errors and Edge Cases

3. Use Async for High Volume

Error Handling

Next Steps