A plugin to add support for the Neuralwatt AI inference service to llm
Project description
llm-neuralwatt
An plugin to add support for the OpenAI compatible Neuralwatt inference service, to run inference against various open weights models, and return the direct energy measurements in the response as well as logging it locally in llm's logs.db sqlite file.
This is not an official plugin from Neuralwatt.
Installation
Install this plugin in the same environment as LLM.
llm install llm-neuralwatt
Usage
Once you have llm-neuralwatt installed, you should see new models available when you call llm models:
Neuralwatt: neuralwatt/deepseek-coder-33b-instruct (aliases: neuralwatt-deepseek-coder)
Neuralwatt: neuralwatt/gpt-oss-20b (aliases: neuralwatt-gpt-oss)
Neuralwatt: neuralwatt/Qwen3-Coder-480B-A35B-Instruct (aliases: neuralwatt-qwen3-coder)
You will need to set a key with:
llm keys set neuralwatt
You can sign up for Neuralwatt, and get an API key from https://portal.neuralwatt.com.
Energy Consumption Logging
This plugin automatically captures and logs energy consumption data from Neuralwatt API responses. Energy data is stored in the response_json field of the llm logs database.
To view energy consumption for your requests:
# View recent logs with energy data
llm logs --model neuralwatt-gpt-oss --json | jq '.[-1:].[].response_json.energy'
# Query specific energy metrics
llm logs --model neuralwatt-deepseek-coder --json | jq -r '.[] | select(.response_json.energy != null) | "\(.datetime_utc): \(.response_json.energy.energy_joules) joules, \(.response_json.energy.energy_kwh) kWh"'
Each energy measurement includes:
energy_joules: Energy consumption in joulesenergy_kwh: Energy consumption in kilowatt-hoursavg_power_watts: Average power consumption in wattsduration_seconds: Duration of the API callattribution_method: How energy was attributedattribution_ratio: Ratio of energy attribution
You can read more about how energy consumption is attributed to a single use in the Neuralwatt docs
Streaming Support
Energy consumption data is captured in both streaming and non-streaming modes. The plugin uses a custom HTTP streaming implementation to capture the energy data that Neuralwatt sends as an SSE comment just before the [DONE] marker.
# Both streaming and non-streaming capture energy data
llm "Explain quantum computing" -m neuralwatt-gpt-oss
llm "Explain quantum computing" -m neuralwatt-gpt-oss --no-stream
For more details on how Neuralwatt handles streaming, see the Neuralwatt streaming docs.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-neuralwatt
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
python -m 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 llm_neuralwatt-0.0.4.tar.gz.
File metadata
- Download URL: llm_neuralwatt-0.0.4.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8f3a828d302cf3e2121b3e11875f5b20aa00c530ea7a2bba53a3a2fe6fc1358
|
|
| MD5 |
6eeefefcbb44954f3a9fa7d47d296290
|
|
| BLAKE2b-256 |
e2dc34f4b096dfbbda88d97c681f6a5c799898a48194c46dc7213849386901ca
|
Provenance
The following attestation bundles were made for llm_neuralwatt-0.0.4.tar.gz:
Publisher:
publish.yml on mrchrisadams/llm-neuralwatt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_neuralwatt-0.0.4.tar.gz -
Subject digest:
f8f3a828d302cf3e2121b3e11875f5b20aa00c530ea7a2bba53a3a2fe6fc1358 - Sigstore transparency entry: 855002103
- Sigstore integration time:
-
Permalink:
mrchrisadams/llm-neuralwatt@7ef6eb5dfaf280690ae7d28ebbad0a1294160645 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/mrchrisadams
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ef6eb5dfaf280690ae7d28ebbad0a1294160645 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_neuralwatt-0.0.4-py3-none-any.whl.
File metadata
- Download URL: llm_neuralwatt-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.6 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 |
4b8d95a01dd4b3403fad22e025f7f3ee9c307f64ff6f598988114aab1681f3ae
|
|
| MD5 |
2f0dc71357f82e361e4af0d84860a1e9
|
|
| BLAKE2b-256 |
5a7aa6525225fb76e982b5e0ffb889f5ee537522b23c4382a2a5484288fcbe8f
|
Provenance
The following attestation bundles were made for llm_neuralwatt-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on mrchrisadams/llm-neuralwatt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_neuralwatt-0.0.4-py3-none-any.whl -
Subject digest:
4b8d95a01dd4b3403fad22e025f7f3ee9c307f64ff6f598988114aab1681f3ae - Sigstore transparency entry: 855002104
- Sigstore integration time:
-
Permalink:
mrchrisadams/llm-neuralwatt@7ef6eb5dfaf280690ae7d28ebbad0a1294160645 -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/mrchrisadams
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ef6eb5dfaf280690ae7d28ebbad0a1294160645 -
Trigger Event:
release
-
Statement type: