Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

openrouter-audit-logging

Skill by jeremylongshore

Adds audit logging to OpenRouter API calls in Python. It records exact cost, token counts, latency and model use in an append-only SQLite table, for developers building compliance trails or tracking usage.

  • Score 76
  • 3k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install openrouter-audit-logging

Built from the published package, never by AI.

git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-audit-logging ~/.claude/skills/openrouter-audit-logging

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install openrouter-audit-logging in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill adds audit logging to OpenRouter API calls. After each chat completion, a wrapper hashes the prompt with SHA-256, times the call, and fetches exact cost and token data from the OpenRouter generation endpoint. Each request becomes a structured audit entry saved in an append-only SQLite table, indexed on timestamp and user ID.

The skill also scrubs emails, phone numbers, SSNs, card numbers and OpenRouter keys before logging, and stores only prompt hashes, not raw prompts. It includes SQL queries for daily cost by model, 24-hour error rates and top spenders by user ID. It is aimed at developers who need compliance trails, want to debug production issues, or want to track model usage.

Written from the project's SKILL.md and checked against it.

What it can do

  • audited_completionMakes a chat completion and returns an audit entry with cost and latency.
  • Generation metadata retrievalFetches exact cost and token counts from the OpenRouter generation endpoint.
  • init_audit_db and write_auditCreates an append-only SQLite audit table and writes entries without duplicate generation IDs.
  • redact_piiScrubs emails, phones, SSNs, card numbers and API keys before logging.
  • Audit queriesProvides SQL for daily cost by model, error rate and top spenders.
  • Error handling guidanceLists fixes for generation 404s, duplicate IDs, missing total_cost and 401 errors.

What you need

  • OpenRouter API key exported as OPENROUTER_API_KEY
  • Python 3.8 or later
  • openai and requests Python packages
  • SQLite (Python sqlite3 module)
  • Optional SIEM such as Splunk, Datadog or ELK

Try asking

  • Set up audit logging for my OpenRouter calls using SQLite.
  • Show me daily OpenRouter cost by model from my audit table.
  • Redact emails and phone numbers from prompts before I log them.

Good to know

  • Generation lookups can return 404 if fetched too long after the request; the source says to fetch within 30 minutes.
  • total_cost may be missing while a generation is still processing.
  • Raw prompts are not stored, only a 16-character SHA-256 hash.

Security check

B
  • Allowed to use Write, Edit without limitsIn SKILL.md

Checked automatically: skills/.curated/openrouter-audit-logging/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

Allowed tools: ReadWriteEditGrepBash(python3:*)Bash(sqlite3:*)

Alternatives to openrouter-audit-logging

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

openrouter-audit-logging: common questions

Does it store raw prompts?

No. The skill stores only a 16-character SHA-256 hash of each prompt, and says raw prompts are never stored.

Where is the audit data kept?

By default it is written to an SQLite file named openrouter_audit.db. The source also suggests S3 or centralized logging for hardened storage.

Why might a generation lookup fail?

The generation endpoint returns 404 if the ID is not found or the request is too old. The source advises fetching within 30 minutes.

How do I install openrouter-audit-logging?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is openrouter-audit-logging free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is openrouter-audit-logging safe to use?

It scores 76 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.

What are alternatives to openrouter-audit-logging?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

openrouter-audit-logging Install

Add to stack

Loading.