Keys that are stored in this way live in a file called `keys.json`. This file is located at the path shown when you run the following command:
```bash
llm keys path
```
On macOS this will be `~/Library/Application Support/io.datasette.llm/keys.json`. On Linux it may be something like `~/.config/io.datasette.llm/keys.json`.
Keys can be passed directly using the `--key` option, like this:
```
llm "Five names for pet weasels" --key sk-my-key-goes-here
```
You can also pass the alias of a key stored in the `keys.json` file. For example, if you want to maintain a personal API key you could add that like this:
```
llm keys set personal
```
And then use it for prompts like so:
```
llm "Five friendly names for a pet skunk" --key personal
```
### Keys in environment variables
Keys can also be set using an environment variable. These are different for different models.
For OpenAI models the key will be read from the `OPENAI_API_KEY` environment variable.
The environment variable will be used only if no `--key` option is passed to the command.
If no environment variable is found, the tool will fall back to checking `keys.json`.
You can force the tool to use the key from `keys.json` even if an environment variable has also been set using `llm "prompt" --key openai`.