Skip to main content

Demo app for LLM accountant

Project description

datasette-demo-for-llm-accountant

PyPI Changelog Tests License

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 Accountant subclass

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:

  1. A form to select an LLM model and enter a prompt
  2. The response from the LLM
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette_demo_for_llm_accountant-0.1a0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file datasette_demo_for_llm_accountant-0.1a0.tar.gz.

File metadata

File hashes

Hashes for datasette_demo_for_llm_accountant-0.1a0.tar.gz
Algorithm Hash digest
SHA256 71ac827b6149daecaaf8f99a6dc73ef9b5a800e8f69e6aa927400d5dd14d658d
MD5 d23e30a10c2fbc99ced1b57828a7ad55
BLAKE2b-256 eb50ace62fce19144e1ee958f92062f2985edf73503dd8ef16a431a84871c533

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_demo_for_llm_accountant-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 b48f31a82fc58a62cacbf2ec19cced1ccdb081466c5cd81a9968cf6be2e486b8
MD5 da904423b0d0ed291dc0db3e84f4c160
BLAKE2b-256 36189d4ed2fe49e9f02633d94d1e5643eabc617f8234c5a9423c14d8e56a94e6

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page