[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70966":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},70966,"llm","simonw\u002Fllm","simonw","Access large language models from the command-line","https:\u002F\u002Fllm.datasette.io",null,"Python",12024,882,63,421,0,24,62,189,72,118.84,"Apache License 2.0",false,"main",[26,27,28],"ai","llms","openai","2026-06-12 04:00:58","\u003C!-- [[[cog\n# README.md is generated from docs\u002Findex.md using sphinx_markdown_builder\nimport tempfile\nimport subprocess\nfrom pathlib import Path\n\nreadme_markdown = ''\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n    tmp_path = Path(tmpdir)\n    # Run: sphinx-build -M markdown .\u002Fdocs .\u002Ftmpdir\n    subprocess.run([\n        \"sphinx-build\",\n        \"-M\", \"markdown\",\n        \".\u002Fdocs\",\n        str(tmp_path)\n    ], check=True)\n    index_file = tmp_path \u002F \"markdown\" \u002F \"index.md\"\n    readme_markdown = index_file.read_text(encoding=\"utf-8\")\n\ncog.out(readme_markdown)\n]]] -->\n# LLM\n\n[![GitHub repo](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fgithub-repo-green)](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fllm.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fllm\u002F)\n[![Changelog](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002Fsimonw\u002Fllm?include_prereleases&label=changelog)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fchangelog.html)\n[![Tests](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm\u002Fworkflows\u002FTest\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm\u002Factions?query=workflow%3ATest)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-blue.svg)](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm\u002Fblob\u002Fmain\u002FLICENSE)\n[![Discord](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F823971286308356157?label=discord)](https:\u002F\u002Fdatasette.io\u002Fdiscord-llm)\n[![Homebrew](https:\u002F\u002Fimg.shields.io\u002Fhomebrew\u002Finstalls\u002Fdy\u002Fllm?color=yellow&label=homebrew&logo=homebrew)](https:\u002F\u002Fformulae.brew.sh\u002Fformula\u002Fllm)\n\nA CLI tool and Python library for interacting with **OpenAI**, **Anthropic’s Claude**, **Google’s Gemini**, **Meta’s Llama** and dozens of other Large Language Models, both via remote APIs and with models that can be installed and run on your own machine.\n\nWatch **[Language models on the command-line](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=QUXQNi6jQ30)** on YouTube for a demo or [read the accompanying detailed notes](https:\u002F\u002Fsimonwillison.net\u002F2024\u002FJun\u002F17\u002Fcli-language-models\u002F).\n\nWith LLM you can:\n\n- [Run prompts from the command-line](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#usage-executing-prompts)\n- [Store prompts and responses in SQLite](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#logging)\n- [Generate and store embeddings](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Findex.html#embeddings)\n- [Extract structured content from text and images](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#schemas)\n- [Grant models the ability to execute tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#tools)\n- … and much, much more\n\n## Quick start\n\nFirst, install LLM using `pip` or Homebrew or `pipx` or `uv`:\n\n```bash\npip install llm\n```\n\nOr with Homebrew (see [warning note](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#homebrew-warning)):\n\n```bash\nbrew install llm\n```\n\nOr with [pipx](https:\u002F\u002Fpypa.github.io\u002Fpipx\u002F):\n\n```bash\npipx install llm\n```\n\nOr with [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002Fguides\u002Ftools\u002F)\n\n```bash\nuv tool install llm\n```\n\nIf you have an [OpenAI API key](https:\u002F\u002Fplatform.openai.com\u002Fapi-keys) key you can run this:\n\n```bash\n# Paste your OpenAI API key into this\nllm keys set openai\n\n# Run a prompt (with the default gpt-4o-mini model)\nllm \"Ten fun names for a pet pelican\"\n\n# Extract text from an image\nllm \"extract text\" -a scanned-document.jpg\n\n# Use a system prompt against a file\ncat myfile.py | llm -s \"Explain this code\"\n```\n\nRun prompts against [Gemini](https:\u002F\u002Faistudio.google.com\u002Fapikey) or [Anthropic](https:\u002F\u002Fconsole.anthropic.com\u002F) with their respective plugins:\n\n```bash\nllm install llm-gemini\nllm keys set gemini\n# Paste Gemini API key here\nllm -m gemini-2.0-flash 'Tell me fun facts about Mountain View'\n\nllm install llm-anthropic\nllm keys set anthropic\n# Paste Anthropic API key here\nllm -m claude-4-opus 'Impress me with wild facts about turnips'\n```\n\nYou can also [install a plugin](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Finstalling-plugins.html#installing-plugins) to access models that can run on your local device. If you use [Ollama](https:\u002F\u002Follama.com\u002F):\n\n```bash\n# Install the plugin\nllm install llm-ollama\n\n# Download and run a prompt against the Orca Mini 7B model\nollama pull llama3.2:latest\nllm -m llama3.2:latest 'What is the capital of France?'\n```\n\nTo start [an interactive chat](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#usage-chat) with a model, use `llm chat`:\n\n```bash\nllm chat -m gpt-4.1\n```\n\n```default\nChatting with gpt-4.1\nType 'exit' or 'quit' to exit\nType '!multi' to enter multiple lines, then '!end' to finish\nType '!edit' to open your default editor and modify the prompt.\nType '!fragment \u003Cmy_fragment> [\u003Canother_fragment> ...]' to insert one or more fragments\n> Tell me a joke about a pelican\nWhy don't pelicans like to tip waiters?\n\nBecause they always have a big bill!\n```\n\nMore background on this project:\n\n- [llm, ttok and strip-tags—CLI tools for working with ChatGPT and other LLMs](https:\u002F\u002Fsimonwillison.net\u002F2023\u002FMay\u002F18\u002Fcli-tools-for-llms\u002F)\n- [The LLM CLI tool now supports self-hosted language models via plugins](https:\u002F\u002Fsimonwillison.net\u002F2023\u002FJul\u002F12\u002Fllm\u002F)\n- [LLM now provides tools for working with embeddings](https:\u002F\u002Fsimonwillison.net\u002F2023\u002FSep\u002F4\u002Fllm-embeddings\u002F)\n- [Build an image search engine with llm-clip, chat with models with llm chat](https:\u002F\u002Fsimonwillison.net\u002F2023\u002FSep\u002F12\u002Fllm-clip-and-chat\u002F)\n- [You can now run prompts against images, audio and video in your terminal using LLM](https:\u002F\u002Fsimonwillison.net\u002F2024\u002FOct\u002F29\u002Fllm-multi-modal\u002F)\n- [Structured data extraction from unstructured content using LLM schemas](https:\u002F\u002Fsimonwillison.net\u002F2025\u002FFeb\u002F28\u002Fllm-schemas\u002F)\n- [Long context support in LLM 0.24 using fragments and template plugins](https:\u002F\u002Fsimonwillison.net\u002F2025\u002FApr\u002F7\u002Flong-context-llm\u002F)\n\nSee also [the llm tag](https:\u002F\u002Fsimonwillison.net\u002Ftags\u002Fllm\u002F) on my blog.\n\n## Contents\n\n* [Setup](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html)\n  * [Installation](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#installation)\n  * [Upgrading to the latest version](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#upgrading-to-the-latest-version)\n  * [Using uvx](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#using-uvx)\n  * [A note about Homebrew and PyTorch](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#a-note-about-homebrew-and-pytorch)\n  * [Installing plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#installing-plugins)\n  * [API key management](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#api-key-management)\n    * [Saving and using stored keys](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#saving-and-using-stored-keys)\n    * [Passing keys using the –key option](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#passing-keys-using-the-key-option)\n    * [Keys in environment variables](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#keys-in-environment-variables)\n  * [Configuration](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#configuration)\n    * [Setting a custom default model](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#setting-a-custom-default-model)\n    * [Setting a custom directory location](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#setting-a-custom-directory-location)\n    * [Turning SQLite logging on and off](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fsetup.html#turning-sqlite-logging-on-and-off)\n* [Usage](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html)\n  * [Executing a prompt](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#executing-a-prompt)\n    * [Model options](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#model-options)\n    * [Attachments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#attachments)\n    * [System prompts](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#system-prompts)\n    * [Tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#tools)\n    * [Extracting fenced code blocks](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#extracting-fenced-code-blocks)\n    * [Schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#schemas)\n    * [Fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#fragments)\n    * [Continuing a conversation](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#continuing-a-conversation)\n    * [Tips for using LLM with Bash or Zsh](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#tips-for-using-llm-with-bash-or-zsh)\n    * [Completion prompts](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#completion-prompts)\n  * [Starting an interactive chat](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#starting-an-interactive-chat)\n  * [Listing available models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#listing-available-models)\n  * [Setting default options for models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fusage.html#setting-default-options-for-models)\n* [OpenAI models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html)\n  * [Configuration](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#configuration)\n  * [OpenAI language models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#openai-language-models)\n  * [Model features](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#model-features)\n  * [OpenAI embedding models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#openai-embedding-models)\n  * [OpenAI completion models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#openai-completion-models)\n  * [Adding more OpenAI models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fopenai-models.html#adding-more-openai-models)\n* [Other models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fother-models.html)\n  * [Installing and using a local model](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fother-models.html#installing-and-using-a-local-model)\n  * [OpenAI-compatible models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fother-models.html#openai-compatible-models)\n    * [Extra HTTP headers](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fother-models.html#extra-http-headers)\n* [Tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html)\n  * [How tools work](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#how-tools-work)\n  * [Trying out tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#trying-out-tools)\n  * [LLM’s implementation of tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#llm-s-implementation-of-tools)\n  * [Default tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#default-tools)\n  * [Tips for implementing tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftools.html#tips-for-implementing-tools)\n* [Schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html)\n  * [Schemas tutorial](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#schemas-tutorial)\n    * [Getting started with dogs](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#getting-started-with-dogs)\n    * [Extracting people from a news articles](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#extracting-people-from-a-news-articles)\n  * [Using JSON schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#using-json-schemas)\n  * [Ways to specify a schema](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#ways-to-specify-a-schema)\n  * [Concise LLM schema syntax](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#concise-llm-schema-syntax)\n  * [Saving reusable schemas in templates](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#saving-reusable-schemas-in-templates)\n  * [Browsing logged JSON objects created using schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fschemas.html#browsing-logged-json-objects-created-using-schemas)\n* [Templates](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html)\n  * [Getting started with \u003Ccode>–save\u003C\u002Fcode>](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#getting-started-with-save)\n  * [Using a template](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#using-a-template)\n  * [Listing available templates](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#listing-available-templates)\n  * [Templates as YAML files](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#templates-as-yaml-files)\n    * [System prompts](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#system-prompts)\n    * [Fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#fragments)\n    * [Options](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#options)\n    * [Tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#tools)\n    * [Schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#schemas)\n    * [Additional template variables](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#additional-template-variables)\n    * [Specifying default parameters](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#specifying-default-parameters)\n    * [Configuring code extraction](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#configuring-code-extraction)\n    * [Setting a default model for a template](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#setting-a-default-model-for-a-template)\n  * [Template loaders from plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ftemplates.html#template-loaders-from-plugins)\n* [Fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html)\n  * [Using fragments in a prompt](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#using-fragments-in-a-prompt)\n  * [Using fragments in chat](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#using-fragments-in-chat)\n  * [Browsing fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#browsing-fragments)\n  * [Setting aliases for fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#setting-aliases-for-fragments)\n  * [Viewing fragments in your logs](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#viewing-fragments-in-your-logs)\n  * [Using fragments from plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#using-fragments-from-plugins)\n  * [Listing available fragment prefixes](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Ffragments.html#listing-available-fragment-prefixes)\n* [Model aliases](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Faliases.html)\n  * [Listing aliases](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Faliases.html#listing-aliases)\n  * [Adding a new alias](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Faliases.html#adding-a-new-alias)\n  * [Removing an alias](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Faliases.html#removing-an-alias)\n  * [Viewing the aliases file](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Faliases.html#viewing-the-aliases-file)\n* [Embeddings](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Findex.html)\n  * [Embedding with the CLI](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html)\n    * [llm embed](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-embed)\n    * [llm embed-multi](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-embed-multi)\n    * [llm similar](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-similar)\n    * [llm embed-models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-embed-models)\n    * [llm collections list](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-collections-list)\n    * [llm collections delete](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fcli.html#llm-collections-delete)\n  * [Using embeddings from Python](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fpython-api.html)\n    * [Working with collections](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fpython-api.html#working-with-collections)\n    * [Retrieving similar items](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fpython-api.html#retrieving-similar-items)\n    * [SQL schema](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fpython-api.html#sql-schema)\n  * [Writing plugins to add new embedding models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fwriting-plugins.html)\n    * [`EmbeddingModel`](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fwriting-plugins.html#llm.EmbeddingModel)\n    * [Embedding binary content](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fwriting-plugins.html#embedding-binary-content)\n  * [Embedding storage format](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fembeddings\u002Fstorage.html)\n* [Plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Findex.html)\n  * [Installing plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Finstalling-plugins.html)\n    * [Listing installed plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Finstalling-plugins.html#listing-installed-plugins)\n    * [Running with a subset of plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Finstalling-plugins.html#running-with-a-subset-of-plugins)\n  * [Plugin directory](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html)\n    * [Local models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#local-models)\n    * [Remote APIs](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#remote-apis)\n    * [Tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#tools)\n    * [Fragments and template loaders](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#fragments-and-template-loaders)\n    * [Embedding models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#embedding-models)\n    * [Extra commands](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#extra-commands)\n    * [Just for fun](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fdirectory.html#just-for-fun)\n  * [Plugin hooks](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html)\n    * [register_commands(cli)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-commands-cli)\n    * [register_models(register, model_aliases)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-models-register-model-aliases)\n    * [register_embedding_models(register)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-embedding-models-register)\n    * [register_tools(register)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-tools-register)\n    * [register_template_loaders(register)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-template-loaders-register)\n    * [register_fragment_loaders(register)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-hooks.html#register-fragment-loaders-register)\n  * [Developing a model plugin](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html)\n    * [The initial structure of the plugin](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#the-initial-structure-of-the-plugin)\n    * [Installing your plugin to try it out](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#installing-your-plugin-to-try-it-out)\n    * [Building the Markov chain](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#building-the-markov-chain)\n    * [Executing the Markov chain](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#executing-the-markov-chain)\n    * [Adding that to the plugin](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#adding-that-to-the-plugin)\n    * [Understanding execute()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#understanding-execute)\n    * [Prompts and responses are logged to the database](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#prompts-and-responses-are-logged-to-the-database)\n    * [Adding options](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#adding-options)\n    * [Distributing your plugin](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#distributing-your-plugin)\n    * [GitHub repositories](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#github-repositories)\n    * [Publishing plugins to PyPI](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#publishing-plugins-to-pypi)\n    * [Adding metadata](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#adding-metadata)\n    * [What to do if it breaks](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Ftutorial-model-plugin.html#what-to-do-if-it-breaks)\n  * [Advanced model plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html)\n    * [Tip: lazily load expensive dependencies](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#tip-lazily-load-expensive-dependencies)\n    * [Models that accept API keys](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#models-that-accept-api-keys)\n    * [Async models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#async-models)\n    * [Supporting schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#supporting-schemas)\n    * [Supporting tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#supporting-tools)\n    * [Attachments for multi-modal models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#attachments-for-multi-modal-models)\n    * [Structured messages and streaming events](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#structured-messages-and-streaming-events)\n    * [Consuming prompt.messages in build_messages](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#consuming-prompt-messages-in-build-messages)\n    * [Restoring opaque metadata on subsequent requests](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#restoring-opaque-metadata-on-subsequent-requests)\n    * [Tracking token usage](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#tracking-token-usage)\n    * [Tracking resolved model names](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#tracking-resolved-model-names)\n    * [LLM_RAISE_ERRORS](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fadvanced-model-plugins.html#llm-raise-errors)\n  * [Utility functions for plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-utilities.html)\n    * [llm.get_key()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-utilities.html#llm-get-key)\n    * [llm.user_dir()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-utilities.html#llm-user-dir)\n    * [llm.ModelError](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-utilities.html#llm-modelerror)\n    * [Response.fake()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fplugins\u002Fplugin-utilities.html#response-fake)\n* [Python API](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html)\n  * [Basic prompt execution](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#basic-prompt-execution)\n    * [System prompts](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#system-prompts)\n    * [Attachments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#attachments)\n    * [Tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#tools)\n    * [Schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#schemas)\n    * [Fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#fragments)\n    * [Model options](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#model-options)\n    * [Passing an API key](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#passing-an-api-key)\n    * [Models from plugins](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#models-from-plugins)\n    * [Accessing the underlying JSON](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#accessing-the-underlying-json)\n    * [Token usage](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#token-usage)\n    * [Streaming responses](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#streaming-responses)\n    * [Structured messages and streaming events](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#structured-messages-and-streaming-events)\n  * [Async models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#async-models)\n    * [`AsyncResponse`](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#llm.AsyncResponse)\n    * [Tool functions can be sync or async](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#tool-functions-can-be-sync-or-async)\n    * [Tool use for async models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#tool-use-for-async-models)\n  * [Conversations](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#conversations)\n    * [Conversations using tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#conversations-using-tools)\n  * [Listing models](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#listing-models)\n  * [Running code when a response has completed](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#running-code-when-a-response-has-completed)\n  * [Other functions](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#other-functions)\n    * [set_alias(alias, model_id)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#set-alias-alias-model-id)\n    * [remove_alias(alias)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#remove-alias-alias)\n    * [set_default_model(alias)](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#set-default-model-alias)\n    * [get_default_model()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#get-default-model)\n    * [set_default_embedding_model(alias) and get_default_embedding_model()](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fpython-api.html#set-default-embedding-model-alias-and-get-default-embedding-model)\n* [Logging to SQLite](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html)\n  * [Viewing the logs](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#viewing-the-logs)\n    * [-s\u002F–short mode](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#s-short-mode)\n    * [Logs for a conversation](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#logs-for-a-conversation)\n    * [Searching the logs](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#searching-the-logs)\n    * [Filtering past a specific ID](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#filtering-past-a-specific-id)\n    * [Filtering by model](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#filtering-by-model)\n    * [Filtering by prompts that used specific fragments](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#filtering-by-prompts-that-used-specific-fragments)\n    * [Filtering by prompts that used specific tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#filtering-by-prompts-that-used-specific-tools)\n    * [Browsing data collected using schemas](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#browsing-data-collected-using-schemas)\n  * [Browsing logs using Datasette](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#browsing-logs-using-datasette)\n  * [Backing up your database](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#backing-up-your-database)\n  * [SQL schema](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Flogging.html#sql-schema)\n* [Related tools](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Frelated-tools.html)\n  * [strip-tags](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Frelated-tools.html#strip-tags)\n  * [ttok](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Frelated-tools.html#ttok)\n  * [Symbex](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Frelated-tools.html#symbex)\n* [CLI reference](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html)\n  * [llm  –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-help)\n    * [llm prompt –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-prompt-help)\n    * [llm chat –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-chat-help)\n    * [llm keys –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-keys-help)\n    * [llm logs –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-logs-help)\n    * [llm models –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-models-help)\n    * [llm templates –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-templates-help)\n    * [llm schemas –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-schemas-help)\n    * [llm tools –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-tools-help)\n    * [llm aliases –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-aliases-help)\n    * [llm fragments –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-fragments-help)\n    * [llm plugins –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-plugins-help)\n    * [llm install –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-install-help)\n    * [llm uninstall –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-uninstall-help)\n    * [llm embed –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-embed-help)\n    * [llm embed-multi –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-embed-multi-help)\n    * [llm similar –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-similar-help)\n    * [llm embed-models –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-embed-models-help)\n    * [llm collections –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-collections-help)\n    * [llm openai –help](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fhelp.html#llm-openai-help)\n* [Contributing](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fcontributing.html)\n  * [Updating recorded HTTP API interactions and associated snapshots](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fcontributing.html#updating-recorded-http-api-interactions-and-associated-snapshots)\n  * [Debugging tricks](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fcontributing.html#debugging-tricks)\n  * [Documentation](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fcontributing.html#documentation)\n  * [Release process](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fcontributing.html#release-process)\n\n* [Changelog](https:\u002F\u002Fllm.datasette.io\u002Fen\u002Fstable\u002Fchangelog.html)\n\u003C!-- [[[end]]] -->\n","LLM 是一个命令行工具及 Python 库，用于与多种大型语言模型（如 OpenAI、Anthropic 的 Claude、Google 的 Gemini 和 Meta 的 Llama 等）进行交互。它支持通过远程 API 或在本地安装运行模型来执行提示、存储对话记录到 SQLite 数据库中、生成和存储嵌入向量、从文本和图像中提取结构化内容以及授权模型执行特定工具等功能。该项目采用 Python 编写，并遵循 Apache License 2.0 开源协议。适用于需要快速便捷地访问和利用语言模型能力的开发者或研究人员，在自然语言处理任务开发、原型设计验证等场景下尤为适用。",2,"2026-06-11 03:35:12","high_star"]