LLM plugin for Claude Code SDK integration
Project description
llm-claude-code
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 PATHCLIConnectionError: Raised when there are connection issues with the Claude Code serviceProcessError: Raised when there are errors during command execution
Troubleshooting
SDK Import Errors
If you encounter import errors with the Claude Code SDK:
- Ensure you have Python 3.10 or higher
- Install the plugin with
llm install llm-claude-code - Verify that
claude-code-sdkis properly installed
Connection Issues
If you experience connection timeouts:
- Check your internet connection
- Verify your Anthropic API key is valid
- 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.
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_claude_code-0.0.2.tar.gz.
File metadata
- Download URL: llm_claude_code-0.0.2.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05f8c39d59870ddc757b0fa07c9969b20c8fdf0d7c59a226c860c9ddf25e801a
|
|
| MD5 |
7e48249b8c0058b19f742b341d4863cd
|
|
| BLAKE2b-256 |
785ffae6c1a26f7c54edfb29fdad34d3aee998f89ee1dda51448b8fd0b3f43eb
|
Provenance
The following attestation bundles were made for llm_claude_code-0.0.2.tar.gz:
Publisher:
publish.yml on ftnext/llm-claude-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_claude_code-0.0.2.tar.gz -
Subject digest:
05f8c39d59870ddc757b0fa07c9969b20c8fdf0d7c59a226c860c9ddf25e801a - Sigstore transparency entry: 249775893
- Sigstore integration time:
-
Permalink:
ftnext/llm-claude-code@47980ede0be6dc7e2be2ff2a04ceeab1839243a2 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/ftnext
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47980ede0be6dc7e2be2ff2a04ceeab1839243a2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_claude_code-0.0.2-py3-none-any.whl.
File metadata
- Download URL: llm_claude_code-0.0.2-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.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765eb642aeccf9ad1e6f260deb1b98cde84035389c250f937b1a3ea1e999bdc2
|
|
| MD5 |
5eb98abd5e47391fc5a7c213f18ee205
|
|
| BLAKE2b-256 |
7c79eff7ff05d34276a6932f399b9667203030d4409576e0170bef36c0633c01
|
Provenance
The following attestation bundles were made for llm_claude_code-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on ftnext/llm-claude-code
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_claude_code-0.0.2-py3-none-any.whl -
Subject digest:
765eb642aeccf9ad1e6f260deb1b98cde84035389c250f937b1a3ea1e999bdc2 - Sigstore transparency entry: 249775897
- Sigstore integration time:
-
Permalink:
ftnext/llm-claude-code@47980ede0be6dc7e2be2ff2a04ceeab1839243a2 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/ftnext
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47980ede0be6dc7e2be2ff2a04ceeab1839243a2 -
Trigger Event:
release
-
Statement type: