Skip to content

Commit 1b229b3

Browse files
committed
Add Use The llm CLI With Claude Models as an LLM TIL
1 parent 2543651 commit 1b229b3

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1415 TILs and counting..._
13+
_1416 TILs and counting..._
1414

1515
---
1616

@@ -558,6 +558,7 @@ _1415 TILs and counting..._
558558
### LLM
559559

560560
- [Send cURL To Claude Text Completion API](llm/send-curl-to-claude-text-completion-api.md)
561+
- [Use The llm CLI With Claude Models](llm/use-the-llm-cli-with-claude-models.md)
561562

562563
### Mac
563564

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Use The llm CLI With Claude Models
2+
3+
[Simon Willison's `llm`](https://llm.datasette.io/en/stable/index.html) can be
4+
used with a bunch of different models (local and API). The whole thing is
5+
plugin driven. To use a specific model, you'll need to install the plugin for
6+
it. For instance, to use the [Claude 3 family of
7+
models](https://www.anthropic.com/news/claude-3-family) you need to install
8+
`llm-claude-3`.
9+
10+
```bash
11+
$ llm install llm-claude-3
12+
```
13+
14+
Then when prompting `llm`, specify which of the Claude models you want to use —
15+
`claude-3-haiku`, `claude-3-sonnet`, or `claude-3-opus` — with the `-m` flag:
16+
17+
```bash
18+
$ llm \
19+
-m claude-3-haiku \
20+
--key $CLAUDE_API_KEY \
21+
'Show me the SQL query to create a cocktails table.'
22+
```
23+
24+
Note: instead of adding my Claude API key to the key store, I've opted to
25+
include it with the `--key` flag via an environment variable that I've set
26+
ahead of time.

0 commit comments

Comments
 (0)