llm: remove stored key
• 188 words • 1 min • updated
⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.
I was just trying Simon Willison’s excellent CLI llm tool:
A CLI utility and Python library for interacting with Large Language Models, both via remote APIs and models that can be installed and run on your own machine.
It’s straightforward to set API Keys with it:
shell
% llm key set openaiI wanted to set one for Anthropic Claude:
shell
% llm key set claudeBut it turns out the correct name is anthropic, not claude:
shell
% llm key set anthropicNow I wanted to clean up the claude entry.
Surprisingly, there’s no llm key remove or llm key delete command!
Docs.
The workaround: edit the keys.json file directly:
shell
% llm keys path
/Users/thiago.perrotta/Library/Application Support/io.datasette.llm/keys.jsonThe output above is from macOS.
shell
% $EDITOR "$(llm keys path)"
/Users/thiago.perrotta/Library/Application Support/io.datasette.llm/keys.jsonThe keys.json file:
json
{
"// Note": "This file stores secret API credentials. Do not share!",
"openai": "sk-{redacted}",
"claude": "sk-ant-api03-{redacted}",
"anthropic": "sk-ant-api03-{redacted}"
}Remove claude from it:
json
{
"// Note": "This file stores secret API credentials. Do not share!",
"openai": "sk-{redacted}",
"anthropic": "sk-ant-api03-{redacted}"
}And it’s done! Verify with:
shell
% llm keys
anthropic
openai