Skip to main content

llm-claude-code

PyPI Changelog Tests License

LLM plugin for Claude Code SDK integration

Overview

llm-claude-code is a plugin for Simon Willison's LLM tool that enables you to use Claude Code through the LLM command-line interface. This plugin leverages the Claude Code CLI to provide AI assistance with coding tasks.

Prerequisites

Before using this plugin, ensure you have:

  • Claude Code CLI installed: Install with npm install -g @anthropic-ai/claude-code
  • Node.js: Required for Claude Code CLI
  • Anthropic API Key configured: Set up through environment variables or Claude Code settings
  • Python 3.10 or higher

To install Claude Code, visit the official documentation.

Installation

Install this plugin in the same environment as LLM:

llm install llm-claude-code

Usage

Basic Usage

Use the claude-code model with the LLM command:

# Basic usage
llm -m claude-code "Write a Python function to calculate fibonacci numbers"

# Using the alias 'cc'
llm -m cc "Create a hello world script"

Features

  • Streaming Support: Real-time output display during generation
  • Color-coded Output: Different message types are displayed with distinct colors:
    • Tool messages: Blue
    • Error messages: Red
    • Success messages: Green
    • Regular messages: Default color
  • Error Handling: Comprehensive error reporting for CLI issues

Model Aliases

The plugin provides the following model identifiers:

  • Primary: claude-code
  • Alias: cc

Tool Usage

The initial implementation disables tool usage (--no-tools flag) to focus on text generation. Future versions may include configurable tool support.

Error Handling

The plugin includes comprehensive error handling for common issues:

  • CLINotFoundError: Raised when Claude Code CLI is not installed or not found in PATH
  • CLIConnectionError: Raised when there are connection issues with the Claude Code service
  • ProcessError: Raised when there are errors during command execution

Troubleshooting

SDK Import Errors

If you encounter import errors with the Claude Code SDK:

  1. Ensure you have Python 3.10 or higher
  2. Install the plugin with llm install llm-claude-code
  3. Verify that claude-code-sdk is properly installed

Connection Issues

If you experience connection timeouts:

  1. Check your internet connection
  2. Verify your Anthropic API key is valid
  3. Ensure you're not hitting rate limits

Development

To set up this plugin locally, first checkout the code:

cd llm-claude-code

Then create a new virtual environment and install the dependencies and test dependencies:

uv sync --extra test --extra dev

To run the tests:

uv run pytest

Future Enhancements

The plugin is designed with extensibility in mind. Planned future features include:

  • Tool Usage Configuration: Enable specific tools via command-line options
  • Advanced Options: Custom system prompts, max turns, working directory settings
  • Session Management: Conversation continuity and state preservation

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Release files for llm-claude-code 0.0.3

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-claude-code 0.0.3
File Size Uploaded
llm_claude_code-0.0.3.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-claude-code 0.0.3
File Interpreter ABI Platform
llm_claude_code-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / llm_claude_code-0.0.3.tar.gz

Download URL llm_claude_code-0.0.3.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
57370b5d5ce3751dbc87d23d5d5c3560ddba118942fa4ac2e6b65a596c4bbe85
BLAKE2b-256 checksum
How to use checksums
f1ad8e38664b2a9e093a9256b581479dab92ee01c65c1878b30b5856e73cedbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 6, 2025.

Transparency log

Release files / llm_claude_code-0.0.3-py3-none-any.whl

Download URL llm_claude_code-0.0.3-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
135429a0f9a047b894f05d8e2feac771b98b349594c6df449190305d3dd1fa2e
BLAKE2b-256 checksum
How to use checksums
bc844f9f04d57b61607776a13b339a3e59b90db39ee669aca6abcc839ee829db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 6, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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