Skip to main content

llm-echo

PyPI Changelog Tests License

Debug plugin for LLM. Adds a model which echos its input without hitting an API or executing a local LLM.

Installation

Install this plugin in the same environment as LLM.

llm install llm-echo

Usage

The plugin adds a echo model which simply echos the prompt details back to you as JSON.

llm -m echo prompt -s 'system prompt'

Output:

{
  "prompt": "prompt",
  "system": "system prompt",
  "attachments": [],
  "stream": true,
  "previous": []
}

You can also add one example option like this:

llm -m echo prompt -o example_bool 1

Output:

{
  "prompt": "prompt",
  "system": "",
  "attachments": [],
  "stream": true,
  "previous": [],
  "options": {
    "example_bool": true
  }
}

Reasoning chunks

Pass -o thinking 1 to make the model emit two canned reasoning chunks before its normal JSON output. Useful for testing code that handles streaming reasoning tokens or persists ReasoningParts.

llm -m echo 'hello' -o thinking 1

The two reasoning chunks are "First I consider the prompt, " and "then I decide what to say.", followed by the usual echo JSON as a text part.

Tool calling

You can use llm-echo to test tool calling without needing to run prompts through an actual LLM. In your prompt, send something like this:

{
  "prompt": "This will be treated as the prompt",
  "tool_calls": [
    {
      "name": "example",
      "arguments": {
        "input": "Hello, world!"
      }
    }
  ]
}

You can assemble a test that looks like this:

def example(input: str) -> str:
    return f"Example output for {input}"

model = llm.get_model("echo")
chain_response = model.chain(
    json.dumps(
        {
            "tool_calls": [
                {
                    "name": "example",
                    "arguments": {"input": "test"},
                }
            ],
            "prompt": "prompt",
        }
    ),
    system="system",
    tools=[example],
)
responses = list(chain_response.responses())
tool_calls = responses[0].tool_calls()
assert len(tool_calls) == 1
tool_call_id = tool_calls[0].tool_call_id
assert tool_calls == [
    llm.ToolCall(name="example", arguments={"input": "test"}, tool_call_id=tool_call_id)
]
assert responses[1].prompt.tool_results == [
    llm.models.ToolResult(
        name="example", output="Example output for test", tool_call_id=tool_call_id
    )
]

Or you can read the JSON from the last response in the chain:

response_info = json.loads(responses[-1].text())

And run assertions against the "tool_results" key, which should look something like this:

{
  "prompt": "",
  "system": "",
  "...": "...",
  "tool_results": [
    {
      "name": "example",
      "output": "Example output for test",
      "tool_call_id": null
    }
  ]
}

Take a look at the test suite for llm-tools-simpleeval for an example of how to write tests against tools.

echo-needs-key model

The plugin also provides an echo-needs-key model which behaves identically to echo but requires an API key. This is useful for testing key resolution logic in plugins like datasette-llm.

The resolved key is included in the JSON output:

LLM_ECHO_NEEDS_KEY_KEY=sk-test-123 llm -m echo-needs-key 'hello'

Output:

{
  "prompt": "hello",
  "system": "",
  "attachments": [],
  "stream": true,
  "previous": [],
  "key": "sk-test-123"
}

The model's needs_key is "echo-needs-key" and its key_env_var is LLM_ECHO_NEEDS_KEY_KEY.

Raw responses

Sometimes it can be useful to output an exact string, for example if you are testing the --extract option in LLM.

If your prompt is JSON with a "raw" key that string is the only thing that will be returned. For example:

{
  "raw": "This is the raw response"
}

Will return:

This is the raw response

Development

To set up this plugin locally, first checkout the code. Then run the tests:

cd llm-echo
uv run pytest

Metadata

Release files for llm-echo 0.5

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

Source distribution (sdist)

Source distribution for llm-echo 0.5
File Size Uploaded
llm_echo-0.5.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-echo 0.5
File Interpreter ABI Platform
llm_echo-0.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / llm_echo-0.5.tar.gz

Download URL llm_echo-0.5.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f5b0821f9c6cf452ded6549e21102a2b5ec54b8745a999fabb425c07f7e4d98d
BLAKE2b-256 checksum
How to use checksums
35628d3ca4a05a0bd10f4693be4e1190eda00b7ac1c0802911b5b35df501530c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log

Release files / llm_echo-0.5-py3-none-any.whl

Download URL llm_echo-0.5-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8485bcac4c4f00849766acf931c059afd650e529a1bbfe20cd93ebad62241f2
BLAKE2b-256 checksum
How to use checksums
e611181f5f3f8333cfacb803b1c455413242411a260a988e5eda9eb0c9cd9f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 18, 2026.

Transparency log
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