Skip to main content

llm-claude

Deprecated in favour of llm-claude-3

Please see https://github.com/simonw/llm-claude-3/ instead


PyPI Changelog Tests License

Plugin for LLM adding support for Anthropic's Claude models.

Installation

Install this plugin in the same environment as LLM.

llm install llm-claude

Configuration

You will need an API key from Anthropic. Request access at https://www.anthropic.com/earlyaccess then go to https://console.anthropic.com/account/keys

You can set that as an environment variable called ANTHROPIC_API_KEY, or add it to the llm set of saved keys using:

llm keys set claude
Enter key: <paste key here>

Usage

This plugin adds models called claude and claude-instant.

Anthropic describes them as:

two families of models, both of which support 100,000 token context windows:

  • Claude Instant: low-latency, high throughput
  • Claude: superior performance on tasks that require complex reasoning

You can query them like this:

llm -m claude-instant "Ten great names for a new space station"
llm -m claude "Compare and contrast the leadership styles of Abraham Lincoln and Boris Johnson."

Options

  • max_tokens_to_sample, default 10_000: The maximum number of tokens to generate before stopping

Use like this:

llm -m claude -o max_tokens_to_sample 20 "Sing me the alphabet"
 Here is the alphabet song:

A B C D E F G
H I J

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-claude
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Release files for llm-claude 0.4.2

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 0.4.2
File Size Uploaded
llm_claude-0.4.2.tar.gz 8.2 kB Details

Built distribution (wheel)

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

Total release size: 15.8 kB

Release files / llm_claude-0.4.2.tar.gz

Download URL llm_claude-0.4.2.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb455065c21fca7b6f37e49005d6f4a4b38f6406ef65f2e8aaa0f2a7c9d25797
BLAKE2b-256 checksum
How to use checksums
7f137774933a481884b8317b100af18a0dcf80a7986ccb02f12ed729fdb1e7a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / llm_claude-0.4.2-py3-none-any.whl

Download URL llm_claude-0.4.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6cd7293e501252e7d8f09a187752b3030525ebef79e66b849768aa0568ea04c
BLAKE2b-256 checksum
How to use checksums
cc49af42c1db69617f8f750de4b3d8f875a6a6b50d1e6e8c25346986735e7228
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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