closecode 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.
- closecode-0.1.0/LICENSE +21 -0
- closecode-0.1.0/MANIFEST.in +6 -0
- closecode-0.1.0/PKG-INFO +404 -0
- closecode-0.1.0/README.md +364 -0
- closecode-0.1.0/closecode/__init__.py +4 -0
- closecode-0.1.0/closecode/__main__.py +6 -0
- closecode-0.1.0/closecode/agent/__init__.py +79 -0
- closecode-0.1.0/closecode/app.py +691 -0
- closecode-0.1.0/closecode/auth.py +22 -0
- closecode-0.1.0/closecode/config.py +97 -0
- closecode-0.1.0/closecode/llmesh/__init__.py +91 -0
- closecode-0.1.0/closecode/llmesh/client.py +221 -0
- closecode-0.1.0/closecode/llmesh/streaming.py +47 -0
- closecode-0.1.0/closecode/py.typed +0 -0
- closecode-0.1.0/closecode/sessions.py +176 -0
- closecode-0.1.0/closecode/ui/__init__.py +1 -0
- closecode-0.1.0/closecode/ui/screens/__init__.py +1 -0
- closecode-0.1.0/closecode/ui/screens/main.py +125 -0
- closecode-0.1.0/closecode/ui/screens/onboarding.py +101 -0
- closecode-0.1.0/closecode/ui/theme.tcss +374 -0
- closecode-0.1.0/closecode/ui/widgets/__init__.py +1 -0
- closecode-0.1.0/closecode/ui/widgets/chat.py +105 -0
- closecode-0.1.0/closecode/ui/widgets/composer.py +52 -0
- closecode-0.1.0/closecode/ui/widgets/header.py +53 -0
- closecode-0.1.0/closecode/ui/widgets/infopanel.py +101 -0
- closecode-0.1.0/closecode/ui/widgets/statusbar.py +60 -0
- closecode-0.1.0/closecode.egg-info/PKG-INFO +404 -0
- closecode-0.1.0/closecode.egg-info/SOURCES.txt +32 -0
- closecode-0.1.0/closecode.egg-info/dependency_links.txt +1 -0
- closecode-0.1.0/closecode.egg-info/entry_points.txt +2 -0
- closecode-0.1.0/closecode.egg-info/requires.txt +11 -0
- closecode-0.1.0/closecode.egg-info/top_level.txt +1 -0
- closecode-0.1.0/pyproject.toml +66 -0
- closecode-0.1.0/setup.cfg +4 -0
closecode-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dhanu Gupta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
closecode-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: closecode
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Close Code โ a terminal-native AI coding agent powered by the LLMesh gateway.
|
|
5
|
+
Author-email: Dhanu Gupta <dhanugupta.dev@gmail.com>
|
|
6
|
+
Maintainer-email: Dhanu Gupta <dhanugupta.dev@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/Dhanugupta0/LLMesh
|
|
9
|
+
Project-URL: Repository, https://github.com/Dhanugupta0/LLMesh
|
|
10
|
+
Project-URL: Issues, https://github.com/Dhanugupta0/LLMesh/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/Dhanugupta0/LLMesh/releases
|
|
12
|
+
Keywords: ai,llm,agent,cli,tui,terminal,coding-assistant,openai,groq,openrouter,nvidia-nim,llmesh
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: textual>=0.80.0
|
|
30
|
+
Requires-Dist: rich>=13.0.0
|
|
31
|
+
Requires-Dist: click>=8.0.0
|
|
32
|
+
Requires-Dist: httpx>=0.25.0
|
|
33
|
+
Requires-Dist: pydantic>=2.0.0
|
|
34
|
+
Requires-Dist: tiktoken>=0.7.0
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: textual-dev>=1.5.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
<div align="center">
|
|
42
|
+
|
|
43
|
+
# โฌก Close Code ร LLMesh
|
|
44
|
+
|
|
45
|
+
**A terminal-native AI coding agent, and the universal LLM gateway behind it.**
|
|
46
|
+
|
|
47
|
+
[](https://pypi.org/project/closecode/)
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
[](https://opensource.org/licenses/MIT)
|
|
50
|
+
[](https://render.com/deploy)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
pip install closecode
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
This repository holds two halves of one system:
|
|
61
|
+
|
|
62
|
+
| | What it is | How you get it |
|
|
63
|
+
| :-- | :-- | :-- |
|
|
64
|
+
| **โฌก Close Code** | A Textual TUI that lives in your terminal. Streaming chat, local session history, model switching. | `pip install closecode` |
|
|
65
|
+
| **๐ LLMesh** | A stateless FastAPI gateway that fans requests out to OpenAI, Groq, NVIDIA NIM and OpenRouter behind one OpenAI-compatible API. | Deploy to [Render](#-deploying-llmesh-to-render), Docker, or run locally |
|
|
66
|
+
|
|
67
|
+
Close Code never talks to a provider directly. It holds one LLMesh key, and LLMesh holds the upstream keys โ so provider credentials stay on the server and your prompts stay off disk anywhere but your own machine.
|
|
68
|
+
|
|
69
|
+
> ๐ **Shipping it?** [`DEPLOYMENT.md`](DEPLOYMENT.md) is the step-by-step guide for deploying the gateway to Render + Neon and publishing the client to PyPI, with a pre-flight checklist and troubleshooting table.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## โจ Features
|
|
74
|
+
|
|
75
|
+
### โฌก Close Code (terminal client)
|
|
76
|
+
|
|
77
|
+
- **4:1 chat layout** โ a Textual interface with message bubbles, a welcome screen, and an info sidebar.
|
|
78
|
+
- **100% local sessions** โ conversations are written to `~/.closecode/sessions/` as JSON. History never leaves your machine.
|
|
79
|
+
- **Model status probing** โ validates keys in the background and tags each model (`โ Key Valid`, `โ Rate Limited`, `โ API Key Invalid`).
|
|
80
|
+
- **Slash commands** โ `/models`, `/session N`, `/rename`, `/new`, and more.
|
|
81
|
+
- **Task extraction** โ parses your prompts into a live checklist in the sidebar.
|
|
82
|
+
|
|
83
|
+
### ๐ LLMesh (gateway)
|
|
84
|
+
|
|
85
|
+
- **One API, many providers** โ OpenAI-compatible `/v1/chat/completions`, `/v1/completions` and `/v1/embeddings` routed to whichever upstream serves the requested model.
|
|
86
|
+
- **Stateless by design** โ prompts and responses are proxied, never persisted.
|
|
87
|
+
- **Postgres or SQLite** โ point it at Neon (or any managed Postgres) with one environment variable; falls back to a local SQLite file with zero configuration.
|
|
88
|
+
- **Usage accounting** โ per-key token quotas, batched writes, circuit breakers on failing upstreams.
|
|
89
|
+
- **Admin dashboard** โ manage upstream keys, models and quotas from the web UI.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## ๐๏ธ Architecture
|
|
94
|
+
|
|
95
|
+
Close Code owns the UI, context window and session storage. LLMesh owns routing, auth and accounting.
|
|
96
|
+
|
|
97
|
+
```mermaid
|
|
98
|
+
graph TD
|
|
99
|
+
subgraph Local["Your machine"]
|
|
100
|
+
O["โฌก Close Code TUI"]
|
|
101
|
+
S[("~/.closecode/sessions/<br/>local JSON")]
|
|
102
|
+
O <-->|reads / writes| S
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
subgraph Gateway["LLMesh gateway"]
|
|
106
|
+
L["FastAPI server<br/>:8087 or Render"]
|
|
107
|
+
DB[("Neon Postgres<br/>keys ยท models ยท usage")]
|
|
108
|
+
L <-->|config + quotas| DB
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
subgraph Up["Upstream providers"]
|
|
112
|
+
N["NVIDIA NIM"]
|
|
113
|
+
G["Groq"]
|
|
114
|
+
OR["OpenRouter"]
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
O -->|"POST /v1/chat/completions<br/>Authorization: Bearer <LLMesh key>"| L
|
|
118
|
+
L -->|"+ upstream key"| N
|
|
119
|
+
L -->|"+ upstream key"| G
|
|
120
|
+
L -->|"+ upstream key"| OR
|
|
121
|
+
|
|
122
|
+
N -->|SSE| L
|
|
123
|
+
G -->|SSE| L
|
|
124
|
+
OR -->|SSE| L
|
|
125
|
+
L -->|SSE passthrough| O
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Request lifecycle**
|
|
129
|
+
|
|
130
|
+
1. You type a prompt into Close Code.
|
|
131
|
+
2. Close Code reads the local session file, assembles the message history, and estimates token usage.
|
|
132
|
+
3. It POSTs an OpenAI-compatible payload to LLMesh.
|
|
133
|
+
4. LLMesh looks up the model, checks your key's quota, attaches the upstream provider key, and forwards.
|
|
134
|
+
5. Tokens stream back over SSE, straight through LLMesh to your terminal.
|
|
135
|
+
6. On completion, Close Code saves the new state to `~/.closecode/sessions/`, and LLMesh records token usage against your key.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## ๐ Quick start
|
|
140
|
+
|
|
141
|
+
### 1. Install the client
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pip install closecode
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> Prefer an isolated install? `pipx install closecode` works too.
|
|
148
|
+
|
|
149
|
+
### 2. Point it at a gateway
|
|
150
|
+
|
|
151
|
+
You need a running LLMesh instance and an API key from its dashboard. Either [deploy your own](#-deploying-llmesh-to-render) or [run one locally](#running-llmesh-locally).
|
|
152
|
+
|
|
153
|
+
### 3. Launch
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
closecode
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
On first run you get an onboarding screen:
|
|
160
|
+
|
|
161
|
+
1. Enter your LLMesh endpoint โ `http://localhost:8087` locally, or `https://your-service.onrender.com` if deployed.
|
|
162
|
+
2. Paste your LLMesh API key.
|
|
163
|
+
3. Hit **Connect**.
|
|
164
|
+
|
|
165
|
+
Close Code fetches the model list and drops you into the chat view. Settings are remembered in `~/.closecode/config.json`.
|
|
166
|
+
|
|
167
|
+
> Upgrading from the old `ovo` package? Your `~/.ovo` directory is migrated to `~/.closecode` automatically on first launch, sessions intact. You can `pip uninstall ovo` afterwards.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## ๐ Deploying LLMesh to Render
|
|
172
|
+
|
|
173
|
+
The repo ships a [`render.yaml`](render.yaml) blueprint, so deployment is a form and two secrets. The condensed version is below; [`DEPLOYMENT.md`](DEPLOYMENT.md) has the fully expanded walkthrough.
|
|
174
|
+
|
|
175
|
+
### Step 1 โ Create a Neon Postgres database
|
|
176
|
+
|
|
177
|
+
1. Sign up at [neon.tech](https://neon.tech) and create a project.
|
|
178
|
+
2. Copy the connection string from the dashboard. It looks like:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
postgresql://neondb_owner:PASSWORD@ep-xxx-pooler.us-east-2.aws.neon.tech/neondb?sslmode=require
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Nothing else to do โ LLMesh creates its own tables on first boot.
|
|
185
|
+
|
|
186
|
+
### Step 2 โ Deploy the blueprint
|
|
187
|
+
|
|
188
|
+
1. Push this repo to GitHub.
|
|
189
|
+
2. In Render: **New โ Blueprint**, and select the repo. Render reads `render.yaml`.
|
|
190
|
+
3. Fill in the variables Render marks as required:
|
|
191
|
+
|
|
192
|
+
| Variable | Value |
|
|
193
|
+
| :-- | :-- |
|
|
194
|
+
| `DATABASE_URL` | Your Neon connection string from step 1 |
|
|
195
|
+
| `ADMIN_PASSWORD_HASH` | bcrypt hash of your admin password (below) |
|
|
196
|
+
| `OPENROUTER_API_KEY` | From [openrouter.ai/keys](https://openrouter.ai/keys) |
|
|
197
|
+
| `GROQ_API_KEY` | From [console.groq.com/keys](https://console.groq.com/keys) |
|
|
198
|
+
| `NVIDIA_NIM_API_KEY` | From [build.nvidia.com](https://build.nvidia.com/) |
|
|
199
|
+
|
|
200
|
+
Generate the admin hash locally:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python -c "import bcrypt; print(bcrypt.hashpw(b'your_password', bcrypt.gensalt()).decode())"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
4. Deploy. Render builds, runs the health check against `/healthz`, and gives you a URL.
|
|
207
|
+
|
|
208
|
+
`SESSION_SECRET_KEY` is generated by Render automatically. `DOMAIN` and `API_BASE_URL` are derived from Render's injected `RENDER_EXTERNAL_URL`, so CORS works on the generated hostname without configuration.
|
|
209
|
+
|
|
210
|
+
### Step 3 โ Seed models and mint a key
|
|
211
|
+
|
|
212
|
+
1. Open `https://your-service.onrender.com/dashboard` and log in as admin.
|
|
213
|
+
2. Add your upstream servers and models, or run the seed script against the same database:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
DATABASE_URL="postgresql://..." python -m scripts.seed_servers
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
3. Register a user on the landing page to mint an LLMesh API key โ that's what you paste into Close Code.
|
|
220
|
+
|
|
221
|
+
> **Free-plan note.** Render's free web services sleep after inactivity, so the first request after an idle period takes a few seconds to wake. Neon's free compute suspends too; `pool_pre_ping` and a 300s connection recycle are already configured to handle both cleanly.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ๐ฅ๏ธ Running LLMesh locally
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
git clone https://github.com/Dhanugupta0/LLMesh.git
|
|
229
|
+
cd LLMesh
|
|
230
|
+
|
|
231
|
+
python -m venv .venv && source .venv/bin/activate
|
|
232
|
+
pip install -r requirements.txt
|
|
233
|
+
|
|
234
|
+
cp .env.example .env # then fill in your provider keys
|
|
235
|
+
export DEV=1
|
|
236
|
+
./start.sh
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The gateway comes up on `http://localhost:8087`. With no `DATABASE_URL` set it uses a local SQLite file at `app/database/myapi.db` โ no Postgres needed for development.
|
|
240
|
+
|
|
241
|
+
### With Docker
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
cp .env.example .env # fill in your keys
|
|
245
|
+
docker compose up -d
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Add `--profile with-nginx` to bring up the bundled Nginx reverse proxy.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## โจ๏ธ Command reference
|
|
253
|
+
|
|
254
|
+
Slash commands inside Close Code:
|
|
255
|
+
|
|
256
|
+
| Command | Description |
|
|
257
|
+
| :--- | :--- |
|
|
258
|
+
| `/help` | Display the command reference |
|
|
259
|
+
| `/models` | List models with provider and live status |
|
|
260
|
+
| `/model <N>` | Switch to a model by index |
|
|
261
|
+
| `/sessions` | List locally saved conversations |
|
|
262
|
+
| `/session <N>` | Restore a previous conversation |
|
|
263
|
+
| `/save` | Force-save the current session |
|
|
264
|
+
| `/rename <T>` | Rename the current session |
|
|
265
|
+
| `/new` | Start a fresh session |
|
|
266
|
+
| `/clear` | Clear the display, keep the session |
|
|
267
|
+
| `/exit` | Exit Close Code |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## ๐ ๏ธ Configuration
|
|
272
|
+
|
|
273
|
+
### Close Code (client)
|
|
274
|
+
|
|
275
|
+
Config lives at `~/.closecode/config.json`, written by the onboarding screen. Environment variables override it:
|
|
276
|
+
|
|
277
|
+
| Variable | Description |
|
|
278
|
+
| :-- | :-- |
|
|
279
|
+
| `CLOSECODE_API_URL` | LLMesh endpoint (also accepts `LLMESH_API_URL`) |
|
|
280
|
+
| `CLOSECODE_API_KEY` | LLMesh API key (also accepts `LLMESH_API_KEY`) |
|
|
281
|
+
|
|
282
|
+
| Path | Contents |
|
|
283
|
+
| :-- | :-- |
|
|
284
|
+
| `~/.closecode/config.json` | Endpoint, key, model and UI preferences |
|
|
285
|
+
| `~/.closecode/sessions/` | Conversation history, one JSON file per session |
|
|
286
|
+
| `~/.closecode/logs/` | Client logs |
|
|
287
|
+
|
|
288
|
+
### LLMesh (gateway)
|
|
289
|
+
|
|
290
|
+
Full list with comments in [`.env.example`](.env.example). The ones that matter:
|
|
291
|
+
|
|
292
|
+
| Variable | Default | Description |
|
|
293
|
+
| :-- | :-- | :-- |
|
|
294
|
+
| `DATABASE_URL` | *(unset)* | Postgres connection string. Unset โ SQLite. |
|
|
295
|
+
| `PGHOST` / `PGUSER` / `PGPASSWORD` / `PGDATABASE` | *(unset)* | Neon's discrete variables โ used when `DATABASE_URL` is unset |
|
|
296
|
+
| `DATABASE_PATH` | `app/database/myapi.db` | SQLite file location |
|
|
297
|
+
| `SESSION_SECRET_KEY` | โ | Signing key for admin sessions. Required in production. |
|
|
298
|
+
| `ADMIN_USERNAME` | `admin` | Dashboard login |
|
|
299
|
+
| `ADMIN_PASSWORD_HASH` | โ | bcrypt hash of the admin password |
|
|
300
|
+
| `OPENROUTER_API_KEY` | โ | Upstream provider key |
|
|
301
|
+
| `GROQ_API_KEY` | โ | Upstream provider key |
|
|
302
|
+
| `NVIDIA_NIM_API_KEY` | โ | Upstream provider key |
|
|
303
|
+
| `DEFAULT_LIMIT` | `1000000` | Default per-key token quota |
|
|
304
|
+
| `PORT` | `8087` | Bind port (Render sets this automatically) |
|
|
305
|
+
| `WEB_CONCURRENCY` | `4` | Gunicorn worker count |
|
|
306
|
+
|
|
307
|
+
**Postgres notes.** `postgres://` and `postgresql://` URLs are both accepted and rewritten onto `asyncpg`. libpq-only parameters (`sslmode`, `channel_binding`, ...) are stripped and translated into a real SSL context, so you can paste a Neon string verbatim. Prepared-statement caching is disabled so pooled endpoints (Neon's `-pooler` host, PgBouncer, Supavisor) work without extra configuration.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## ๐ก API
|
|
312
|
+
|
|
313
|
+
LLMesh speaks the OpenAI wire format, so any OpenAI-compatible client works โ not just Close Code.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
curl https://your-service.onrender.com/v1/chat/completions \
|
|
317
|
+
-H "Authorization: Bearer $LLMESH_API_KEY" \
|
|
318
|
+
-H "Content-Type: application/json" \
|
|
319
|
+
-d '{
|
|
320
|
+
"model": "llama-3.3-70b-versatile",
|
|
321
|
+
"messages": [{"role": "user", "content": "Hello"}],
|
|
322
|
+
"stream": true
|
|
323
|
+
}'
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
| Endpoint | Purpose |
|
|
327
|
+
| :-- | :-- |
|
|
328
|
+
| `GET /healthz` | Liveness probe; 503 if the database is unreachable |
|
|
329
|
+
| `GET /v1/models` | List available models |
|
|
330
|
+
| `POST /v1/chat/completions` | Chat, streaming or buffered |
|
|
331
|
+
| `POST /v1/completions` | Legacy completions |
|
|
332
|
+
| `POST /v1/embeddings` | Embeddings |
|
|
333
|
+
| `GET /dashboard` | Admin UI |
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## ๐ฆ Releasing the client to PyPI
|
|
338
|
+
|
|
339
|
+
Publishing is automated by [`.github/workflows/publish.yml`](.github/workflows/publish.yml) using PyPI Trusted Publishing, so no API token is stored anywhere. Full walkthrough in [`DEPLOYMENT.md`](DEPLOYMENT.md).
|
|
340
|
+
|
|
341
|
+
**One-time setup** โ on [pypi.org/manage/account/publishing](https://pypi.org/manage/account/publishing/), add a pending publisher:
|
|
342
|
+
|
|
343
|
+
| Field | Value |
|
|
344
|
+
| :-- | :-- |
|
|
345
|
+
| PyPI project | `closecode` |
|
|
346
|
+
| Owner | `Dhanugupta0` |
|
|
347
|
+
| Repository | `LLMesh` |
|
|
348
|
+
| Workflow | `publish.yml` |
|
|
349
|
+
| Environment | `pypi` |
|
|
350
|
+
|
|
351
|
+
**Each release:**
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# bump __version__ in closecode/__init__.py (the single source of truth โ
|
|
355
|
+
# pyproject.toml reads it from there), commit, then:
|
|
356
|
+
git tag v0.1.0
|
|
357
|
+
git push origin v0.1.0
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The workflow checks the tag matches the project version, builds an sdist and wheel, verifies `theme.tcss` is bundled, and uploads. To build locally:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
pip install build twine
|
|
364
|
+
python -m build
|
|
365
|
+
twine check dist/*
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## ๐๏ธ Repository layout
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
.
|
|
374
|
+
โโโ closecode/ # โฌก the pip-installable terminal client
|
|
375
|
+
โ โโโ app.py # Textual App, slash commands, streaming loop
|
|
376
|
+
โ โโโ config.py # ~/.closecode config + legacy ~/.ovo migration
|
|
377
|
+
โ โโโ sessions.py # local JSON session persistence
|
|
378
|
+
โ โโโ llmesh/ # HTTP client + SSE parsing
|
|
379
|
+
โ โโโ ui/ # screens, widgets, theme.tcss
|
|
380
|
+
โ
|
|
381
|
+
โโโ app/ # ๐ the LLMesh FastAPI gateway
|
|
382
|
+
โ โโโ api/routes.py # OpenAI-compatible + dashboard routes
|
|
383
|
+
โ โโโ core/ # lifespan, middleware, background refresh
|
|
384
|
+
โ โโโ database/ # SQLAlchemy models, Postgres/SQLite engine
|
|
385
|
+
โ โโโ services/ # routing, usage queue, provider clients
|
|
386
|
+
โ โโโ config/settings.py# environment configuration
|
|
387
|
+
โ
|
|
388
|
+
โโโ static/ ยท templates/ # landing page + dashboard
|
|
389
|
+
โโโ scripts/ # database init and model seeding
|
|
390
|
+
โโโ DEPLOYMENT.md # Render + PyPI step-by-step guide
|
|
391
|
+
โโโ render.yaml # Render blueprint
|
|
392
|
+
โโโ Dockerfile ยท docker-compose.yml
|
|
393
|
+
โโโ pyproject.toml # closecode packaging
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## ๐ License
|
|
399
|
+
|
|
400
|
+
MIT โ see [LICENSE](LICENSE).
|
|
401
|
+
|
|
402
|
+
<div align="center">
|
|
403
|
+
<sub>Built with ๐ค ยท <a href="https://pypi.org/project/closecode/">closecode on PyPI</a></sub>
|
|
404
|
+
</div>
|