Demo app for LLM accountant
Project description
datasette-demo-for-llm-accountant
Demo app for LLM accountant
This is a demonstration plugin showing how to use datasette-llm-accountant to track and log LLM API costs.
Features
- Interactive LLM Form: Submit prompts to any available LLM model via a web interface
- Cost Tracking: All LLM API calls are tracked with nanocent precision
- Transaction Log: View a running total of all LLM requests and their costs
- In-Memory Accountant: Demonstrates implementing a custom
Accountantsubclass
Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-demo-for-llm-accountant
Usage
Once installed, navigate to /-/llm-accountant in your Datasette instance.
You'll see:
- A form to select an LLM model and enter a prompt
- The response from the LLM
- A transaction log showing all requests and their costs
Each request reserves $0.50 by default, and the actual cost is calculated based on token usage and settled in the transaction log.
Running Locally
datasette
Then visit http://127.0.0.1:8001/-/llm-accountant
Note: You'll need LLM API keys configured for this to work. See the llm documentation for details on configuring API keys.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-demo-for-llm-accountant
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
python -m pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette_demo_for_llm_accountant-0.1a0.tar.gz.
File metadata
- Download URL: datasette_demo_for_llm_accountant-0.1a0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71ac827b6149daecaaf8f99a6dc73ef9b5a800e8f69e6aa927400d5dd14d658d
|
|
| MD5 |
d23e30a10c2fbc99ced1b57828a7ad55
|
|
| BLAKE2b-256 |
eb50ace62fce19144e1ee958f92062f2985edf73503dd8ef16a431a84871c533
|
Provenance
The following attestation bundles were made for datasette_demo_for_llm_accountant-0.1a0.tar.gz:
Publisher:
publish.yml on datasette/datasette-demo-for-llm-accountant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_demo_for_llm_accountant-0.1a0.tar.gz -
Subject digest:
71ac827b6149daecaaf8f99a6dc73ef9b5a800e8f69e6aa927400d5dd14d658d - Sigstore transparency entry: 706691523
- Sigstore integration time:
-
Permalink:
datasette/datasette-demo-for-llm-accountant@a8fe47dc9b694c6980e5e85e424bff71877f3f1a -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8fe47dc9b694c6980e5e85e424bff71877f3f1a -
Trigger Event:
release
-
Statement type:
File details
Details for the file datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl.
File metadata
- Download URL: datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b48f31a82fc58a62cacbf2ec19cced1ccdb081466c5cd81a9968cf6be2e486b8
|
|
| MD5 |
da904423b0d0ed291dc0db3e84f4c160
|
|
| BLAKE2b-256 |
36189d4ed2fe49e9f02633d94d1e5643eabc617f8234c5a9423c14d8e56a94e6
|
Provenance
The following attestation bundles were made for datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl:
Publisher:
publish.yml on datasette/datasette-demo-for-llm-accountant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl -
Subject digest:
b48f31a82fc58a62cacbf2ec19cced1ccdb081466c5cd81a9968cf6be2e486b8 - Sigstore transparency entry: 706691536
- Sigstore integration time:
-
Permalink:
datasette/datasette-demo-for-llm-accountant@a8fe47dc9b694c6980e5e85e424bff71877f3f1a -
Branch / Tag:
refs/tags/0.1a0 - Owner: https://github.com/datasette
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a8fe47dc9b694c6980e5e85e424bff71877f3f1a -
Trigger Event:
release
-
Statement type: