{
  "$type": "site.standard.document",
  "content": {
    "$type": "site.standard.content.markdown",
    "text": "You can use the awesome `llm` tool for free with one of the best models available today!\nIn this small post, I'll show you how to do it in a few easy steps.\n\nWe'll setup `llm` with the new Gemini models from Google. These are currently [Top #1 and #2 in LLM arena benchmarks](https://lmarena.ai/).\n\n## Install `llm`\n\nI recommend installing `llm` using the `uv tool install` command from [`uv`](https://github.com/astral-sh/uv). Since we'll be using Gemini models, we need to install the Gemini plugin too.\n\n```bash\nuv tool install --with llm-gemini llm\n```\n\nNow you should have the command `llm` available in your CLI.\n\n## Configuring `llm`\n\nThis step is easy. Go to [Google AI Studio](https://aistudio.google.com/) and grab an API key from the big blue `Get API key`. Then, run this command so `llm` asks you about the keys.\n\n```bash\nllm keys set gemini\n```\n\nOnce the key is set, you're done! You should be able to run something like this with your preferred prompt.\n\n```bash\nllm -m gemini-2.0-flash-exp \"Count to 10\"\n```\n\n## Using `llm`\n\nThe most straightforward way of using `llm` is as shown before. To make things smoother, let's set a default model. There are many models (you can list them with `llm models`). Here are two that make a perfect default models given the ones available today: `gemini-2.0-flash-exp` or `gemini-2.0-flash-thinking-exp-1219`.\n\n```bash\nllm models default gemini-2.0-flash-exp\n```\n\nThat's it! You can now use `llm` directly without any flags.\n\n```bash\nllm \"Count to 10\"\n```\n\nSpeaking of flags though, there are a few interesting ones you should know.\n\n- `-s` to set the system prompt to use.\n  ```bash\n  cat README.md | llm -s \"You are an emoji suggester\"\n  ```\n- `-a` to attach images, audio, or videos to the prompt.\n  ```bash\n  llm \"Which cat is this one?\" -a \"https://upload.wikimedia.org/wikipedia/commons/2/25/Siam_lilacpoint.jpg\"\n  ```\n- `-o` to pass some key value options to the model. [The Gemini models options](https://github.com/simonw/llm-gemini?tab=readme-ov-file#usage) are `code_execution` and `json_object`.\n  ```bash\n  llm 'use python to sum the first 50 prime numbers' -o code_execution 1\n  ```\n\n---\n\nThere are many more ways to use `llm`. I've [written about some of them previously](/useful-llm-tools-2024) and am sure you'll find some other interesting uses.\nEnjoy LLMing for free while it lasts!",
    "version": "1.0"
  },
  "description": "You can use the awesome llm tool for free with one of the best models available today! In this small post, I'll show you how to do it in a few easy steps. We'll setup llm with the new Gemini models from Google. These are currently Top #1 and #2 in LLM arena benchmarks. Install...",
  "path": "/llming-for-free",
  "publishedAt": "2024-12-20T00:00:00.000Z",
  "site": "at://did:plc:4z5i7njrld66ew36htufcwry/site.standard.publication/3mo43d2tmt2ov",
  "textContent": "You can use the awesome llm tool for free with one of the best models available today!\nIn this small post, I'll show you how to do it in a few easy steps.\n\nWe'll setup llm with the new Gemini models from Google. These are currently Top #1 and #2 in LLM arena benchmarks.\n\nInstall llm\n\nI recommend installing llm using the uv tool install command from uv. Since we'll be using Gemini models, we need to install the Gemini plugin too.\n\nNow you should have the command llm available in your CLI.\n\nConfiguring llm\n\nThis step is easy. Go to Google AI Studio and grab an API key from the big blue Get API key. Then, run this command so llm asks you about the keys.\n\nOnce the key is set, you're done! You should be able to run something like this with your preferred prompt.\n\nUsing llm\n\nThe most straightforward way of using llm is as shown before. To make things smoother, let's set a default model. There are many models (you can list them with llm models). Here are two that make a perfect default models given the ones available today: gemini-2.0-flash-exp or gemini-2.0-flash-thinking-exp-1219.\n\nThat's it! You can now use llm directly without any flags.\n\nSpeaking of flags though, there are a few interesting ones you should know.\n-s to set the system prompt to use.\n-a to attach images, audio, or videos to the prompt.\n-o to pass some key value options to the model. The Gemini models options are codeexecution and jsonobject.\n  \n\n---\n\nThere are many more ways to use llm. I've written about some of them previously and am sure you'll find some other interesting uses.\nEnjoy LLMing for free while it lasts!",
  "title": "LLMing for free"
}