llmstack-cli 0.1.0__tar.gz

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 (74) hide show
  1. llmstack_cli-0.1.0/.github/workflows/ci.yml +31 -0
  2. llmstack_cli-0.1.0/.github/workflows/release.yml +28 -0
  3. llmstack_cli-0.1.0/.gitignore +19 -0
  4. llmstack_cli-0.1.0/CHANGELOG.md +16 -0
  5. llmstack_cli-0.1.0/CONTRIBUTING.md +64 -0
  6. llmstack_cli-0.1.0/LICENSE +201 -0
  7. llmstack_cli-0.1.0/Makefile +20 -0
  8. llmstack_cli-0.1.0/PKG-INFO +252 -0
  9. llmstack_cli-0.1.0/README.md +217 -0
  10. llmstack_cli-0.1.0/pyproject.toml +47 -0
  11. llmstack_cli-0.1.0/src/llmstack/__init__.py +3 -0
  12. llmstack_cli-0.1.0/src/llmstack/__main__.py +5 -0
  13. llmstack_cli-0.1.0/src/llmstack/cli/__init__.py +0 -0
  14. llmstack_cli-0.1.0/src/llmstack/cli/app.py +87 -0
  15. llmstack_cli-0.1.0/src/llmstack/cli/commands/__init__.py +0 -0
  16. llmstack_cli-0.1.0/src/llmstack/cli/commands/doctor.py +72 -0
  17. llmstack_cli-0.1.0/src/llmstack/cli/commands/down.py +25 -0
  18. llmstack_cli-0.1.0/src/llmstack/cli/commands/init.py +66 -0
  19. llmstack_cli-0.1.0/src/llmstack/cli/commands/logs.py +25 -0
  20. llmstack_cli-0.1.0/src/llmstack/cli/commands/status.py +45 -0
  21. llmstack_cli-0.1.0/src/llmstack/cli/commands/up.py +30 -0
  22. llmstack_cli-0.1.0/src/llmstack/cli/console.py +13 -0
  23. llmstack_cli-0.1.0/src/llmstack/config/__init__.py +4 -0
  24. llmstack_cli-0.1.0/src/llmstack/config/loader.py +44 -0
  25. llmstack_cli-0.1.0/src/llmstack/config/presets/__init__.py +11 -0
  26. llmstack_cli-0.1.0/src/llmstack/config/presets/agent.py +13 -0
  27. llmstack_cli-0.1.0/src/llmstack/config/presets/chat.py +14 -0
  28. llmstack_cli-0.1.0/src/llmstack/config/presets/rag.py +10 -0
  29. llmstack_cli-0.1.0/src/llmstack/config/schema.py +76 -0
  30. llmstack_cli-0.1.0/src/llmstack/core/__init__.py +0 -0
  31. llmstack_cli-0.1.0/src/llmstack/core/hardware.py +131 -0
  32. llmstack_cli-0.1.0/src/llmstack/core/health.py +23 -0
  33. llmstack_cli-0.1.0/src/llmstack/core/resolver.py +49 -0
  34. llmstack_cli-0.1.0/src/llmstack/core/stack.py +207 -0
  35. llmstack_cli-0.1.0/src/llmstack/docker/__init__.py +0 -0
  36. llmstack_cli-0.1.0/src/llmstack/docker/manager.py +134 -0
  37. llmstack_cli-0.1.0/src/llmstack/gateway/Dockerfile +16 -0
  38. llmstack_cli-0.1.0/src/llmstack/gateway/__init__.py +0 -0
  39. llmstack_cli-0.1.0/src/llmstack/gateway/main.py +52 -0
  40. llmstack_cli-0.1.0/src/llmstack/gateway/middleware/__init__.py +0 -0
  41. llmstack_cli-0.1.0/src/llmstack/gateway/middleware/auth.py +32 -0
  42. llmstack_cli-0.1.0/src/llmstack/gateway/middleware/metrics.py +115 -0
  43. llmstack_cli-0.1.0/src/llmstack/gateway/proxy.py +58 -0
  44. llmstack_cli-0.1.0/src/llmstack/gateway/routes/__init__.py +0 -0
  45. llmstack_cli-0.1.0/src/llmstack/gateway/routes/chat.py +27 -0
  46. llmstack_cli-0.1.0/src/llmstack/gateway/routes/embeddings.py +17 -0
  47. llmstack_cli-0.1.0/src/llmstack/gateway/routes/health.py +55 -0
  48. llmstack_cli-0.1.0/src/llmstack/gateway/routes/models.py +16 -0
  49. llmstack_cli-0.1.0/src/llmstack/plugins/__init__.py +0 -0
  50. llmstack_cli-0.1.0/src/llmstack/plugins/loader.py +5 -0
  51. llmstack_cli-0.1.0/src/llmstack/plugins/spec.py +20 -0
  52. llmstack_cli-0.1.0/src/llmstack/services/__init__.py +0 -0
  53. llmstack_cli-0.1.0/src/llmstack/services/base.py +65 -0
  54. llmstack_cli-0.1.0/src/llmstack/services/cache/__init__.py +0 -0
  55. llmstack_cli-0.1.0/src/llmstack/services/cache/redis.py +33 -0
  56. llmstack_cli-0.1.0/src/llmstack/services/embeddings/__init__.py +0 -0
  57. llmstack_cli-0.1.0/src/llmstack/services/embeddings/tei.py +49 -0
  58. llmstack_cli-0.1.0/src/llmstack/services/gateway/__init__.py +0 -0
  59. llmstack_cli-0.1.0/src/llmstack/services/gateway/service.py +47 -0
  60. llmstack_cli-0.1.0/src/llmstack/services/inference/__init__.py +0 -0
  61. llmstack_cli-0.1.0/src/llmstack/services/inference/ollama.py +60 -0
  62. llmstack_cli-0.1.0/src/llmstack/services/inference/vllm.py +57 -0
  63. llmstack_cli-0.1.0/src/llmstack/services/observe/__init__.py +0 -0
  64. llmstack_cli-0.1.0/src/llmstack/services/observe/prometheus.py +168 -0
  65. llmstack_cli-0.1.0/src/llmstack/services/registry.py +53 -0
  66. llmstack_cli-0.1.0/src/llmstack/services/vectordb/__init__.py +0 -0
  67. llmstack_cli-0.1.0/src/llmstack/services/vectordb/qdrant.py +33 -0
  68. llmstack_cli-0.1.0/tests/__init__.py +0 -0
  69. llmstack_cli-0.1.0/tests/unit/__init__.py +0 -0
  70. llmstack_cli-0.1.0/tests/unit/test_config.py +73 -0
  71. llmstack_cli-0.1.0/tests/unit/test_gateway.py +63 -0
  72. llmstack_cli-0.1.0/tests/unit/test_hardware.py +12 -0
  73. llmstack_cli-0.1.0/tests/unit/test_resolver.py +72 -0
  74. llmstack_cli-0.1.0/tests/unit/test_services.py +186 -0
@@ -0,0 +1,31 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev]"
26
+
27
+ - name: Lint
28
+ run: ruff check src/ tests/
29
+
30
+ - name: Test
31
+ run: pytest tests/ -v --tb=short
@@ -0,0 +1,28 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install build tools
22
+ run: pip install build
23
+
24
+ - name: Build package
25
+ run: python -m build
26
+
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .eggs/
9
+ .venv/
10
+ venv/
11
+ env/
12
+ .env
13
+ *.session
14
+ .DS_Store
15
+ data/
16
+ *.db
17
+ .ruff_cache/
18
+ .pytest_cache/
19
+ llmstack.yaml
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-05-07
4
+
5
+ ### Added
6
+ - CLI with `init`, `up`, `down`, `status`, `logs`, `doctor` commands
7
+ - Auto hardware detection (NVIDIA, Apple Silicon, CPU)
8
+ - Smart backend resolver (auto-picks Ollama or vLLM)
9
+ - Services: Ollama, vLLM, Qdrant, Redis, TEI (Text Embeddings Inference)
10
+ - API Gateway: OpenAI-compatible proxy with auth, rate limiting, SSE streaming
11
+ - Prometheus + Grafana observability with pre-provisioned dashboard
12
+ - Plugin system via Python entry_points
13
+ - Presets: `chat`, `rag`, `agent`
14
+ - Pydantic v2 config schema (`llmstack.yaml`)
15
+ - Docker SDK orchestration (no docker-compose dependency)
16
+ - CI/CD: GitHub Actions for lint/test and PyPI release
@@ -0,0 +1,64 @@
1
+ # Contributing to llmstack
2
+
3
+ Thanks for your interest in contributing! Here's how to get started.
4
+
5
+ ## Development setup
6
+
7
+ ```bash
8
+ git clone https://github.com/mara-werils/llmstack.git
9
+ cd llmstack
10
+ pip install -e ".[dev]"
11
+ ```
12
+
13
+ ## Running tests
14
+
15
+ ```bash
16
+ make test # run all tests
17
+ make lint # check code style
18
+ make format # auto-format code
19
+ ```
20
+
21
+ ## Project structure
22
+
23
+ ```
24
+ src/llmstack/
25
+ ├── cli/ # Typer CLI commands
26
+ ├── config/ # Pydantic config schema + presets
27
+ ├── core/ # Stack orchestrator, hardware detection, resolver
28
+ ├── services/ # Service implementations (Ollama, vLLM, Qdrant, Redis, etc.)
29
+ ├── gateway/ # FastAPI gateway (OpenAI-compatible proxy)
30
+ ├── docker/ # Docker SDK wrapper
31
+ └── plugins/ # Plugin interface + loader
32
+ ```
33
+
34
+ ## Adding a new service
35
+
36
+ 1. Create a class extending `ServiceBase` in `services/`
37
+ 2. Implement `container_spec()`, `health_url()`
38
+ 3. Optionally implement `post_start()`, `openai_base_url()`
39
+ 4. Register in `services/registry.py` or as a plugin via `entry_points`
40
+ 5. Add tests in `tests/unit/`
41
+
42
+ ## Creating a plugin
43
+
44
+ See [plugins/spec.py](src/llmstack/plugins/spec.py) for the plugin interface.
45
+
46
+ ```toml
47
+ # In your plugin's pyproject.toml:
48
+ [project.entry-points."llmstack.services"]
49
+ my_service = "my_package:MyServiceClass"
50
+ ```
51
+
52
+ ## Pull requests
53
+
54
+ - Keep PRs focused on a single change
55
+ - Add tests for new functionality
56
+ - Run `make lint` before submitting
57
+ - Use conventional commit messages (`feat:`, `fix:`, `docs:`)
58
+
59
+ ## Code style
60
+
61
+ - Python 3.11+
62
+ - Ruff for linting and formatting
63
+ - Type hints everywhere
64
+ - Docstrings for public APIs
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,20 @@
1
+ .PHONY: install dev test lint clean
2
+
3
+ install:
4
+ pip install -e .
5
+
6
+ dev:
7
+ pip install -e ".[dev]"
8
+
9
+ test:
10
+ pytest tests/ -v
11
+
12
+ lint:
13
+ ruff check src/ tests/
14
+
15
+ format:
16
+ ruff format src/ tests/
17
+
18
+ clean:
19
+ rm -rf build/ dist/ *.egg-info .pytest_cache .ruff_cache
20
+ find . -type d -name __pycache__ -exec rm -rf {} +
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: llmstack-cli
3
+ Version: 0.1.0
4
+ Summary: One command. Full LLM stack. Zero config.
5
+ Author: mara-werils
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: ai,cli,docker,inference,llm,openai,rag
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: docker>=7.0
18
+ Requires-Dist: httpx>=0.27
19
+ Requires-Dist: psutil>=5.9
20
+ Requires-Dist: pydantic>=2.0
21
+ Requires-Dist: pyyaml>=6.0
22
+ Requires-Dist: rich>=13.0
23
+ Requires-Dist: typer>=0.12
24
+ Provides-Extra: dev
25
+ Requires-Dist: fastapi>=0.115; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4; extra == 'dev'
29
+ Requires-Dist: starlette>=0.40; extra == 'dev'
30
+ Provides-Extra: gateway
31
+ Requires-Dist: fastapi>=0.115; extra == 'gateway'
32
+ Requires-Dist: starlette>=0.40; extra == 'gateway'
33
+ Requires-Dist: uvicorn[standard]>=0.30; extra == 'gateway'
34
+ Description-Content-Type: text/markdown
35
+
36
+ <p align="center">
37
+ <h1 align="center">llmstack</h1>
38
+ <p align="center"><strong>One command. Full LLM stack. Zero config.</strong></p>
39
+ <p align="center">Stop wiring Docker containers. Start building AI apps.</p>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="https://pypi.org/project/llmstack-cli/"><img src="https://img.shields.io/pypi/v/llmstack-cli?color=blue" alt="PyPI"></a>
44
+ <a href="https://github.com/mara-werils/llmstack/actions/workflows/ci.yml"><img src="https://github.com/mara-werils/llmstack/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
45
+ <a href="https://github.com/mara-werils/llmstack/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-green" alt="License"></a>
46
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.11+-blue" alt="Python"></a>
47
+ </p>
48
+
49
+ ---
50
+
51
+ **llmstack** spins up a production-grade LLM stack locally with a single command. It auto-detects your hardware, picks the optimal inference backend, and wires everything together.
52
+
53
+ ```bash
54
+ pip install llmstack-cli
55
+ llmstack init
56
+ llmstack up
57
+ ```
58
+
59
+ That's it. You now have a full LLM API running locally.
60
+
61
+ ## Architecture
62
+
63
+ ```
64
+ llmstack up
65
+ |
66
+ +---------v----------+
67
+ | Hardware Detect |
68
+ | NVIDIA / Apple / CPU|
69
+ +---------+----------+
70
+ |
71
+ +-------+-------+-------+-------+
72
+ | | | | |
73
+ +----v--+ +--v---+ +v-----+ +v----+ +v--------+
74
+ |Qdrant | |Redis | |Ollama| | TEI | | Gateway |
75
+ |Vector | |Cache | | or | |Embed| | FastAPI |
76
+ | DB | | | | vLLM | | | | OpenAI |
77
+ +-------+ +------+ +------+ +-----+ |compatible|
78
+ :6333 :6379 :11434 :8002 +----+-----+
79
+ |:8000
80
+ +----v-----+
81
+ |Prometheus |
82
+ | + Grafana |
83
+ +----------+
84
+ :8080
85
+ ```
86
+
87
+ ## What you get
88
+
89
+ | Layer | Service | Default | Port |
90
+ |-------|---------|---------|------|
91
+ | Inference | Ollama / vLLM (auto) | llama3.2 | 11434 |
92
+ | Embeddings | TEI / Ollama (auto) | bge-m3 | 8002 |
93
+ | Vector DB | Qdrant | - | 6333 |
94
+ | Cache | Redis | 256MB LRU | 6379 |
95
+ | API Gateway | FastAPI (OpenAI-compatible) | auth + rate limit | 8000 |
96
+ | Dashboard | Grafana + Prometheus | pre-built panels | 8080 |
97
+
98
+ ## How it works
99
+
100
+ ```
101
+ llmstack init # Detects hardware, generates llmstack.yaml
102
+ # Picks optimal backend: vLLM for NVIDIA 16GB+, Ollama otherwise
103
+
104
+ llmstack up # Boots services in order with health checks:
105
+ # Qdrant -> Redis -> Inference -> Embeddings -> Gateway -> Metrics
106
+
107
+ llmstack status # Shows health of all running services
108
+ llmstack logs ollama # Stream inference logs
109
+ llmstack down # Stops everything
110
+ ```
111
+
112
+ ### Use the API
113
+
114
+ ```bash
115
+ curl http://localhost:8000/v1/chat/completions \
116
+ -H "Authorization: Bearer YOUR_KEY" \
117
+ -H "Content-Type: application/json" \
118
+ -d '{"model":"llama3.2","messages":[{"role":"user","content":"Hello!"}]}'
119
+ ```
120
+
121
+ Works with **any OpenAI-compatible client**: LangChain, LlamaIndex, Vercel AI SDK, openai-python.
122
+
123
+ ```python
124
+ from openai import OpenAI
125
+
126
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="YOUR_KEY")
127
+ response = client.chat.completions.create(
128
+ model="llama3.2",
129
+ messages=[{"role": "user", "content": "Explain quantum computing"}]
130
+ )
131
+ ```
132
+
133
+ ## Auto hardware detection
134
+
135
+ | Your hardware | Backend | Why |
136
+ |---|---|---|
137
+ | NVIDIA GPU 16GB+ VRAM | vLLM | Max throughput, PagedAttention |
138
+ | NVIDIA GPU <16GB | Ollama | Lower memory overhead |
139
+ | Apple Silicon (M1-M4) | Ollama | Metal acceleration |
140
+ | CPU only | Ollama | GGUF quantized models |
141
+
142
+ ## Presets
143
+
144
+ ```bash
145
+ llmstack init --preset chat # Minimal: inference + cache + gateway
146
+ llmstack init --preset rag # + Qdrant + embeddings for RAG apps
147
+ llmstack init --preset agent # 70B model + 16K context + longer timeouts
148
+ ```
149
+
150
+ ## Configuration
151
+
152
+ One file: `llmstack.yaml`
153
+
154
+ ```yaml
155
+ version: "1"
156
+
157
+ models:
158
+ chat:
159
+ name: llama3.2
160
+ backend: auto # auto | ollama | vllm
161
+ context_length: 8192
162
+ embeddings:
163
+ name: bge-m3
164
+
165
+ services:
166
+ vectors:
167
+ provider: qdrant
168
+ port: 6333
169
+ cache:
170
+ provider: redis
171
+ max_memory: 256mb
172
+
173
+ gateway:
174
+ port: 8000
175
+ auth: api_key
176
+ rate_limit: 100/min
177
+ cors: ["*"]
178
+
179
+ observe:
180
+ metrics: true
181
+ dashboard_port: 8080
182
+ ```
183
+
184
+ ## CLI
185
+
186
+ | Command | Description |
187
+ |---------|-------------|
188
+ | `llmstack init [--preset]` | Create config with smart defaults |
189
+ | `llmstack up [--attach]` | Start all services |
190
+ | `llmstack down [--volumes]` | Stop and clean up |
191
+ | `llmstack status` | Health check all services |
192
+ | `llmstack logs <service>` | Stream service logs |
193
+ | `llmstack doctor` | Diagnose system issues |
194
+
195
+ ## Observability
196
+
197
+ When `observe.metrics: true`, llmstack boots Prometheus + Grafana with a pre-built dashboard:
198
+
199
+ - **Request rate** per endpoint
200
+ - **Latency** p50 / p99 histograms
201
+ - **Token throughput** (input + output)
202
+ - **Error rate** (4xx / 5xx)
203
+ - **Service health** (up/down)
204
+
205
+ Access at `http://localhost:8080` (login: admin / llmstack)
206
+
207
+ ## Plugins
208
+
209
+ Extend llmstack with new backends via pip:
210
+
211
+ ```bash
212
+ pip install llmstack-cli-plugin-chromadb
213
+ # Now: vectors.provider: chromadb in llmstack.yaml
214
+ ```
215
+
216
+ Create your own: implement `ServiceBase`, register via entry_points. See [CONTRIBUTING.md](CONTRIBUTING.md).
217
+
218
+ ## Why llmstack?
219
+
220
+ | | llmstack | Ollama | Harbor | AnythingLLM | LiteLLM |
221
+ |---|---|---|---|---|---|
222
+ | One-command full stack | Yes | No (inference only) | Partial | Partial | No (proxy only) |
223
+ | Auto hardware detection | Yes | No | No | No | No |
224
+ | OpenAI-compatible API | Yes | Yes | Varies | No | Yes |
225
+ | Built-in vector DB | Yes | No | Config needed | Bundled | No |
226
+ | Built-in embeddings | Yes | No | No | Bundled | No |
227
+ | Caching (Redis) | Yes | No | No | No | No |
228
+ | Auth + rate limiting | Yes | No | No | Yes | Yes |
229
+ | Observability dashboard | Yes | No | Partial | No | Partial |
230
+ | Plugin ecosystem | Yes | No | No | No | No |
231
+ | SSE streaming | Yes | Yes | Yes | Yes | Yes |
232
+
233
+ ## Tech stack
234
+
235
+ - **CLI**: [Typer](https://typer.tiangolo.com/) + [Rich](https://rich.readthedocs.io/)
236
+ - **Config**: [Pydantic v2](https://docs.pydantic.dev/)
237
+ - **Gateway**: [FastAPI](https://fastapi.tiangolo.com/)
238
+ - **Containers**: [Docker SDK for Python](https://docker-py.readthedocs.io/)
239
+ - **Metrics**: Prometheus + Grafana
240
+
241
+ ## Requirements
242
+
243
+ - Python 3.11+
244
+ - Docker
245
+
246
+ ## Contributing
247
+
248
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
249
+
250
+ ## License
251
+
252
+ Apache-2.0