home / skills / jeremylongshore / claude-code-plugins-plus-skills / openrouter-debug-bundle

This skill helps you implement logging, timing, and debugging for OpenRouter integrations to monitor requests and diagnose issues.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill openrouter-debug-bundle

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
1.6 KB
---
name: openrouter-debug-bundle
description: |
  Execute set up comprehensive logging and debugging for OpenRouter. Use when investigating issues or monitoring requests. Trigger with phrases like 'openrouter debug', 'openrouter logging', 'openrouter trace', 'monitor openrouter'.
allowed-tools: Read, Write, Edit, Grep
version: 1.0.0
license: MIT
author: Jeremy Longshore <[email protected]>
---

# Openrouter Debug Bundle

## Overview

This skill shows how to implement request/response logging, timing metrics, and debugging utilities for OpenRouter integrations.

## Prerequisites

- OpenRouter integration
- Logging infrastructure (optional but recommended)

## Instructions

Follow these steps to implement this skill:

1. **Verify Prerequisites**: Ensure all prerequisites listed above are met
2. **Review the Implementation**: Study the code examples and patterns below
3. **Adapt to Your Environment**: Modify configuration values for your setup
4. **Test the Integration**: Run the verification steps to confirm functionality
5. **Monitor in Production**: Set up appropriate logging and monitoring

## Output

Successful execution produces:
- Working OpenRouter integration
- Verified API connectivity
- Example responses demonstrating functionality

## Error Handling

See `{baseDir}/references/errors.md` for comprehensive error handling.

## Examples

See `{baseDir}/references/examples.md` for detailed examples.

## Resources

- [OpenRouter Documentation](https://openrouter.ai/docs)
- [OpenRouter Models](https://openrouter.ai/models)
- [OpenRouter API Reference](https://openrouter.ai/docs/api-reference)
- [OpenRouter Status](https://status.openrouter.ai)

Overview

This skill implements comprehensive logging and debugging utilities for OpenRouter integrations. It packages request/response logging, timing metrics, and practical debugging helpers to accelerate troubleshooting and monitoring. Use it to validate connectivity, capture failures, and observe model interaction patterns in development or production.

How this skill works

The skill instruments OpenRouter client calls to capture requests, responses, HTTP metadata, and latency metrics. It writes structured logs suitable for local files or external logging backends and includes toggleable verbosity levels and sampling options. Quick verification steps and environment-specific configuration make it easy to adapt and test safely.

When to use it

  • Investigating sporadic errors or unexpected model outputs from OpenRouter
  • Setting up observability for a new OpenRouter integration before production rollout
  • Collecting latency and throughput metrics to inform scaling decisions
  • Monitoring request patterns and payloads during load testing
  • Auditing API usage and debugging authentication or permission issues

Best practices

  • Enable structured JSON logging to simplify parsing and downstream analysis
  • Mask or redact sensitive data (PII, credentials, secrets) before persisting logs
  • Use sampling for high-volume traffic and increase retention for error traces
  • Route logs to a centralized logging service (ELK, Datadog, CloudWatch) in production
  • Control verbosity via environment flags and keep debug enabled only when needed

Example use cases

  • Capture full request/response pairs during a failed model call to reproduce and fix payload issues
  • Measure average and p95 latency for OpenRouter calls to inform autoscaling rules
  • Trace authentication failures by logging headers, tokens (redacted), and endpoint responses
  • Correlate client request IDs with OpenRouter request IDs to follow a request across services
  • Run a local test harness that exercises several models and stores example responses for QA

FAQ

Will logs contain API keys or user PII?

No. The bundle recommends and includes redaction hooks; you should configure filters to remove sensitive fields before persisting logs.

Can I toggle debugging without redeploying?

Yes. The implementation supports environment flags or runtime endpoints to change verbosity and sampling without full redeploys.