llms-py 2.0.9__py3-none-any.whl → 3.0.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. llms/__init__.py +4 -0
  2. llms/__main__.py +9 -0
  3. llms/db.py +359 -0
  4. llms/extensions/analytics/ui/index.mjs +1444 -0
  5. llms/extensions/app/README.md +20 -0
  6. llms/extensions/app/__init__.py +589 -0
  7. llms/extensions/app/db.py +536 -0
  8. {llms_py-2.0.9.data/data → llms/extensions/app}/ui/Recents.mjs +100 -73
  9. llms_py-2.0.9.data/data/ui/Sidebar.mjs → llms/extensions/app/ui/index.mjs +150 -79
  10. llms/extensions/app/ui/threadStore.mjs +433 -0
  11. llms/extensions/core_tools/CALCULATOR.md +32 -0
  12. llms/extensions/core_tools/__init__.py +637 -0
  13. llms/extensions/core_tools/ui/codemirror/addon/edit/closebrackets.js +201 -0
  14. llms/extensions/core_tools/ui/codemirror/addon/edit/closetag.js +185 -0
  15. llms/extensions/core_tools/ui/codemirror/addon/edit/continuelist.js +101 -0
  16. llms/extensions/core_tools/ui/codemirror/addon/edit/matchbrackets.js +160 -0
  17. llms/extensions/core_tools/ui/codemirror/addon/edit/matchtags.js +66 -0
  18. llms/extensions/core_tools/ui/codemirror/addon/edit/trailingspace.js +27 -0
  19. llms/extensions/core_tools/ui/codemirror/addon/selection/active-line.js +72 -0
  20. llms/extensions/core_tools/ui/codemirror/addon/selection/mark-selection.js +119 -0
  21. llms/extensions/core_tools/ui/codemirror/addon/selection/selection-pointer.js +98 -0
  22. llms/extensions/core_tools/ui/codemirror/codemirror.css +344 -0
  23. llms/extensions/core_tools/ui/codemirror/codemirror.js +9884 -0
  24. llms/extensions/core_tools/ui/codemirror/doc/docs.css +225 -0
  25. llms/extensions/core_tools/ui/codemirror/doc/source_sans.woff +0 -0
  26. llms/extensions/core_tools/ui/codemirror/mode/clike/clike.js +942 -0
  27. llms/extensions/core_tools/ui/codemirror/mode/javascript/index.html +118 -0
  28. llms/extensions/core_tools/ui/codemirror/mode/javascript/javascript.js +962 -0
  29. llms/extensions/core_tools/ui/codemirror/mode/javascript/typescript.html +62 -0
  30. llms/extensions/core_tools/ui/codemirror/mode/python/python.js +402 -0
  31. llms/extensions/core_tools/ui/codemirror/theme/dracula.css +40 -0
  32. llms/extensions/core_tools/ui/codemirror/theme/mocha.css +135 -0
  33. llms/extensions/core_tools/ui/index.mjs +650 -0
  34. llms/extensions/gallery/README.md +61 -0
  35. llms/extensions/gallery/__init__.py +63 -0
  36. llms/extensions/gallery/db.py +243 -0
  37. llms/extensions/gallery/ui/index.mjs +482 -0
  38. llms/extensions/katex/README.md +39 -0
  39. llms/extensions/katex/__init__.py +6 -0
  40. llms/extensions/katex/ui/README.md +125 -0
  41. llms/extensions/katex/ui/contrib/auto-render.js +338 -0
  42. llms/extensions/katex/ui/contrib/auto-render.min.js +1 -0
  43. llms/extensions/katex/ui/contrib/auto-render.mjs +244 -0
  44. llms/extensions/katex/ui/contrib/copy-tex.js +127 -0
  45. llms/extensions/katex/ui/contrib/copy-tex.min.js +1 -0
  46. llms/extensions/katex/ui/contrib/copy-tex.mjs +105 -0
  47. llms/extensions/katex/ui/contrib/mathtex-script-type.js +109 -0
  48. llms/extensions/katex/ui/contrib/mathtex-script-type.min.js +1 -0
  49. llms/extensions/katex/ui/contrib/mathtex-script-type.mjs +24 -0
  50. llms/extensions/katex/ui/contrib/mhchem.js +3213 -0
  51. llms/extensions/katex/ui/contrib/mhchem.min.js +1 -0
  52. llms/extensions/katex/ui/contrib/mhchem.mjs +3109 -0
  53. llms/extensions/katex/ui/contrib/render-a11y-string.js +887 -0
  54. llms/extensions/katex/ui/contrib/render-a11y-string.min.js +1 -0
  55. llms/extensions/katex/ui/contrib/render-a11y-string.mjs +800 -0
  56. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.ttf +0 -0
  57. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff +0 -0
  58. llms/extensions/katex/ui/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  59. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  60. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  61. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  62. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  63. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  64. llms/extensions/katex/ui/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  65. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  66. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  67. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  68. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  69. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  70. llms/extensions/katex/ui/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  71. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.ttf +0 -0
  72. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff +0 -0
  73. llms/extensions/katex/ui/fonts/KaTeX_Main-Bold.woff2 +0 -0
  74. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  75. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  76. llms/extensions/katex/ui/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  77. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.ttf +0 -0
  78. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff +0 -0
  79. llms/extensions/katex/ui/fonts/KaTeX_Main-Italic.woff2 +0 -0
  80. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.ttf +0 -0
  81. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff +0 -0
  82. llms/extensions/katex/ui/fonts/KaTeX_Main-Regular.woff2 +0 -0
  83. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  84. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  85. llms/extensions/katex/ui/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  86. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.ttf +0 -0
  87. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff +0 -0
  88. llms/extensions/katex/ui/fonts/KaTeX_Math-Italic.woff2 +0 -0
  89. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  90. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  91. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  92. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  93. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  94. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  95. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  96. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  97. llms/extensions/katex/ui/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  98. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.ttf +0 -0
  99. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff +0 -0
  100. llms/extensions/katex/ui/fonts/KaTeX_Script-Regular.woff2 +0 -0
  101. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.ttf +0 -0
  102. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff +0 -0
  103. llms/extensions/katex/ui/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  104. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.ttf +0 -0
  105. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff +0 -0
  106. llms/extensions/katex/ui/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  107. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.ttf +0 -0
  108. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff +0 -0
  109. llms/extensions/katex/ui/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  110. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.ttf +0 -0
  111. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff +0 -0
  112. llms/extensions/katex/ui/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  113. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  114. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  115. llms/extensions/katex/ui/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  116. llms/extensions/katex/ui/index.mjs +92 -0
  117. llms/extensions/katex/ui/katex-swap.css +1230 -0
  118. llms/extensions/katex/ui/katex-swap.min.css +1 -0
  119. llms/extensions/katex/ui/katex.css +1230 -0
  120. llms/extensions/katex/ui/katex.js +19080 -0
  121. llms/extensions/katex/ui/katex.min.css +1 -0
  122. llms/extensions/katex/ui/katex.min.js +1 -0
  123. llms/extensions/katex/ui/katex.min.mjs +1 -0
  124. llms/extensions/katex/ui/katex.mjs +18547 -0
  125. llms/extensions/providers/__init__.py +22 -0
  126. llms/extensions/providers/anthropic.py +233 -0
  127. llms/extensions/providers/cerebras.py +37 -0
  128. llms/extensions/providers/chutes.py +153 -0
  129. llms/extensions/providers/google.py +481 -0
  130. llms/extensions/providers/nvidia.py +103 -0
  131. llms/extensions/providers/openai.py +154 -0
  132. llms/extensions/providers/openrouter.py +74 -0
  133. llms/extensions/providers/zai.py +182 -0
  134. llms/extensions/system_prompts/README.md +22 -0
  135. llms/extensions/system_prompts/__init__.py +45 -0
  136. llms/extensions/system_prompts/ui/index.mjs +280 -0
  137. llms/extensions/system_prompts/ui/prompts.json +1067 -0
  138. llms/extensions/tools/__init__.py +144 -0
  139. llms/extensions/tools/ui/index.mjs +706 -0
  140. llms/index.html +58 -0
  141. llms/llms.json +400 -0
  142. llms/main.py +4407 -0
  143. llms/providers-extra.json +394 -0
  144. llms/providers.json +1 -0
  145. llms/ui/App.mjs +188 -0
  146. llms/ui/ai.mjs +217 -0
  147. llms/ui/app.css +7081 -0
  148. llms/ui/ctx.mjs +412 -0
  149. llms/ui/index.mjs +131 -0
  150. llms/ui/lib/chart.js +14 -0
  151. llms/ui/lib/charts.mjs +16 -0
  152. llms/ui/lib/color.js +14 -0
  153. llms/ui/lib/servicestack-vue.mjs +37 -0
  154. llms/ui/lib/vue.min.mjs +13 -0
  155. llms/ui/lib/vue.mjs +18530 -0
  156. {llms_py-2.0.9.data/data → llms}/ui/markdown.mjs +33 -15
  157. llms/ui/modules/chat/ChatBody.mjs +976 -0
  158. llms/ui/modules/chat/SettingsDialog.mjs +374 -0
  159. llms/ui/modules/chat/index.mjs +991 -0
  160. llms/ui/modules/icons.mjs +46 -0
  161. llms/ui/modules/layout.mjs +271 -0
  162. llms/ui/modules/model-selector.mjs +811 -0
  163. llms/ui/tailwind.input.css +742 -0
  164. {llms_py-2.0.9.data/data → llms}/ui/typography.css +133 -7
  165. llms/ui/utils.mjs +261 -0
  166. llms_py-3.0.10.dist-info/METADATA +49 -0
  167. llms_py-3.0.10.dist-info/RECORD +177 -0
  168. llms_py-3.0.10.dist-info/entry_points.txt +2 -0
  169. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/licenses/LICENSE +1 -2
  170. llms.py +0 -1402
  171. llms_py-2.0.9.data/data/index.html +0 -64
  172. llms_py-2.0.9.data/data/llms.json +0 -447
  173. llms_py-2.0.9.data/data/requirements.txt +0 -1
  174. llms_py-2.0.9.data/data/ui/App.mjs +0 -20
  175. llms_py-2.0.9.data/data/ui/ChatPrompt.mjs +0 -389
  176. llms_py-2.0.9.data/data/ui/Main.mjs +0 -680
  177. llms_py-2.0.9.data/data/ui/app.css +0 -3951
  178. llms_py-2.0.9.data/data/ui/lib/servicestack-vue.min.mjs +0 -37
  179. llms_py-2.0.9.data/data/ui/lib/vue.min.mjs +0 -12
  180. llms_py-2.0.9.data/data/ui/tailwind.input.css +0 -261
  181. llms_py-2.0.9.data/data/ui/threadStore.mjs +0 -273
  182. llms_py-2.0.9.data/data/ui/utils.mjs +0 -114
  183. llms_py-2.0.9.data/data/ui.json +0 -1069
  184. llms_py-2.0.9.dist-info/METADATA +0 -941
  185. llms_py-2.0.9.dist-info/RECORD +0 -30
  186. llms_py-2.0.9.dist-info/entry_points.txt +0 -2
  187. {llms_py-2.0.9.data/data → llms}/ui/fav.svg +0 -0
  188. {llms_py-2.0.9.data/data → llms}/ui/lib/highlight.min.mjs +0 -0
  189. {llms_py-2.0.9.data/data → llms}/ui/lib/idb.min.mjs +0 -0
  190. {llms_py-2.0.9.data/data → llms}/ui/lib/marked.min.mjs +0 -0
  191. /llms_py-2.0.9.data/data/ui/lib/servicestack-client.min.mjs → /llms/ui/lib/servicestack-client.mjs +0 -0
  192. {llms_py-2.0.9.data/data → llms}/ui/lib/vue-router.min.mjs +0 -0
  193. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/WHEEL +0 -0
  194. {llms_py-2.0.9.dist-info → llms_py-3.0.10.dist-info}/top_level.txt +0 -0
@@ -1,941 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: llms-py
3
- Version: 2.0.9
4
- Summary: A lightweight CLI tool and OpenAI-compatible server for querying multiple Large Language Model (LLM) providers
5
- Home-page: https://github.com/ServiceStack/llms
6
- Author: ServiceStack
7
- Author-email: ServiceStack <team@servicestack.net>
8
- Maintainer-email: ServiceStack <team@servicestack.net>
9
- License-Expression: BSD-3-Clause
10
- Project-URL: Homepage, https://github.com/ServiceStack/llms
11
- Project-URL: Documentation, https://github.com/ServiceStack/llms#readme
12
- Project-URL: Repository, https://github.com/ServiceStack/llms
13
- Project-URL: Bug Reports, https://github.com/ServiceStack/llms/issues
14
- Keywords: llm,ai,openai,anthropic,google,gemini,groq,mistral,ollama,cli,server,chat,completion
15
- Classifier: Development Status :: 5 - Production/Stable
16
- Classifier: Intended Audience :: Developers
17
- Classifier: Intended Audience :: System Administrators
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.7
21
- Classifier: Programming Language :: Python :: 3.8
22
- Classifier: Programming Language :: Python :: 3.9
23
- Classifier: Programming Language :: Python :: 3.10
24
- Classifier: Programming Language :: Python :: 3.11
25
- Classifier: Programming Language :: Python :: 3.12
26
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
- Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
28
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
- Classifier: Topic :: System :: Systems Administration
30
- Classifier: Topic :: Utilities
31
- Classifier: Environment :: Console
32
- Requires-Python: >=3.7
33
- Description-Content-Type: text/markdown
34
- License-File: LICENSE
35
- Requires-Dist: aiohttp
36
- Dynamic: author
37
- Dynamic: home-page
38
- Dynamic: license-file
39
- Dynamic: requires-python
40
-
41
- # llms.py
42
-
43
- Lightweight CLI and OpenAI-compatible server for querying multiple Large Language Model (LLM) providers.
44
-
45
- Configure additional providers and models in [llms.json](llms.json)
46
- - Mix and match local models with models from different API providers
47
- - Requests automatically routed to available providers that supports the requested model (in defined order)
48
- - Define free/cheapest/local providers first to save on costs
49
- - Any failures are automatically retried on the next available provider
50
-
51
- ## Features
52
-
53
- - **Lightweight**: Single [llms.py](llms.py) Python file with single `aiohttp` dependency
54
- - **Multi-Provider Support**: OpenRouter, Ollama, Anthropic, Google, OpenAI, Grok, Groq, Qwen, Z.ai, Mistral
55
- - **OpenAI-Compatible API**: Works with any client that supports OpenAI's chat completion API
56
- - **Configuration Management**: Easy provider enable/disable and configuration management
57
- - **CLI Interface**: Simple command-line interface for quick interactions
58
- - **Server Mode**: Run an OpenAI-compatible HTTP server at `http://localhost:{PORT}/v1/chat/completions`
59
- - **Image Support**: Process images through vision-capable models
60
- - **Audio Support**: Process audio through audio-capable models
61
- - **Custom Chat Templates**: Configurable chat completion request templates for different modalities
62
- - **Auto-Discovery**: Automatically discover available Ollama models
63
- - **Unified Models**: Define custom model names that map to different provider-specific names
64
- - **Multi-Model Support**: Support for over 160+ different LLMs
65
-
66
- ## llms.py UI
67
-
68
- Simple ChatGPT-like UI to access ALL Your LLMs, Locally or Remotely!
69
-
70
- [![llms.py UI](https://servicestack.net/img/posts/llms-py-ui/bg.webp)](https://servicestack.net/posts/llms-py-ui)
71
-
72
- Read the [Introductory Blog Post](https://servicestack.net/posts/llms-py-ui).
73
-
74
- ## Installation
75
-
76
- ### Option 1: Install from PyPI
77
-
78
- ```bash
79
- pip install llms-py
80
- ```
81
-
82
- ### Option 2: Download directly
83
-
84
- 1. Download [llms.py](llms.py)
85
-
86
- ```bash
87
- curl -O https://raw.githubusercontent.com/ServiceStack/llms/main/llms.py
88
- chmod +x llms.py
89
- mv llms.py ~/.local/bin/llms
90
- ```
91
-
92
- 2. Install single dependency:
93
-
94
- ```bash
95
- pip install aiohttp
96
- ```
97
-
98
- ## Quick Start
99
-
100
- ### 1. Initialize Configuration
101
-
102
- Create a default configuration file:
103
-
104
- ```bash
105
- llms --init
106
- ```
107
-
108
- This saves the latest [llms.json](llms.json) configuration to `~/.llms/llms.json`.
109
-
110
- Modify `~/.llms/llms.json` to enable providers, add required API keys, additional models or any custom
111
- OpenAI-compatible providers.
112
-
113
- ### 2. Set API Keys
114
-
115
- Set environment variables for the providers you want to use:
116
-
117
- ```bash
118
- export OPENROUTER_API_KEY="..."
119
- export GROQ_API_KEY="..."
120
- export GOOGLE_API_KEY="..."
121
- export ANTHROPIC_API_KEY="..."
122
- export GROK_API_KEY="..."
123
- export DASHSCOPE_API_KEY="..."
124
- # ... etc
125
- ```
126
-
127
- ### 3. Enable Providers
128
-
129
- Enable the providers you want to use:
130
-
131
- ```bash
132
- # Enable providers with free models and free tiers
133
- llms --enable openrouter_free google_free groq
134
-
135
- # Enable paid providers
136
- llms --enable openrouter anthropic google openai mistral grok qwen
137
- ```
138
-
139
- ### 4. Start Chatting
140
-
141
- ```bash
142
- llms "What is the capital of France?"
143
- ```
144
-
145
- ## Configuration
146
-
147
- The configuration file (`llms.json`) defines available providers, models, and default settings. Key sections:
148
-
149
- ### Defaults
150
- - `headers`: Common HTTP headers for all requests
151
- - `text`: Default chat completion request template for text prompts
152
-
153
- ### Providers
154
-
155
- Each provider configuration includes:
156
- - `enabled`: Whether the provider is active
157
- - `type`: Provider class (OpenAiProvider, GoogleProvider, etc.)
158
- - `api_key`: API key (supports environment variables with `$VAR_NAME`)
159
- - `base_url`: API endpoint URL
160
- - `models`: Model name mappings (local name → provider name)
161
-
162
- ## Command Line Usage
163
-
164
- ### Basic Chat
165
-
166
- ```bash
167
- # Simple question
168
- llms "Explain quantum computing"
169
-
170
- # With specific model
171
- llms -m gemini-2.5-pro "Write a Python function to sort a list"
172
- llms -m grok-4 "Explain this code with humor"
173
- llms -m qwen3-max "Translate this to Chinese"
174
-
175
- # With system prompt
176
- llms -s "You are a helpful coding assistant" "How do I reverse a string in Python?"
177
-
178
- # With image (vision models)
179
- llms --image image.jpg "What's in this image?"
180
- llms --image https://example.com/photo.png "Describe this photo"
181
-
182
- # Display full JSON Response
183
- llms "Explain quantum computing" --raw
184
- ```
185
-
186
- ### Using a Chat Template
187
-
188
- By default llms uses the `defaults/text` chat completion request defined in [llms.json](llms.json).
189
-
190
- You can instead use a custom chat completion request with `--chat`, e.g:
191
-
192
- ```bash
193
- # Load chat completion request from JSON file
194
- llms --chat request.json
195
-
196
- # Override user message
197
- llms --chat request.json "New user message"
198
-
199
- # Override model
200
- llms -m kimi-k2 --chat request.json
201
- ```
202
-
203
- Example `request.json`:
204
-
205
- ```json
206
- {
207
- "model": "kimi-k2",
208
- "messages": [
209
- {"role": "system", "content": "You are a helpful assistant."},
210
- {"role": "user", "content": ""}
211
- ],
212
- "temperature": 0.7,
213
- "max_tokens": 150
214
- }
215
- ```
216
-
217
- ### Image Requests
218
-
219
- Send images to vision-capable models using the `--image` option:
220
-
221
- ```bash
222
- # Use defaults/image Chat Template (Describe the key features of the input image)
223
- llms --image ./screenshot.png
224
-
225
- # Local image file
226
- llms --image ./screenshot.png "What's in this image?"
227
-
228
- # Remote image URL
229
- llms --image https://example.org/photo.jpg "Describe this photo"
230
-
231
- # Data URI
232
- llms --image "data:image/png;base64,$(base64 -w 0 image.png)" "Describe this image"
233
-
234
- # With a specific vision model
235
- llms -m gemini-2.5-flash --image chart.png "Analyze this chart"
236
- llms -m qwen2.5vl --image document.jpg "Extract text from this document"
237
-
238
- # Combined with system prompt
239
- llms -s "You are a data analyst" --image graph.png "What trends do you see?"
240
-
241
- # With custom chat template
242
- llms --chat image-request.json --image photo.jpg
243
- ```
244
-
245
- Example of `image-request.json`:
246
-
247
- ```json
248
- {
249
- "model": "qwen2.5vl",
250
- "messages": [
251
- {
252
- "role": "user",
253
- "content": [
254
- {
255
- "type": "image_url",
256
- "image_url": {
257
- "url": ""
258
- }
259
- },
260
- {
261
- "type": "text",
262
- "text": "Caption this image"
263
- }
264
- ]
265
- }
266
- ]
267
- }
268
- ```
269
-
270
- **Supported image formats**: PNG, WEBP, JPG, JPEG, GIF, BMP, TIFF, ICO
271
-
272
- **Image sources**:
273
- - **Local files**: Absolute paths (`/path/to/image.jpg`) or relative paths (`./image.png`, `../image.jpg`)
274
- - **Remote URLs**: HTTP/HTTPS URLs are automatically downloaded
275
- - **Data URIs**: Base64-encoded images (`data:image/png;base64,...`)
276
-
277
- Images are automatically processed and converted to base64 data URIs before being sent to the model.
278
-
279
- ### Vision-Capable Models
280
-
281
- Popular models that support image analysis:
282
- - **OpenAI**: GPT-4o, GPT-4o-mini, GPT-4.1
283
- - **Anthropic**: Claude Sonnet 4.0, Claude Opus 4.1
284
- - **Google**: Gemini 2.5 Pro, Gemini Flash
285
- - **Qwen**: Qwen2.5-VL, Qwen3-VL, QVQ-max
286
- - **Ollama**: qwen2.5vl, llava
287
-
288
- Images are automatically downloaded and converted to base64 data URIs.
289
-
290
- ### Audio Requests
291
-
292
- Send audio files to audio-capable models using the `--audio` option:
293
-
294
- ```bash
295
- # Use defaults/audio Chat Template (Transcribe the audio)
296
- llms --audio ./recording.mp3
297
-
298
- # Local audio file
299
- llms --audio ./meeting.wav "Summarize this meeting recording"
300
-
301
- # Remote audio URL
302
- llms --audio https://example.org/podcast.mp3 "What are the key points discussed?"
303
-
304
- # With a specific audio model
305
- llms -m gpt-4o-audio-preview --audio interview.mp3 "Extract the main topics"
306
- llms -m gemini-2.5-flash --audio interview.mp3 "Extract the main topics"
307
-
308
- # Combined with system prompt
309
- llms -s "You're a transcription specialist" --audio talk.mp3 "Provide a detailed transcript"
310
-
311
- # With custom chat template
312
- llms --chat audio-request.json --audio speech.wav
313
- ```
314
-
315
- Example of `audio-request.json`:
316
-
317
- ```json
318
- {
319
- "model": "gpt-4o-audio-preview",
320
- "messages": [
321
- {
322
- "role": "user",
323
- "content": [
324
- {
325
- "type": "input_audio",
326
- "input_audio": {
327
- "data": "",
328
- "format": "mp3"
329
- }
330
- },
331
- {
332
- "type": "text",
333
- "text": "Please transcribe this audio"
334
- }
335
- ]
336
- }
337
- ]
338
- }
339
- ```
340
-
341
- **Supported audio formats**: MP3, WAV
342
-
343
- **Audio sources**:
344
- - **Local files**: Absolute paths (`/path/to/audio.mp3`) or relative paths (`./audio.wav`, `../recording.m4a`)
345
- - **Remote URLs**: HTTP/HTTPS URLs are automatically downloaded
346
- - **Base64 Data**: Base64-encoded audio
347
-
348
- Audio files are automatically processed and converted to base64 data before being sent to the model.
349
-
350
- ### Audio-Capable Models
351
-
352
- Popular models that support audio processing:
353
- - **OpenAI**: gpt-4o-audio-preview
354
- - **Google**: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite
355
-
356
- Audio files are automatically downloaded and converted to base64 data URIs with appropriate format detection.
357
-
358
- ### File Requests
359
-
360
- Send documents (e.g. PDFs) to file-capable models using the `--file` option:
361
-
362
- ```bash
363
- # Use defaults/file Chat Template (Summarize the document)
364
- llms --file ./docs/handbook.pdf
365
-
366
- # Local PDF file
367
- llms --file ./docs/policy.pdf "Summarize the key changes"
368
-
369
- # Remote PDF URL
370
- llms --file https://example.org/whitepaper.pdf "What are the main findings?"
371
-
372
- # With specific file-capable models
373
- llms -m gpt-5 --file ./policy.pdf "Summarize the key changes"
374
- llms -m gemini-flash-latest --file ./report.pdf "Extract action items"
375
- llms -m qwen2.5vl --file ./manual.pdf "List key sections and their purpose"
376
-
377
- # Combined with system prompt
378
- llms -s "You're a compliance analyst" --file ./policy.pdf "Identify compliance risks"
379
-
380
- # With custom chat template
381
- llms --chat file-request.json --file ./docs/handbook.pdf
382
- ```
383
-
384
- Example of `file-request.json`:
385
-
386
- ```json
387
- {
388
- "model": "gpt-5",
389
- "messages": [
390
- {
391
- "role": "user",
392
- "content": [
393
- {
394
- "type": "file",
395
- "file": {
396
- "filename": "",
397
- "file_data": ""
398
- }
399
- },
400
- {
401
- "type": "text",
402
- "text": "Please summarize this document"
403
- }
404
- ]
405
- }
406
- ]
407
- }
408
- ```
409
-
410
- **Supported file formats**: PDF
411
-
412
- Other document types may work depending on the model/provider.
413
-
414
- **File sources**:
415
- - **Local files**: Absolute paths (`/path/to/file.pdf`) or relative paths (`./file.pdf`, `../file.pdf`)
416
- - **Remote URLs**: HTTP/HTTPS URLs are automatically downloaded
417
- - **Base64/Data URIs**: Inline `data:application/pdf;base64,...` is supported
418
-
419
- Files are automatically downloaded (for URLs) and converted to base64 data URIs before being sent to the model.
420
-
421
- ### File-Capable Models
422
-
423
- Popular multi-modal models that support file (PDF) inputs:
424
- - OpenAI: gpt-5, gpt-5-mini, gpt-4o, gpt-4o-mini
425
- - Google: gemini-flash-latest, gemini-2.5-flash-lite
426
- - Grok: grok-4-fast (OpenRouter)
427
- - Qwen: qwen2.5vl, qwen3-max, qwen3-vl:235b, qwen3-coder, qwen3-coder-flash (OpenRouter)
428
- - Others: kimi-k2, glm-4.5-air, deepseek-v3.1:671b, llama4:400b, llama3.3:70b, mai-ds-r1, nemotron-nano:9b
429
-
430
- ## Server Mode
431
-
432
- Run as an OpenAI-compatible HTTP server:
433
-
434
- ```bash
435
- # Start server on port 8000
436
- llms --serve 8000
437
- ```
438
-
439
- The server exposes a single endpoint:
440
- - `POST /v1/chat/completions` - OpenAI-compatible chat completions
441
-
442
- Example client usage:
443
-
444
- ```bash
445
- curl -X POST http://localhost:8000/v1/chat/completions \
446
- -H "Content-Type: application/json" \
447
- -d '{
448
- "model": "kimi-k2",
449
- "messages": [
450
- {"role": "user", "content": "Hello!"}
451
- ]
452
- }'
453
- ```
454
-
455
- ### Configuration Management
456
-
457
- ```bash
458
- # List enabled providers and models
459
- llms --list
460
- llms ls
461
-
462
- # List specific providers
463
- llms ls ollama
464
- llms ls google anthropic
465
-
466
- # Enable providers
467
- llms --enable openrouter
468
- llms --enable anthropic google_free groq
469
-
470
- # Disable providers
471
- llms --disable ollama
472
- llms --disable openai anthropic
473
-
474
- # Set default model
475
- llms --default grok-4
476
- ```
477
-
478
- ### Update
479
-
480
- 1. Installed from PyPI
481
-
482
- ```bash
483
- pip install llms-py --upgrade
484
- ```
485
-
486
- 2. Using Direct Download
487
-
488
- ```bash
489
- # Update to latest version (Downloads latest llms.py)
490
- llms --update
491
- ```
492
-
493
- ### Advanced Options
494
-
495
- ```bash
496
- # Use custom config file
497
- llms --config /path/to/config.json "Hello"
498
-
499
- # Get raw JSON response
500
- llms --raw "What is 2+2?"
501
-
502
- # Enable verbose logging
503
- llms --verbose "Tell me a joke"
504
-
505
- # Custom log prefix
506
- llms --verbose --logprefix "[DEBUG] " "Hello world"
507
-
508
- # Set default model (updates config file)
509
- llms --default grok-4
510
-
511
- # Update llms.py to latest version
512
- llms --update
513
-
514
- # Pass custom parameters to chat request (URL-encoded)
515
- llms --args "temperature=0.7&seed=111" "What is 2+2?"
516
-
517
- # Multiple parameters with different types
518
- llms --args "temperature=0.5&max_completion_tokens=50" "Tell me a joke"
519
-
520
- # URL-encoded special characters (stop sequences)
521
- llms --args "stop=Two,Words" "Count to 5"
522
-
523
- # Combine with other options
524
- llms --system "You are helpful" --args "temperature=0.3" --raw "Hello"
525
- ```
526
-
527
- #### Custom Parameters with `--args`
528
-
529
- The `--args` option allows you to pass URL-encoded parameters to customize the chat request sent to LLM providers:
530
-
531
- **Parameter Types:**
532
- - **Floats**: `temperature=0.7`, `frequency_penalty=0.2`
533
- - **Integers**: `max_completion_tokens=100`
534
- - **Booleans**: `store=true`, `verbose=false`, `logprobs=true`
535
- - **Strings**: `stop=one`
536
- - **Lists**: `stop=two,words`
537
-
538
- **Common Parameters:**
539
- - `temperature`: Controls randomness (0.0 to 2.0)
540
- - `max_completion_tokens`: Maximum tokens in response
541
- - `seed`: For reproducible outputs
542
- - `top_p`: Nucleus sampling parameter
543
- - `stop`: Stop sequences (URL-encode special chars)
544
- - `store`: Whether or not to store the output
545
- - `frequency_penalty`: Penalize new tokens based on frequency
546
- - `presence_penalty`: Penalize new tokens based on presence
547
- - `logprobs`: Include log probabilities in response
548
- - `parallel_tool_calls`: Enable parallel tool calls
549
- - `prompt_cache_key`: Cache key for prompt
550
- - `reasoning_effort`: Reasoning effort (low, medium, high, *minimal, *none, *default)
551
- - `safety_identifier`: A string that uniquely identifies each user
552
- - `seed`: For reproducible outputs
553
- - `service_tier`: Service tier (free, standard, premium, *default)
554
- - `top_logprobs`: Number of top logprobs to return
555
- - `top_p`: Nucleus sampling parameter
556
- - `verbosity`: Verbosity level (0, 1, 2, 3, *default)
557
- - `enable_thinking`: Enable thinking mode (Qwen)
558
- - `stream`: Enable streaming responses
559
-
560
- ### Default Model Configuration
561
-
562
- The `--default MODEL` option allows you to set the default model used for all chat completions. This updates the `defaults.text.model` field in your configuration file:
563
-
564
- ```bash
565
- # Set default model to gpt-oss
566
- llms --default gpt-oss:120b
567
-
568
- # Set default model to Claude Sonnet
569
- llms --default claude-sonnet-4-0
570
-
571
- # The model must be available in your enabled providers
572
- llms --default gemini-2.5-pro
573
- ```
574
-
575
- When you set a default model:
576
- - The configuration file (`~/.llms/llms.json`) is automatically updated
577
- - The specified model becomes the default for all future chat requests
578
- - The model must exist in your currently enabled providers
579
- - You can still override the default using `-m MODEL` for individual requests
580
-
581
- ### Updating llms.py
582
-
583
- The `--update` option downloads and installs the latest version of `llms.py` from the GitHub repository:
584
-
585
- ```bash
586
- # Update to latest version
587
- llms --update
588
- ```
589
-
590
- This command:
591
- - Downloads the latest `llms.py` from `https://raw.githubusercontent.com/ServiceStack/llms/refs/heads/main/llms.py`
592
- - Overwrites your current `llms.py` file with the latest version
593
- - Preserves your existing configuration file (`llms.json`)
594
- - Requires an internet connection to download the update
595
-
596
- ### Beautiful rendered Markdown
597
-
598
- Pipe Markdown output to [glow](https://github.com/charmbracelet/glow) to beautifully render it in the terminal:
599
-
600
- ```bash
601
- llms "Explain quantum computing" | glow
602
- ```
603
-
604
- ## Supported Providers
605
-
606
- Any OpenAI-compatible providers and their models can be added by configuring them in [llms.json](./llms.json). By default only AI Providers with free tiers are enabled which will only be "available" if their API Key is set.
607
-
608
- You can list the available providers, their models and which are enabled or disabled with:
609
-
610
- ```bash
611
- llms ls
612
- ```
613
-
614
- They can be enabled/disabled in your `llms.json` file or with:
615
-
616
- ```bash
617
- llms --enable <provider>
618
- llms --disable <provider>
619
- ```
620
-
621
- For a provider to be available, they also require their API Key configured in either your Environment Variables
622
- or directly in your `llms.json`.
623
-
624
- ### Environment Variables
625
-
626
- | Provider | Variable | Description | Example |
627
- |-----------------|---------------------------|---------------------|---------|
628
- | openrouter_free | `OPENROUTER_FREE_API_KEY` | OpenRouter FREE models API key | `sk-or-...` |
629
- | groq | `GROQ_API_KEY` | Groq API key | `gsk_...` |
630
- | google_free | `GOOGLE_FREE_API_KEY` | Google FREE API key | `AIza...` |
631
- | codestral | `CODESTRAL_API_KEY` | Codestral API key | `...` |
632
- | ollama | N/A | No API key required | |
633
- | openrouter | `OPENROUTER_API_KEY` | OpenRouter API key | `sk-or-...` |
634
- | google | `GOOGLE_API_KEY` | Google API key | `AIza...` |
635
- | anthropic | `ANTHROPIC_API_KEY` | Anthropic API key | `sk-ant-...` |
636
- | openai | `OPENAI_API_KEY` | OpenAI API key | `sk-...` |
637
- | grok | `GROK_API_KEY` | Grok (X.AI) API key | `xai-...` |
638
- | qwen | `DASHSCOPE_API_KEY` | Qwen (Alibaba) API key | `sk-...` |
639
- | z.ai | `ZAI_API_KEY` | Z.ai API key | `sk-...` |
640
- | mistral | `MISTRAL_API_KEY` | Mistral API key | `...` |
641
-
642
- ### OpenAI
643
- - **Type**: `OpenAiProvider`
644
- - **Models**: GPT-5, GPT-5 Codex, GPT-4o, GPT-4o-mini, o3, etc.
645
- - **Features**: Text, images, function calling
646
-
647
- ```bash
648
- export OPENAI_API_KEY="your-key"
649
- llms --enable openai
650
- ```
651
-
652
- ### Anthropic (Claude)
653
- - **Type**: `OpenAiProvider`
654
- - **Models**: Claude Opus 4.1, Sonnet 4.0, Haiku 3.5, etc.
655
- - **Features**: Text, images, large context windows
656
-
657
- ```bash
658
- export ANTHROPIC_API_KEY="your-key"
659
- llms --enable anthropic
660
- ```
661
-
662
- ### Google Gemini
663
- - **Type**: `GoogleProvider`
664
- - **Models**: Gemini 2.5 Pro, Flash, Flash-Lite
665
- - **Features**: Text, images, safety settings
666
-
667
- ```bash
668
- export GOOGLE_API_KEY="your-key"
669
- llms --enable google_free
670
- ```
671
-
672
- ### OpenRouter
673
- - **Type**: `OpenAiProvider`
674
- - **Models**: 100+ models from various providers
675
- - **Features**: Access to latest models, free tier available
676
-
677
- ```bash
678
- export OPENROUTER_API_KEY="your-key"
679
- llms --enable openrouter
680
- ```
681
-
682
- ### Grok (X.AI)
683
- - **Type**: `OpenAiProvider`
684
- - **Models**: Grok-4, Grok-3, Grok-3-mini, Grok-code-fast-1, etc.
685
- - **Features**: Real-time information, humor, uncensored responses
686
-
687
- ```bash
688
- export GROK_API_KEY="your-key"
689
- llms --enable grok
690
- ```
691
-
692
- ### Groq
693
- - **Type**: `OpenAiProvider`
694
- - **Models**: Llama 3.3, Gemma 2, Kimi K2, etc.
695
- - **Features**: Fast inference, competitive pricing
696
-
697
- ```bash
698
- export GROQ_API_KEY="your-key"
699
- llms --enable groq
700
- ```
701
-
702
- ### Ollama (Local)
703
- - **Type**: `OllamaProvider`
704
- - **Models**: Auto-discovered from local Ollama installation
705
- - **Features**: Local inference, privacy, no API costs
706
-
707
- ```bash
708
- # Ollama must be running locally
709
- llms --enable ollama
710
- ```
711
-
712
- ### Qwen (Alibaba Cloud)
713
- - **Type**: `OpenAiProvider`
714
- - **Models**: Qwen3-max, Qwen-max, Qwen-plus, Qwen2.5-VL, QwQ-plus, etc.
715
- - **Features**: Multilingual, vision models, coding, reasoning, audio processing
716
-
717
- ```bash
718
- export DASHSCOPE_API_KEY="your-key"
719
- llms --enable qwen
720
- ```
721
-
722
- ### Z.ai
723
- - **Type**: `OpenAiProvider`
724
- - **Models**: GLM-4.6, GLM-4.5, GLM-4.5-air, GLM-4.5-x, GLM-4.5-airx, GLM-4.5-flash, GLM-4:32b
725
- - **Features**: Advanced language models with strong reasoning capabilities
726
-
727
- ```bash
728
- export ZAI_API_KEY="your-key"
729
- llms --enable z.ai
730
- ```
731
-
732
- ### Mistral
733
- - **Type**: `OpenAiProvider`
734
- - **Models**: Mistral Large, Codestral, Pixtral, etc.
735
- - **Features**: Code generation, multilingual
736
-
737
- ```bash
738
- export MISTRAL_API_KEY="your-key"
739
- llms --enable mistral
740
- ```
741
-
742
- ### Codestral
743
- - **Type**: `OpenAiProvider`
744
- - **Models**: Codestral
745
- - **Features**: Code generation
746
-
747
- ```bash
748
- export CODESTRAL_API_KEY="your-key"
749
- llms --enable codestral
750
- ```
751
-
752
- ## Model Routing
753
-
754
- The tool automatically routes requests to the first available provider that supports the requested model. If a provider fails, it tries the next available provider with that model.
755
-
756
- Example: If both OpenAI and OpenRouter support `kimi-k2`, the request will first try OpenRouter (free), then fall back to Groq than OpenRouter (Paid) if requests fails.
757
-
758
- ## Configuration Examples
759
-
760
- ### Minimal Configuration
761
-
762
- ```json
763
- {
764
- "defaults": {
765
- "headers": {"Content-Type": "application/json"},
766
- "text": {
767
- "model": "kimi-k2",
768
- "messages": [{"role": "user", "content": ""}]
769
- }
770
- },
771
- "providers": {
772
- "groq": {
773
- "enabled": true,
774
- "type": "OpenAiProvider",
775
- "base_url": "https://api.groq.com/openai",
776
- "api_key": "$GROQ_API_KEY",
777
- "models": {
778
- "llama3.3:70b": "llama-3.3-70b-versatile",
779
- "llama4:109b": "meta-llama/llama-4-scout-17b-16e-instruct",
780
- "llama4:400b": "meta-llama/llama-4-maverick-17b-128e-instruct",
781
- "kimi-k2": "moonshotai/kimi-k2-instruct-0905",
782
- "gpt-oss:120b": "openai/gpt-oss-120b",
783
- "gpt-oss:20b": "openai/gpt-oss-20b",
784
- "qwen3:32b": "qwen/qwen3-32b"
785
- }
786
- }
787
- }
788
- }
789
- ```
790
-
791
- ### Multi-Provider Setup
792
-
793
- ```json
794
- {
795
- "providers": {
796
- "openrouter": {
797
- "enabled": false,
798
- "type": "OpenAiProvider",
799
- "base_url": "https://openrouter.ai/api",
800
- "api_key": "$OPENROUTER_API_KEY",
801
- "models": {
802
- "grok-4": "x-ai/grok-4",
803
- "glm-4.5-air": "z-ai/glm-4.5-air",
804
- "kimi-k2": "moonshotai/kimi-k2",
805
- "deepseek-v3.1:671b": "deepseek/deepseek-chat",
806
- "llama4:400b": "meta-llama/llama-4-maverick"
807
- }
808
- },
809
- "anthropic": {
810
- "enabled": false,
811
- "type": "OpenAiProvider",
812
- "base_url": "https://api.anthropic.com",
813
- "api_key": "$ANTHROPIC_API_KEY",
814
- "models": {
815
- "claude-sonnet-4-0": "claude-sonnet-4-0"
816
- }
817
- },
818
- "ollama": {
819
- "enabled": false,
820
- "type": "OllamaProvider",
821
- "base_url": "http://localhost:11434",
822
- "models": {},
823
- "all_models": true
824
- }
825
- }
826
- }
827
- ```
828
-
829
- ## Usage
830
-
831
- Run `llms` without arguments to see the help screen:
832
-
833
- usage: llms.py [-h] [--config FILE] [-m MODEL] [--chat REQUEST] [-s PROMPT] [--image IMAGE] [--audio AUDIO]
834
- [--file FILE] [--raw] [--list] [--serve PORT] [--enable PROVIDER] [--disable PROVIDER]
835
- [--default MODEL] [--init] [--logprefix PREFIX] [--verbose] [--update]
836
-
837
- llms
838
-
839
- options:
840
- -h, --help show this help message and exit
841
- --config FILE Path to config file
842
- -m MODEL, --model MODEL
843
- Model to use
844
- --chat REQUEST OpenAI Chat Completion Request to send
845
- -s PROMPT, --system PROMPT
846
- System prompt to use for chat completion
847
- --image IMAGE Image input to use in chat completion
848
- --audio AUDIO Audio input to use in chat completion
849
- --file FILE File input to use in chat completion
850
- --raw Return raw AI JSON response
851
- --list Show list of enabled providers and their models (alias ls provider?)
852
- --serve PORT Port to start an OpenAI Chat compatible server on
853
- --enable PROVIDER Enable a provider
854
- --disable PROVIDER Disable a provider
855
- --default MODEL Configure the default model to use
856
- --init Create a default llms.json
857
- --logprefix PREFIX Prefix used in log messages
858
- --verbose Verbose output
859
- --update Update to latest version
860
-
861
- ## Troubleshooting
862
-
863
- ### Common Issues
864
-
865
- **Config file not found**
866
- ```bash
867
- # Initialize default config
868
- llms --init
869
-
870
- # Or specify custom path
871
- llms --config ./my-config.json
872
- ```
873
-
874
- **No providers enabled**
875
-
876
- ```bash
877
- # Check status
878
- llms --list
879
-
880
- # Enable providers
881
- llms --enable google anthropic
882
- ```
883
-
884
- **API key issues**
885
- ```bash
886
- # Check environment variables
887
- echo $ANTHROPIC_API_KEY
888
-
889
- # Enable verbose logging
890
- llms --verbose "test"
891
- ```
892
-
893
- **Model not found**
894
-
895
- ```bash
896
- # List available models
897
- llms --list
898
-
899
- # Check provider configuration
900
- llms ls openrouter
901
- ```
902
-
903
- ### Debug Mode
904
-
905
- Enable verbose logging to see detailed request/response information:
906
-
907
- ```bash
908
- llms --verbose --logprefix "[DEBUG] " "Hello"
909
- ```
910
-
911
- This shows:
912
- - Enabled providers
913
- - Model routing decisions
914
- - HTTP request details
915
- - Error messages with stack traces
916
-
917
- ## Development
918
-
919
- ### Project Structure
920
-
921
- - `llms.py` - Main script with CLI and server functionality
922
- - `llms.json` - Default configuration file
923
- - `requirements.txt` - Python dependencies
924
-
925
- ### Provider Classes
926
-
927
- - `OpenAiProvider` - Generic OpenAI-compatible provider
928
- - `OllamaProvider` - Ollama-specific provider with model auto-discovery
929
- - `GoogleProvider` - Google Gemini with native API format
930
- - `GoogleOpenAiProvider` - Google Gemini via OpenAI-compatible endpoint
931
-
932
- ### Adding New Providers
933
-
934
- 1. Create a provider class inheriting from `OpenAiProvider`
935
- 2. Implement provider-specific authentication and formatting
936
- 3. Add provider configuration to `llms.json`
937
- 4. Update initialization logic in `init_llms()`
938
-
939
- ## Contributing
940
-
941
- Contributions are welcome! Please submit a PR to add support for any missing OpenAI-compatible providers.