S3 / S3-Compatible

Beta

Send traces to Amazon S3 or S3-compatible storage

Amazon S3 is a scalable object storage service. OpenRouter can send traces to any S3-compatible storage, including AWS S3, Cloudflare R2, MinIO, and other compatible services.

Step 1: Create an S3 bucket and credentials

In your cloud provider’s console, create a bucket for storing traces and generate access credentials with write permissions to the bucket.

For AWS S3:

  1. Create a new S3 bucket or use an existing one
  2. Go to IAM > Users and create a new user with programmatic access
  3. Attach a policy that allows s3:PutObject on your bucket
  4. Copy the Access Key ID and Secret Access Key

For Cloudflare R2:

  1. Create a new R2 bucket in your Cloudflare dashboard
  2. Go to R2 > Manage R2 API Tokens and create a new token with write permissions
  3. Copy the Access Key ID, Secret Access Key, and your account’s S3 endpoint

Step 2: Enable Broadcast in OpenRouter

Go to Settings > Broadcast and toggle Enable Broadcast.

Enable Broadcast

Step 3: Configure S3

Click the edit icon next to S3 / S3-Compatible and enter:

  • Bucket Name: Your S3 bucket name (e.g., my-traces-bucket)
  • Region (optional): AWS region (auto-detected for AWS, required for some S3-compatible services)
  • Custom Endpoint (optional): For S3-compatible services like R2, enter the endpoint URL (e.g., https://your-account-id.r2.cloudflarestorage.com)
  • Access Key Id: Your access key ID
  • Secret Access Key: Your secret access key
  • Session Token (optional): For temporary credentials
  • Path Template (optional): Customize the object path. Default is openrouter-traces/{date}. Available variables: {prefix}, {date}, {year}, {month}, {day}, {apiKeyName}

Step 4: Test and save

Click Test Connection to verify the setup. The configuration only saves if the test passes.

Step 5: Send a test trace

Make an API request through OpenRouter and check your S3 bucket for the trace file. Each trace is saved as a separate JSON file with the format {traceId}-{timestamp}.json.

Path template examples

Customize how traces are organized in your bucket:

  • openrouter-traces/{date} - Default, organizes by date (e.g., openrouter-traces/2024-01-15/abc123-1705312800.json)
  • traces/{year}/{month}/{day} - Hierarchical date structure
  • {apiKeyName}/{date} - Organize by API key name, then date
  • production/llm-traces/{date} - Custom prefix for environment separation

For time-based batching (e.g., hourly or daily aggregated files), consider using AWS Kinesis Firehose instead, which buffers records and writes batched files to S3.