LLM plugin for Claude Code integration
Project description
llm-claude-code-plugin
Plugin for LLM adding support for Claude Code models (Sonnet and Opus) via the Claude Code CLI.
Installation
Install this plugin in the same environment as LLM:
uv add llm-claude-code-plugin
Prerequisites
This plugin requires the Claude Code CLI to be installed and available. The plugin looks for the Claude Code executable at:
~/.claude/local/claude(default)- Custom path specified via the
claude_pathoption
Make sure you have Claude Code installed and configured before using this plugin.
Usage
Available Models
This plugin provides five models:
code/sonnet- Claude Code with latest Sonnet model (default)code/opus- Claude Code with latest Opus modelcode/sonnet-4- Claude Code with Sonnet 4 (claude-sonnet-4-20250514)code/opus-4- Claude Code with Opus 4 (claude-opus-4-20250514)code/opus-4.1- Claude Code with Opus 4.1 (claude-opus-4-1-20250805)
List available models:
llm models list
Basic Usage
Execute a prompt using Claude Code Sonnet:
llm -m code/sonnet "Explain how to use Python decorators"
Execute a prompt using Claude Code Opus:
llm -m code/opus "Write a Python function to calculate fibonacci numbers"
Execute a prompt using Claude Code Sonnet 4:
llm -m code/sonnet-4 "Review this code for best practices"
Model Options
The plugin supports the following options:
claude_path: Custom path to the Claude Code CLI executable
Example using a custom Claude Code path:
llm -m code/sonnet -o claude_path /usr/local/bin/claude "Your prompt here"
File Attachments
This plugin supports attaching various file types to your prompts, including:
- Text files (
.txt,.py,.js,.html,.css,.md, etc.) - Code files (Python, JavaScript, C, Java, Shell scripts)
- Data files (JSON, XML, YAML)
- Images (PNG, JPEG, GIF, WebP)
Attach files using the -a flag:
llm -m code/sonnet -a myfile.py "Explain this Python code"
Attach multiple files:
llm -m code/sonnet -a file1.py -a file2.js "Compare these two implementations"
URL Support
When URLs are included in prompts or attachments, the plugin automatically enables the WebFetch tool for Claude Code:
llm -m code/sonnet "Analyze the content at https://example.com"
Interactive Chat
Start an interactive chat session:
llm chat -m code/sonnet
Or with Opus:
llm chat -m code/opus
Or with Sonnet 4:
llm chat -m code/sonnet-4
Configuration
You can set the Claude Code path permanently using LLM's configuration:
llm logs path # Find your logs directory
# Edit the config file to set default claude_path
Features
- Five Model Support: Access latest Sonnet/Opus and specific versioned models (Sonnet 4, Opus 4, Opus 4.1)
- File Attachments: Support for text, code, data, and image files
- URL Processing: Automatic WebFetch tool enablement for URL analysis
- Streaming Support: Real-time response streaming
- Error Handling: Comprehensive error reporting and timeout management
- Flexible Path Configuration: Custom Claude Code executable paths
Technical Details
- Timeout: Commands timeout after 5 minutes to prevent hanging
- Temporary Files: Attachment content is safely handled via temporary files
- Error Recovery: Graceful handling of missing executables and other errors
- Content Types: Extensive MIME type support for attachments
Troubleshooting
Claude Code CLI Not Found
If you see an error about the Claude Code CLI not being found:
- Ensure Claude Code is installed and accessible
- Check that the executable is at
~/.claude/local/claudeor specify a custom path - Verify the executable has proper permissions
Example with custom path:
llm -m code/sonnet -o claude_path /path/to/your/claude "Your prompt"
Timeout Issues
If commands are timing out:
- Complex prompts may take longer to process
- Large file attachments can increase processing time
- The default timeout is 5 minutes
File Attachment Issues
If file attachments aren't working:
- Ensure files exist and are readable
- Check that file types are supported
- Large files may cause performance issues
Development
To set up this plugin for development:
git clone https://github.com/paradise-runner/llm-claude-code.git
cd llm-claude-code-plugin
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
The plugin uses Python's subprocess module to execute the Claude Code CLI and supports:
- Multiple attachment types through MIME type detection
- Streaming responses via generator functions
- Configurable command paths and options
- Robust error handling and cleanup
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Changelog
See CHANGELOG.md for version history and changes.
Project details
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_plugin-0.1.3.tar.gz.
File metadata
- Download URL: llm_claude_code_plugin-0.1.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12bcbe2063ce91424b91adbac09f6929afdf4fcdb76038f0000688c33f0a72f9
|
|
| MD5 |
6e2d4767e2b74d6952a19a171aaa714a
|
|
| BLAKE2b-256 |
ae62406cf0a9853c949ba8ed17a2abcf854cf491b44ad10b8f70b5d3986b1f35
|
File details
Details for the file llm_claude_code_plugin-0.1.3-py3-none-any.whl.
File metadata
- Download URL: llm_claude_code_plugin-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c7ee3a4747bb10649bbfb63ceba9c31afc694fe1d763d6de0e5c5d2d889009c
|
|
| MD5 |
e65e7d96d7ed2b3cdba0b6aac72d9c8a
|
|
| BLAKE2b-256 |
b511bc1247bfdc5a81011cbff837639e34530cbeaba80fa5e59df9e760e0b842
|