llm-prompt-json
A plugin for LLM that adds a --json flag to the llm prompt command. This flag allows you to retrieve the response, conversation ID, and metadata as a JSON array, making it easy to integrate with tools like jq.
Built for llm version 0.28.
Installation
Install this plugin in the same environment as LLM:
llm install llm-prompt-json
Usage
Use the --json flag when running a prompt:
llm "say hello" --json
Example output:
[
{
"id": "01...",
"model": "gpt-4o",
"prompt": "say hello",
"response": "Hello!",
"conversation_id": "01..."
}
]
Extracting the Conversation ID
Because the output is standard JSON, you can easily pipe it into jq to extract just the values you need. For example, to get the conversation_id:
llm "say hello" --json | jq -r '.[].conversation_id'
Compatibility
This plugin intercepts llm prompt dynamically, preventing the usual streamed output from polluting the JSON payload. It works correctly even if streaming is enabled or disabled, but it cannot be used alongside the --no-log flag since it relies on the internal LLM logs database to construct the complete metadata record.
Metadata
Release files for llm-prompt-json 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llm_prompt_json-0.1.1.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_prompt_json-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.7 kB
Release files / llm_prompt_json-0.1.1.tar.gz
| Download URL | llm_prompt_json-0.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1c3efc1f3e25cd440fe0d86c4f4dbf31eff74b49f2e199dd9efa7d12049186b
|
|
BLAKE2b-256 checksum How to use checksums |
b95da46d7d65e7e2951fd2ca8753f17f48406001b4ffff8496b0aa566b8ec89c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / llm_prompt_json-0.1.1-py3-none-any.whl
| Download URL | llm_prompt_json-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2a9c35081e79e9d85c723cec5b92bbb6ffb6e603ee124b4e0f819963795abd6
|
|
BLAKE2b-256 checksum How to use checksums |
645aea172f7ac41c991433bed3f928eb18051cdabb031f608f0b72e2f7660c3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for llm-prompt-json 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.