Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

datasette-llm-usage

PyPI Changelog Tests License

Track usage of LLM tokens in a SQLite table

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-llm-usage

Usage

This plugin tracks LLM token usage in Datasette via the datasette-llm llm_prompt_context hook. It creates two tables:

  • llm_usage: Tracks token usage per request (model, purpose, actor, input/output tokens)
  • llm_usage_prompt_log: Optionally logs full prompts and responses

Configuration

By default the tables are created in the internal database passed to Datasette using --internal internal.db. You can change that by setting the following in your Datasette plugin configuration:

{
    "plugins": {
        "datasette-llm-usage": {
            "database": "your_database_name"
        }
    }
}

To enable full prompt and response logging, set log_prompts to true:

{
    "plugins": {
        "datasette-llm-usage": {
            "log_prompts": true
        }
    }
}

Prompt testing tool

The plugin also provides a simple demo page at /-/llm-usage-simple-prompt which can be used to execute prompts for testing.

That page requires the user to have the llm-usage-simple-prompt permission.

Development

Clone this repo and run the tests:

cd datasette-llm-usage
uv run pytest

Metadata

Release files for datasette-llm-usage 0.2a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-llm-usage 0.2a0
File Size Uploaded Provenance Actions
datasette_llm_usage-0.2a0.tar.gz 3.8 kB With provenance Details for datasette_llm_usage-0.2a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datasette-llm-usage 0.2a0
File Interpreter ABI Platform Actions
datasette_llm_usage-0.2a0-py3-none-any.whl Python 3 none any Details for datasette_llm_usage-0.2a0-py3-none-any.whl

Total release size: 9.1 kB

Release files / datasette_llm_usage-0.2a0.tar.gz

Download URL datasette_llm_usage-0.2a0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cce0156565c391d6c3fe7c358c7428b3bac70e7eefdf2e0430b688ba0e3f6df0
BLAKE2b-256 checksum
How to use checksums
dec6ca3ac2e610f0f6454bec00c184eb2441d36318bf632a78ae55a020daba64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

Release files / datasette_llm_usage-0.2a0-py3-none-any.whl

Download URL datasette_llm_usage-0.2a0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2846f4e95c9fcf31d764536ef18e026d927ef3bb322488c1fd74aeb42e5cf8ad
BLAKE2b-256 checksum
How to use checksums
11e20143a8dd362edba1cc74a264d24a96d20e76a5634e357ae51d49787b3a2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

Security for datasette-llm-usage 0.2a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for datasette_llm_usage-0.2a0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page