codefreedom 0.0.2__tar.gz → 0.0.4__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.
- codefreedom-0.0.4/NOTICE +52 -0
- codefreedom-0.0.4/PKG-INFO +279 -0
- codefreedom-0.0.4/README.md +237 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/pyproject.toml +8 -7
- codefreedom-0.0.4/src/codefreedom/__init__.py +8 -0
- codefreedom-0.0.4/src/codefreedom/cli/chrome.py +366 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/cli/claude.py +13 -5
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/cli/main.py +140 -29
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/cli/proxy.py +8 -6
- codefreedom-0.0.4/src/codefreedom/env_loader.py +126 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/.env.example +13 -10
- codefreedom-0.0.4/src/codefreedom/examples/profiles/chrome.schema.json +55 -0
- codefreedom-0.0.2/src/codefreedom/examples/profiles/claude-code-profiles.json → codefreedom-0.0.4/src/codefreedom/examples/profiles/claude-code.json +1 -1
- codefreedom-0.0.4/src/codefreedom/examples/profiles/tools-chrome.json +22 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/launcher.py +49 -30
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/profiles.py +24 -5
- codefreedom-0.0.4/src/codefreedom.egg-info/PKG-INFO +279 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom.egg-info/SOURCES.txt +6 -3
- codefreedom-0.0.4/src/codefreedom.egg-info/requires.txt +19 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/tests/test_env_loader.py +38 -15
- {codefreedom-0.0.2 → codefreedom-0.0.4}/tests/test_init.py +36 -5
- codefreedom-0.0.2/PKG-INFO +0 -273
- codefreedom-0.0.2/README.md +0 -235
- codefreedom-0.0.2/src/codefreedom/__init__.py +0 -3
- codefreedom-0.0.2/src/codefreedom/cli/litellm_cli.py +0 -352
- codefreedom-0.0.2/src/codefreedom/env_loader.py +0 -101
- codefreedom-0.0.2/src/codefreedom.egg-info/PKG-INFO +0 -273
- codefreedom-0.0.2/src/codefreedom.egg-info/requires.txt +0 -15
- {codefreedom-0.0.2 → codefreedom-0.0.4}/LICENSE +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/setup.cfg +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/__main__.py +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/cli/__init__.py +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/.env.secrets.example +0 -0
- /codefreedom-0.0.2/src/codefreedom/examples/profiles/claude-code-profiles.schema.json → /codefreedom-0.0.4/src/codefreedom/examples/profiles/claude-code.schema.json +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/config.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/docker-compose.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/anthropic-compatible.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/azure-foundry.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/deepseek.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/local.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/nvidia.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/openai-compatible.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom/examples/proxy/providers/opencode-zen.yaml +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom.egg-info/dependency_links.txt +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom.egg-info/entry_points.txt +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/src/codefreedom.egg-info/top_level.txt +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/tests/test_profiles.py +0 -0
- {codefreedom-0.0.2 → codefreedom-0.0.4}/tests/test_proxy.py +0 -0
codefreedom-0.0.4/NOTICE
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
CodeFreedom — Claude Code launcher and LiteLLM proxy — AI-augmented coding, anywhere.
|
|
2
|
+
|
|
3
|
+
Copyright 2025-2026 Nilay Parikh
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
================================================================================
|
|
18
|
+
This product includes or is dependent on the following third-party software:
|
|
19
|
+
================================================================================
|
|
20
|
+
|
|
21
|
+
LiteLLM — MIT License
|
|
22
|
+
https://github.com/BerriAI/litellm
|
|
23
|
+
Copyright (c) 2023-2025 BerriAI
|
|
24
|
+
|
|
25
|
+
PyYAML — MIT License
|
|
26
|
+
https://github.com/yaml/pyyaml
|
|
27
|
+
Copyright (c) 2017-2025 Ingy döt Net
|
|
28
|
+
|
|
29
|
+
MkDocs Material — MIT License
|
|
30
|
+
https://github.com/squidfunk/mkdocs-material
|
|
31
|
+
Copyright (c) 2016-2025 Martin Donath
|
|
32
|
+
|
|
33
|
+
================================================================================
|
|
34
|
+
Trademarks
|
|
35
|
+
================================================================================
|
|
36
|
+
|
|
37
|
+
The following trademarks are the property of their respective owners.
|
|
38
|
+
CodeFreedom is not affiliated with, endorsed by, or sponsored by any
|
|
39
|
+
trademark holder listed below. Use of a trademark does not imply any
|
|
40
|
+
association with or authorization by the trademark holder.
|
|
41
|
+
|
|
42
|
+
"Claude" and "Claude Code" — Anthropic
|
|
43
|
+
"Visual Studio Code" / "VS Code" — Microsoft Corporation
|
|
44
|
+
"Cursor" — Anysphere, Inc.
|
|
45
|
+
"Codex" — OpenAI, LLC
|
|
46
|
+
"LiteLLM" — BerriAI
|
|
47
|
+
"Docker" — Docker, Inc.
|
|
48
|
+
"Python" — Python Software Foundation
|
|
49
|
+
"PostgreSQL" — PostgreSQL Community Association
|
|
50
|
+
"GitHub" — GitHub, Inc. (Microsoft Corporation)
|
|
51
|
+
"Node.js" — OpenJS Foundation
|
|
52
|
+
"PyPI" — Python Software Foundation
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codefreedom
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Single wrapper for all code agents — simple LLM routing, sandboxing, profile management, and isolation. All config in ~/.codefreedom.
|
|
5
|
+
Author-email: Nilay Parikh <nilay.parikh@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/nilayparikh/codefreedom
|
|
8
|
+
Project-URL: Repository, https://github.com/nilayparikh/codefreedom
|
|
9
|
+
Project-URL: Documentation, https://nilayparikh.github.io/codefreedom/
|
|
10
|
+
Project-URL: Quick Start, https://nilayparikh.github.io/codefreedom/quickstart/
|
|
11
|
+
Project-URL: Proxy Setup, https://nilayparikh.github.io/codefreedom/proxy/
|
|
12
|
+
Project-URL: Claude Code, https://nilayparikh.github.io/codefreedom/claude-code/
|
|
13
|
+
Keywords: claude-code,litellm,ai,llm,local-inference
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
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
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: PyYAML>=6.0
|
|
27
|
+
Requires-Dist: types-PyYAML
|
|
28
|
+
Provides-Extra: litellm
|
|
29
|
+
Requires-Dist: litellm[proxy]>=1.50; extra == "litellm"
|
|
30
|
+
Requires-Dist: prometheus-client>=0.25.0; extra == "litellm"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
36
|
+
Provides-Extra: docs
|
|
37
|
+
Requires-Dist: mkdocs-material[imaging]>=9.7.6; extra == "docs"
|
|
38
|
+
Requires-Dist: mkdocs-mermaid2-plugin>=1.2; extra == "docs"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: codefreedom[dev,docs,litellm]; extra == "all"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# CodeFreedom
|
|
44
|
+
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
[](pyproject.toml)
|
|
47
|
+
[](https://github.com/nilayparikh/codefreedom/actions/workflows/integration-test.yml)
|
|
48
|
+
[](https://pypi.org/project/codefreedom/)
|
|
49
|
+
|
|
50
|
+
**Unified interface for all code agents. Simple LLM routing. Sandboxing just a click away.**
|
|
51
|
+
|
|
52
|
+
CodeFreedom solves three problems:
|
|
53
|
+
|
|
54
|
+
1. **Model lock-in** — you want to switch models across providers without reconfiguring your code agent each time.
|
|
55
|
+
2. **Environment chaos** — you want isolated, reproducible environments per project with GPU support.
|
|
56
|
+
3. **Config sprawl** — you want profiles, proxy routing, and sandbox settings managed from one place (`~/.codefreedom`).
|
|
57
|
+
|
|
58
|
+
It does this by orchestrating code agents through their **publicly supported interfaces** (environment variables, CLI flags, API endpoints). No patching, no reverse-engineering.
|
|
59
|
+
|
|
60
|
+
### Supported Agents
|
|
61
|
+
|
|
62
|
+
| Agent | Status | Subcommand | Notes |
|
|
63
|
+
| ----------- | ---------- | -------------------- | ------------------------------------------- |
|
|
64
|
+
| Claude Code | ✅ Ready | `codefreedom claude` | Local + sandbox modes, full profile support |
|
|
65
|
+
| Cursor | 🚧 Roadmap | — | Coming — same profile + proxy pattern |
|
|
66
|
+
| Codex | 🚧 Roadmap | — | Coming — same profile + proxy pattern |
|
|
67
|
+
|
|
68
|
+
The architecture is agent-agnostic: each agent gets a subcommand, profile, and routes through the same proxy. Claude Code is the first implementation.
|
|
69
|
+
|
|
70
|
+
## Principles
|
|
71
|
+
|
|
72
|
+
CodeFreedom integrates with code agents through their **publicly supported features only** — environment variables, CLI flags, config files, and API endpoints. No reverse-engineering, no patching, no vendor lock-in.
|
|
73
|
+
|
|
74
|
+
- **Just configuration.** Profiles are environment variables. Proxy routing is standard LiteLLM config.
|
|
75
|
+
- **Opt-in providers.** Set an API key to enable a provider. Leave it empty to disable. Nothing phones home by default.
|
|
76
|
+
- **All config in one place.** `~/.codefreedom` is the single source of truth for profiles, proxy settings, and sandbox configuration.
|
|
77
|
+
- **Trademarks belong to their owners.** See [NOTICE](NOTICE) for attributions.
|
|
78
|
+
|
|
79
|
+
## Disclaimer
|
|
80
|
+
|
|
81
|
+
**CodeFreedom is provided "as is" without warranty of any kind.** Use at your own risk.
|
|
82
|
+
|
|
83
|
+
- **Supported methods only.** CodeFreedom integrates with code agents exclusively through their publicly documented interfaces — environment variables, CLI flags, config files, and API endpoints. It does **not** reverse-engineer, patch, modify, or tamper with any code agent. No binary patching, no MITM, no internal API abuse.
|
|
84
|
+
- **Third-party responsibility.** CodeFreedom orchestrates upstream tools (LiteLLM, Claude Code, Docker, etc.) but does not control their behavior. You are responsible for evaluating the suitability, security, and terms of service of every upstream tool and provider you configure.
|
|
85
|
+
- **Security.** The proxy handles API keys and tokens. Sandbox mode mounts host directories (`~/.ssh`, `~/.gitconfig`) into containers. Configure these according to your organization's security policies.
|
|
86
|
+
- **No warranty.** This software is provided under the Apache 2.0 License without warranty or guarantee of any kind. The author is not liable for any damages arising from its use.
|
|
87
|
+
- **Trademarks.** CodeFreedom is not affiliated with, endorsed by, or sponsored by Anthropic, Microsoft, Anysphere, OpenAI, BerriAI, Docker, or any other third-party mentioned in this project. All trademarks belong to their respective owners.
|
|
88
|
+
|
|
89
|
+
## Features
|
|
90
|
+
|
|
91
|
+
| Feature | codefreedom |
|
|
92
|
+
| ------------------- | ------------------------------------------------- |
|
|
93
|
+
| LLM proxy | ✅ Stateless model routing (Docker or native) |
|
|
94
|
+
| Code agent launcher | ✅ `codefreedom claude` CLI |
|
|
95
|
+
| Sandboxing | ✅ Pre-configured containers (CUDA, ROCm, Ubuntu) |
|
|
96
|
+
| Profile management | ✅ Model switching & isolation |
|
|
97
|
+
| PostgreSQL | ✅ Optional — Admin UI, spend tracking |
|
|
98
|
+
| pip installable | ✅ `pip install codefreedom` |
|
|
99
|
+
|
|
100
|
+
## Quick Start
|
|
101
|
+
|
|
102
|
+
### Installation
|
|
103
|
+
|
|
104
|
+
**From PyPI (recommended):**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install codefreedom
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**From source:**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git clone https://github.com/nilayparikh/codefreedom.git
|
|
114
|
+
cd codefreedom
|
|
115
|
+
pip install -e .
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Now you can run `codefreedom` or `cf` from anywhere:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
codefreedom --help
|
|
122
|
+
cf --help
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Initialize
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Creates ~/.codefreedom/ with default profiles and proxy configs
|
|
129
|
+
codefreedom --init
|
|
130
|
+
|
|
131
|
+
# Overwrite existing files
|
|
132
|
+
codefreedom --init --force
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This creates:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
~/.codefreedom/
|
|
139
|
+
├── profiles/
|
|
140
|
+
│ ├── claude-code.json # Profile definitions
|
|
141
|
+
│ └── claude-code-profiles.schema.json # JSON Schema for validation
|
|
142
|
+
└── proxy/
|
|
143
|
+
├── docker-compose.yaml # Docker Compose for LiteLLM
|
|
144
|
+
└── config/
|
|
145
|
+
├── config.yaml # LiteLLM proxy configuration
|
|
146
|
+
└── providers/ # Provider-specific configs
|
|
147
|
+
├── deepseek.yaml
|
|
148
|
+
├── azure-foundry.yaml
|
|
149
|
+
├── nvidia.yaml
|
|
150
|
+
├── local.yaml
|
|
151
|
+
├── openai-compatible.yaml
|
|
152
|
+
├── anthropic-compatible.yaml
|
|
153
|
+
└── opencode-zen.yaml
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 1. Start the Proxy
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Start via Docker Compose
|
|
160
|
+
codefreedom proxy --up --docker
|
|
161
|
+
|
|
162
|
+
# Or start natively (requires: pip install codefreedom[litellm])
|
|
163
|
+
codefreedom proxy --up
|
|
164
|
+
|
|
165
|
+
# Validate config
|
|
166
|
+
codefreedom proxy --validate
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The proxy starts stateless — no database, no Prisma, just model routing.
|
|
170
|
+
See [Proxy → Database](docs/proxy.md#database-backends) for PostgreSQL setup.
|
|
171
|
+
|
|
172
|
+
### 2. Launch a Code Agent
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Default: native mode with Flash model
|
|
176
|
+
codefreedom claude
|
|
177
|
+
|
|
178
|
+
# Pick a different built-in profile (bare = minimal, no model aliases)
|
|
179
|
+
codefreedom claude --profile bare
|
|
180
|
+
|
|
181
|
+
# Or use a custom profile you created in claude-code.json
|
|
182
|
+
codefreedom claude --profile my-profile
|
|
183
|
+
|
|
184
|
+
# Run in sandboxed Docker container
|
|
185
|
+
codefreedom claude --sandbox
|
|
186
|
+
|
|
187
|
+
# Use native Anthropic /login auth (bypass proxy)
|
|
188
|
+
codefreedom claude --native-models
|
|
189
|
+
|
|
190
|
+
# List available profiles
|
|
191
|
+
codefreedom claude --list-profiles
|
|
192
|
+
|
|
193
|
+
# Manage the container
|
|
194
|
+
codefreedom claude --status
|
|
195
|
+
codefreedom claude --stop
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Short aliases: `cf cc` is equivalent to `codefreedom claude`.
|
|
199
|
+
|
|
200
|
+
### 3. Pass Arguments Through
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
codefreedom claude -p "Explain this codebase"
|
|
204
|
+
codefreedom claude --resume "<session-id>"
|
|
205
|
+
codefreedom claude --profile my-profile --worktree feature-branch
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Sandbox Containers
|
|
209
|
+
|
|
210
|
+
Three pre-configured images (CUDA, ROCm, Ubuntu) on `ghcr.io/nilayparikh/codefreedom`.
|
|
211
|
+
See [Sandbox Mode → Available Images](docs/claude-code/sandbox.md#available-images) for the full tag reference and Dockerfile examples.
|
|
212
|
+
|
|
213
|
+
## CLI Reference
|
|
214
|
+
|
|
215
|
+
See [Architecture → CLI Design](docs/architecture.md#cli-design) for the full command tree.
|
|
216
|
+
|
|
217
|
+
## Profiles
|
|
218
|
+
|
|
219
|
+
Profiles control which model a code agent uses and which API endpoint it routes through. All profiles live in `~/.codefreedom/profiles/claude-code.json`.
|
|
220
|
+
|
|
221
|
+
| Profile | Model | Description |
|
|
222
|
+
| --------- | ------------------- | ------------------------------------------------ |
|
|
223
|
+
| `default` | `CodeFreedom/Flash` | Base profile — routes through proxy |
|
|
224
|
+
| `bare` | _(default)_ | Minimal — no model aliases, routes through proxy |
|
|
225
|
+
|
|
226
|
+
Create custom profiles by editing `~/.codefreedom/profiles/claude-code.json`:
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"profiles": {
|
|
231
|
+
"my-profile": {
|
|
232
|
+
"description": "Custom profile — override model and endpoint",
|
|
233
|
+
"env": {
|
|
234
|
+
"CLAUDE_MODEL": "CodeFreedom/Ultra",
|
|
235
|
+
"ANTHROPIC_BASE_URL": "http://localhost:4000"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
A JSON Schema is provided at `~/.codefreedom/profiles/claude-code-profiles.schema.json`.
|
|
243
|
+
|
|
244
|
+
## Database (Optional)
|
|
245
|
+
|
|
246
|
+
The proxy runs **stateless by default** — no database, no Prisma, no persistence.
|
|
247
|
+
Model routing works out of the box.
|
|
248
|
+
|
|
249
|
+
| Backend | Use Case |
|
|
250
|
+
| ------------------ | -------------------------------------------------- |
|
|
251
|
+
| **None** (default) | Dev/CI — stateless model routing, zero persistence |
|
|
252
|
+
| **PostgreSQL** | Admin UI, spend tracking, key management, teams |
|
|
253
|
+
|
|
254
|
+
See [Proxy → Database](docs/proxy.md#database-backends) for setup.
|
|
255
|
+
|
|
256
|
+
## Documentation
|
|
257
|
+
|
|
258
|
+
- [Getting Started](docs/index.md) — Install, init, launch
|
|
259
|
+
- [Environment](docs/environment.md) — `.env` chain, variable interpolation, workspace overrides
|
|
260
|
+
- [Code Agents](docs/claude-code.md) — Profiles, sandbox mode, local mode
|
|
261
|
+
- [Proxy](docs/proxy.md) — Provider setup, database, configuration
|
|
262
|
+
- [Architecture](docs/architecture.md) — System design, data flow (Mermaid diagrams)
|
|
263
|
+
- [VS Code](docs/vscode.md) — Proxy integration with VS Code extensions
|
|
264
|
+
- [Troubleshooting](docs/troubleshooting.md) — Common issues and diagnostics
|
|
265
|
+
- [License & Contributions](docs/license-contributions.md) — License, contributing guide
|
|
266
|
+
|
|
267
|
+
## Requirements
|
|
268
|
+
|
|
269
|
+
- Python 3.10+
|
|
270
|
+
- Docker — optional, for sandbox mode and Docker Compose proxy
|
|
271
|
+
- Node.js + `@anthropic-ai/claude-code` (for local mode only)
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
_Claude Code is a trademark of Anthropic. VS Code is a trademark of Microsoft. Cursor is a trademark of Anysphere. Codex is a trademark of OpenAI. Other trademarks are property of their respective owners. See [NOTICE](NOTICE)._
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# CodeFreedom
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](pyproject.toml)
|
|
5
|
+
[](https://github.com/nilayparikh/codefreedom/actions/workflows/integration-test.yml)
|
|
6
|
+
[](https://pypi.org/project/codefreedom/)
|
|
7
|
+
|
|
8
|
+
**Unified interface for all code agents. Simple LLM routing. Sandboxing just a click away.**
|
|
9
|
+
|
|
10
|
+
CodeFreedom solves three problems:
|
|
11
|
+
|
|
12
|
+
1. **Model lock-in** — you want to switch models across providers without reconfiguring your code agent each time.
|
|
13
|
+
2. **Environment chaos** — you want isolated, reproducible environments per project with GPU support.
|
|
14
|
+
3. **Config sprawl** — you want profiles, proxy routing, and sandbox settings managed from one place (`~/.codefreedom`).
|
|
15
|
+
|
|
16
|
+
It does this by orchestrating code agents through their **publicly supported interfaces** (environment variables, CLI flags, API endpoints). No patching, no reverse-engineering.
|
|
17
|
+
|
|
18
|
+
### Supported Agents
|
|
19
|
+
|
|
20
|
+
| Agent | Status | Subcommand | Notes |
|
|
21
|
+
| ----------- | ---------- | -------------------- | ------------------------------------------- |
|
|
22
|
+
| Claude Code | ✅ Ready | `codefreedom claude` | Local + sandbox modes, full profile support |
|
|
23
|
+
| Cursor | 🚧 Roadmap | — | Coming — same profile + proxy pattern |
|
|
24
|
+
| Codex | 🚧 Roadmap | — | Coming — same profile + proxy pattern |
|
|
25
|
+
|
|
26
|
+
The architecture is agent-agnostic: each agent gets a subcommand, profile, and routes through the same proxy. Claude Code is the first implementation.
|
|
27
|
+
|
|
28
|
+
## Principles
|
|
29
|
+
|
|
30
|
+
CodeFreedom integrates with code agents through their **publicly supported features only** — environment variables, CLI flags, config files, and API endpoints. No reverse-engineering, no patching, no vendor lock-in.
|
|
31
|
+
|
|
32
|
+
- **Just configuration.** Profiles are environment variables. Proxy routing is standard LiteLLM config.
|
|
33
|
+
- **Opt-in providers.** Set an API key to enable a provider. Leave it empty to disable. Nothing phones home by default.
|
|
34
|
+
- **All config in one place.** `~/.codefreedom` is the single source of truth for profiles, proxy settings, and sandbox configuration.
|
|
35
|
+
- **Trademarks belong to their owners.** See [NOTICE](NOTICE) for attributions.
|
|
36
|
+
|
|
37
|
+
## Disclaimer
|
|
38
|
+
|
|
39
|
+
**CodeFreedom is provided "as is" without warranty of any kind.** Use at your own risk.
|
|
40
|
+
|
|
41
|
+
- **Supported methods only.** CodeFreedom integrates with code agents exclusively through their publicly documented interfaces — environment variables, CLI flags, config files, and API endpoints. It does **not** reverse-engineer, patch, modify, or tamper with any code agent. No binary patching, no MITM, no internal API abuse.
|
|
42
|
+
- **Third-party responsibility.** CodeFreedom orchestrates upstream tools (LiteLLM, Claude Code, Docker, etc.) but does not control their behavior. You are responsible for evaluating the suitability, security, and terms of service of every upstream tool and provider you configure.
|
|
43
|
+
- **Security.** The proxy handles API keys and tokens. Sandbox mode mounts host directories (`~/.ssh`, `~/.gitconfig`) into containers. Configure these according to your organization's security policies.
|
|
44
|
+
- **No warranty.** This software is provided under the Apache 2.0 License without warranty or guarantee of any kind. The author is not liable for any damages arising from its use.
|
|
45
|
+
- **Trademarks.** CodeFreedom is not affiliated with, endorsed by, or sponsored by Anthropic, Microsoft, Anysphere, OpenAI, BerriAI, Docker, or any other third-party mentioned in this project. All trademarks belong to their respective owners.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
| Feature | codefreedom |
|
|
50
|
+
| ------------------- | ------------------------------------------------- |
|
|
51
|
+
| LLM proxy | ✅ Stateless model routing (Docker or native) |
|
|
52
|
+
| Code agent launcher | ✅ `codefreedom claude` CLI |
|
|
53
|
+
| Sandboxing | ✅ Pre-configured containers (CUDA, ROCm, Ubuntu) |
|
|
54
|
+
| Profile management | ✅ Model switching & isolation |
|
|
55
|
+
| PostgreSQL | ✅ Optional — Admin UI, spend tracking |
|
|
56
|
+
| pip installable | ✅ `pip install codefreedom` |
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
### Installation
|
|
61
|
+
|
|
62
|
+
**From PyPI (recommended):**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install codefreedom
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**From source:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/nilayparikh/codefreedom.git
|
|
72
|
+
cd codefreedom
|
|
73
|
+
pip install -e .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Now you can run `codefreedom` or `cf` from anywhere:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
codefreedom --help
|
|
80
|
+
cf --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Initialize
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Creates ~/.codefreedom/ with default profiles and proxy configs
|
|
87
|
+
codefreedom --init
|
|
88
|
+
|
|
89
|
+
# Overwrite existing files
|
|
90
|
+
codefreedom --init --force
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This creates:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
~/.codefreedom/
|
|
97
|
+
├── profiles/
|
|
98
|
+
│ ├── claude-code.json # Profile definitions
|
|
99
|
+
│ └── claude-code-profiles.schema.json # JSON Schema for validation
|
|
100
|
+
└── proxy/
|
|
101
|
+
├── docker-compose.yaml # Docker Compose for LiteLLM
|
|
102
|
+
└── config/
|
|
103
|
+
├── config.yaml # LiteLLM proxy configuration
|
|
104
|
+
└── providers/ # Provider-specific configs
|
|
105
|
+
├── deepseek.yaml
|
|
106
|
+
├── azure-foundry.yaml
|
|
107
|
+
├── nvidia.yaml
|
|
108
|
+
├── local.yaml
|
|
109
|
+
├── openai-compatible.yaml
|
|
110
|
+
├── anthropic-compatible.yaml
|
|
111
|
+
└── opencode-zen.yaml
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 1. Start the Proxy
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Start via Docker Compose
|
|
118
|
+
codefreedom proxy --up --docker
|
|
119
|
+
|
|
120
|
+
# Or start natively (requires: pip install codefreedom[litellm])
|
|
121
|
+
codefreedom proxy --up
|
|
122
|
+
|
|
123
|
+
# Validate config
|
|
124
|
+
codefreedom proxy --validate
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The proxy starts stateless — no database, no Prisma, just model routing.
|
|
128
|
+
See [Proxy → Database](docs/proxy.md#database-backends) for PostgreSQL setup.
|
|
129
|
+
|
|
130
|
+
### 2. Launch a Code Agent
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Default: native mode with Flash model
|
|
134
|
+
codefreedom claude
|
|
135
|
+
|
|
136
|
+
# Pick a different built-in profile (bare = minimal, no model aliases)
|
|
137
|
+
codefreedom claude --profile bare
|
|
138
|
+
|
|
139
|
+
# Or use a custom profile you created in claude-code.json
|
|
140
|
+
codefreedom claude --profile my-profile
|
|
141
|
+
|
|
142
|
+
# Run in sandboxed Docker container
|
|
143
|
+
codefreedom claude --sandbox
|
|
144
|
+
|
|
145
|
+
# Use native Anthropic /login auth (bypass proxy)
|
|
146
|
+
codefreedom claude --native-models
|
|
147
|
+
|
|
148
|
+
# List available profiles
|
|
149
|
+
codefreedom claude --list-profiles
|
|
150
|
+
|
|
151
|
+
# Manage the container
|
|
152
|
+
codefreedom claude --status
|
|
153
|
+
codefreedom claude --stop
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Short aliases: `cf cc` is equivalent to `codefreedom claude`.
|
|
157
|
+
|
|
158
|
+
### 3. Pass Arguments Through
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
codefreedom claude -p "Explain this codebase"
|
|
162
|
+
codefreedom claude --resume "<session-id>"
|
|
163
|
+
codefreedom claude --profile my-profile --worktree feature-branch
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Sandbox Containers
|
|
167
|
+
|
|
168
|
+
Three pre-configured images (CUDA, ROCm, Ubuntu) on `ghcr.io/nilayparikh/codefreedom`.
|
|
169
|
+
See [Sandbox Mode → Available Images](docs/claude-code/sandbox.md#available-images) for the full tag reference and Dockerfile examples.
|
|
170
|
+
|
|
171
|
+
## CLI Reference
|
|
172
|
+
|
|
173
|
+
See [Architecture → CLI Design](docs/architecture.md#cli-design) for the full command tree.
|
|
174
|
+
|
|
175
|
+
## Profiles
|
|
176
|
+
|
|
177
|
+
Profiles control which model a code agent uses and which API endpoint it routes through. All profiles live in `~/.codefreedom/profiles/claude-code.json`.
|
|
178
|
+
|
|
179
|
+
| Profile | Model | Description |
|
|
180
|
+
| --------- | ------------------- | ------------------------------------------------ |
|
|
181
|
+
| `default` | `CodeFreedom/Flash` | Base profile — routes through proxy |
|
|
182
|
+
| `bare` | _(default)_ | Minimal — no model aliases, routes through proxy |
|
|
183
|
+
|
|
184
|
+
Create custom profiles by editing `~/.codefreedom/profiles/claude-code.json`:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"profiles": {
|
|
189
|
+
"my-profile": {
|
|
190
|
+
"description": "Custom profile — override model and endpoint",
|
|
191
|
+
"env": {
|
|
192
|
+
"CLAUDE_MODEL": "CodeFreedom/Ultra",
|
|
193
|
+
"ANTHROPIC_BASE_URL": "http://localhost:4000"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
A JSON Schema is provided at `~/.codefreedom/profiles/claude-code-profiles.schema.json`.
|
|
201
|
+
|
|
202
|
+
## Database (Optional)
|
|
203
|
+
|
|
204
|
+
The proxy runs **stateless by default** — no database, no Prisma, no persistence.
|
|
205
|
+
Model routing works out of the box.
|
|
206
|
+
|
|
207
|
+
| Backend | Use Case |
|
|
208
|
+
| ------------------ | -------------------------------------------------- |
|
|
209
|
+
| **None** (default) | Dev/CI — stateless model routing, zero persistence |
|
|
210
|
+
| **PostgreSQL** | Admin UI, spend tracking, key management, teams |
|
|
211
|
+
|
|
212
|
+
See [Proxy → Database](docs/proxy.md#database-backends) for setup.
|
|
213
|
+
|
|
214
|
+
## Documentation
|
|
215
|
+
|
|
216
|
+
- [Getting Started](docs/index.md) — Install, init, launch
|
|
217
|
+
- [Environment](docs/environment.md) — `.env` chain, variable interpolation, workspace overrides
|
|
218
|
+
- [Code Agents](docs/claude-code.md) — Profiles, sandbox mode, local mode
|
|
219
|
+
- [Proxy](docs/proxy.md) — Provider setup, database, configuration
|
|
220
|
+
- [Architecture](docs/architecture.md) — System design, data flow (Mermaid diagrams)
|
|
221
|
+
- [VS Code](docs/vscode.md) — Proxy integration with VS Code extensions
|
|
222
|
+
- [Troubleshooting](docs/troubleshooting.md) — Common issues and diagnostics
|
|
223
|
+
- [License & Contributions](docs/license-contributions.md) — License, contributing guide
|
|
224
|
+
|
|
225
|
+
## Requirements
|
|
226
|
+
|
|
227
|
+
- Python 3.10+
|
|
228
|
+
- Docker — optional, for sandbox mode and Docker Compose proxy
|
|
229
|
+
- Node.js + `@anthropic-ai/claude-code` (for local mode only)
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
_Claude Code is a trademark of Anthropic. VS Code is a trademark of Microsoft. Cursor is a trademark of Anysphere. Codex is a trademark of OpenAI. Other trademarks are property of their respective owners. See [NOTICE](NOTICE)._
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codefreedom"
|
|
7
|
-
version = "0.0.
|
|
8
|
-
description = "
|
|
7
|
+
version = "0.0.4"
|
|
8
|
+
description = "Single wrapper for all code agents — simple LLM routing, sandboxing, profile management, and isolation. All config in ~/.codefreedom."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -33,9 +33,10 @@ classifiers = [
|
|
|
33
33
|
# Not needed for Docker Compose mode.
|
|
34
34
|
# dev — Development extras (type checking, linting)
|
|
35
35
|
[project.optional-dependencies]
|
|
36
|
-
litellm = ["litellm[proxy]>=1.50", "prometheus-client>=0.
|
|
36
|
+
litellm = ["litellm[proxy]>=1.50", "prometheus-client>=0.25.0"]
|
|
37
37
|
dev = ["mypy>=1.0", "ruff>=0.1", "pytest>=7.0", "types-PyYAML"]
|
|
38
|
-
|
|
38
|
+
docs = ["mkdocs-material[imaging]>=9.7.6", "mkdocs-mermaid2-plugin>=1.2"]
|
|
39
|
+
all = ["codefreedom[litellm,dev,docs]"]
|
|
39
40
|
|
|
40
41
|
[project.scripts]
|
|
41
42
|
codefreedom = "codefreedom.cli.main:main"
|
|
@@ -45,9 +46,9 @@ cf = "codefreedom.cli.main:main"
|
|
|
45
46
|
Homepage = "https://github.com/nilayparikh/codefreedom"
|
|
46
47
|
Repository = "https://github.com/nilayparikh/codefreedom"
|
|
47
48
|
Documentation = "https://nilayparikh.github.io/codefreedom/"
|
|
48
|
-
"
|
|
49
|
-
"Proxy Setup" = "https://nilayparikh.github.io/codefreedom/proxy"
|
|
50
|
-
"Claude Code" = "https://nilayparikh.github.io/codefreedom/claude-code"
|
|
49
|
+
"Quick Start" = "https://nilayparikh.github.io/codefreedom/quickstart/"
|
|
50
|
+
"Proxy Setup" = "https://nilayparikh.github.io/codefreedom/proxy/"
|
|
51
|
+
"Claude Code" = "https://nilayparikh.github.io/codefreedom/claude-code/"
|
|
51
52
|
|
|
52
53
|
[tool.setuptools.packages.find]
|
|
53
54
|
where = ["src"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""CodeFreedom -- Single wrapper for all code agents with simple LLM routing, sandboxing, and profile management."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version as _version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = _version("codefreedom")
|
|
7
|
+
except PackageNotFoundError:
|
|
8
|
+
__version__ = "0.0.0"
|