freeai-code 0.1.1__tar.gz → 0.1.3__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.
- {freeai_code-0.1.1/freeai_code.egg-info → freeai_code-0.1.3}/PKG-INFO +87 -5
- {freeai_code-0.1.1 → freeai_code-0.1.3}/README.md +84 -2
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/__init__.py +1 -1
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/cli.py +142 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/client.py +7 -62
- freeai_code-0.1.3/free_code/cloud.py +210 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/config.py +4 -4
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/models.py +5 -8
- {freeai_code-0.1.1 → freeai_code-0.1.3/freeai_code.egg-info}/PKG-INFO +87 -5
- {freeai_code-0.1.1 → freeai_code-0.1.3}/freeai_code.egg-info/SOURCES.txt +1 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/pyproject.toml +3 -3
- {freeai_code-0.1.1 → freeai_code-0.1.3}/LICENSE +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/__main__.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/agent.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/auth.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/context/__init__.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/context/discovery.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/context/repo_map.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/context/window.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/streaming.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/__init__.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/file_ops.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/git_ops.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/list_files.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/search.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/shell.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/tools/test_runner.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/ui/__init__.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/ui/diff_view.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/ui/prompt.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/free_code/ui/terminal.py +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/freeai_code.egg-info/dependency_links.txt +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/freeai_code.egg-info/entry_points.txt +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/freeai_code.egg-info/requires.txt +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/freeai_code.egg-info/top_level.txt +0 -0
- {freeai_code-0.1.1 → freeai_code-0.1.3}/setup.cfg +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: freeai-code
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Free AI coding assistant — open-source Claude Code alternative. pip install freeai-code
|
|
5
5
|
Author-email: "Free.ai" <hello@free.ai>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://free.ai/coder/
|
|
8
8
|
Project-URL: Documentation, https://free.ai/api/
|
|
9
|
-
Project-URL: Repository, https://github.com/
|
|
10
|
-
Project-URL: Bug Tracker, https://github.com/
|
|
9
|
+
Project-URL: Repository, https://github.com/muddyholdings/free-code
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/muddyholdings/free-code/issues
|
|
11
11
|
Project-URL: Changelog, https://free.ai/changelog/
|
|
12
12
|
Keywords: ai,coding,assistant,cli,free,claude-code,cursor,copilot
|
|
13
13
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -63,6 +63,9 @@ free-code ask "How does the auth system work?"
|
|
|
63
63
|
# Execute a task
|
|
64
64
|
free-code run "Add unit tests for the User model"
|
|
65
65
|
|
|
66
|
+
# Run a task in the Free.ai cloud (codex-style) and watch it
|
|
67
|
+
free-code cloud "Fix the failing CI on main" --repo https://github.com/you/project
|
|
68
|
+
|
|
66
69
|
# Initialize and scan codebase
|
|
67
70
|
free-code init
|
|
68
71
|
```
|
|
@@ -74,6 +77,8 @@ free-code init
|
|
|
74
77
|
| `free-code` | Interactive coding session (alias: `free-code chat`) |
|
|
75
78
|
| `free-code ask "question"` | One-shot question about the codebase |
|
|
76
79
|
| `free-code run "task"` | Execute a coding task |
|
|
80
|
+
| `free-code cloud "task"` | Run a coding task in the Free.ai cloud (`--repo URL`, `--model`, `--no-watch`, `--download DIR`) |
|
|
81
|
+
| `free-code tasks` | List your recent cloud tasks |
|
|
77
82
|
| `free-code init` | Initialize config, scan codebase |
|
|
78
83
|
| `free-code config` | Show current configuration |
|
|
79
84
|
| `free-code config set key value` | Set a config value |
|
|
@@ -89,6 +94,28 @@ free-code init
|
|
|
89
94
|
- Context window optimization and repo map generation
|
|
90
95
|
- .gitignore-aware file discovery
|
|
91
96
|
- Session sync — continue conversations from [web](https://free.ai/coder/) to CLI and back
|
|
97
|
+
- Cloud tasks — run long coding tasks on Free.ai's GPUs and pick up the result later
|
|
98
|
+
|
|
99
|
+
## Cloud Tasks
|
|
100
|
+
|
|
101
|
+
Run a coding task on Free.ai's infrastructure instead of your machine — like a codex agent from the terminal. Requires an API key: run `free-code login` and paste a key from [free.ai/developer](https://free.ai/developer/) (free tier works).
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Submit and watch (polls until done, prints the markdown report)
|
|
105
|
+
free-code cloud "Add rate limiting to the API" --repo https://github.com/you/project
|
|
106
|
+
|
|
107
|
+
# Pick the cloud model
|
|
108
|
+
free-code cloud "Refactor the auth module" --model deepseek-coder
|
|
109
|
+
|
|
110
|
+
# Fire and forget (you get an email when it finishes)
|
|
111
|
+
free-code cloud "Write integration tests" --no-watch
|
|
112
|
+
|
|
113
|
+
# Download the resulting code as a zip, unpacked into ./result
|
|
114
|
+
free-code cloud "Fix the flaky test suite" --download ./result
|
|
115
|
+
|
|
116
|
+
# List recent tasks
|
|
117
|
+
free-code tasks
|
|
118
|
+
```
|
|
92
119
|
|
|
93
120
|
## Configuration
|
|
94
121
|
|
|
@@ -103,7 +130,7 @@ free-code config set provider openai
|
|
|
103
130
|
free-code config set api_key sk-xxx
|
|
104
131
|
|
|
105
132
|
# Choose a model
|
|
106
|
-
free-code config set model
|
|
133
|
+
free-code config set model qwen7b
|
|
107
134
|
|
|
108
135
|
# Enable safe mode (confirm before file writes)
|
|
109
136
|
free-code config set safe_mode true
|
|
@@ -113,7 +140,7 @@ free-code config set safe_mode true
|
|
|
113
140
|
|
|
114
141
|
| Provider | Default Model | Free Tier |
|
|
115
142
|
|----------|--------------|-----------|
|
|
116
|
-
| **free.ai** (default) | Qwen
|
|
143
|
+
| **free.ai** (default) | Qwen 7B | 50K tokens/day |
|
|
117
144
|
| **openai** | GPT-4o | BYOK — no markup |
|
|
118
145
|
| **anthropic** | Claude Sonnet 4 | BYOK — no markup |
|
|
119
146
|
| **google** | Gemini 2.5 Pro | BYOK — no markup |
|
|
@@ -144,6 +171,61 @@ All file operations happen locally on your machine. The AI sees only what it nee
|
|
|
144
171
|
- [Compare vs Claude Code](https://free.ai/compare/coder-vs-claude-code/)
|
|
145
172
|
- [Compare vs Cursor](https://free.ai/compare/coder-vs-cursor/)
|
|
146
173
|
|
|
174
|
+
## vs Competitors
|
|
175
|
+
|
|
176
|
+
| Feature | Free.ai Coder | Claude Code | OpenAI Codex | Cursor | GitHub Copilot |
|
|
177
|
+
|---------|--------------|-------------|--------------|--------|----------------|
|
|
178
|
+
| Free tier | 50K tokens/day | None ($20/mo) | None ($200/mo) | None ($20/mo) | None ($10/mo) |
|
|
179
|
+
| Self-hosted models | Yes (Qwen, DeepSeek) | No | No | No | No |
|
|
180
|
+
| BYOK (bring your own key) | Yes — $0 markup | No | No | Partial | No |
|
|
181
|
+
| Open source CLI | Yes (MIT) | No | No | No | No |
|
|
182
|
+
| Web IDE | Yes (free.ai/coder/) | No | Yes | Yes | No |
|
|
183
|
+
| Terminal access | Yes | Yes | Yes | Yes | No |
|
|
184
|
+
| 346+ models | Yes | Claude only | GPT only | Multiple | GPT only |
|
|
185
|
+
| Session sync (CLI ↔ web) | Yes | No | No | No | No |
|
|
186
|
+
|
|
187
|
+
## BYOK (Bring Your Own Key)
|
|
188
|
+
|
|
189
|
+
Use your own API keys from any provider — zero markup, zero fees. Free.ai just proxies the request.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# OpenAI
|
|
193
|
+
free-code config set provider openai
|
|
194
|
+
free-code config set api_key sk-proj-xxx
|
|
195
|
+
|
|
196
|
+
# Anthropic
|
|
197
|
+
free-code config set provider anthropic
|
|
198
|
+
free-code config set api_key sk-ant-xxx
|
|
199
|
+
|
|
200
|
+
# Google
|
|
201
|
+
free-code config set provider google
|
|
202
|
+
free-code config set api_key AIzaSyxxx
|
|
203
|
+
|
|
204
|
+
# OpenRouter (access 346+ models)
|
|
205
|
+
free-code config set provider openrouter
|
|
206
|
+
free-code config set api_key sk-or-xxx
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
When using BYOK, requests go directly to the provider. No markup. No logging. Your key, your usage, your bill.
|
|
210
|
+
|
|
211
|
+
You can also set keys via environment variables:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
export FREEAI_PROVIDER=openai
|
|
215
|
+
export FREEAI_API_KEY=sk-proj-xxx
|
|
216
|
+
free-code
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Free.ai Ecosystem
|
|
220
|
+
|
|
221
|
+
- **[Free.ai](https://free.ai)** — 400+ free AI tools on the web
|
|
222
|
+
- **[Python SDK](https://github.com/muddyholdings/free-sdk)** — `pip install free-dot-ai` — use Free.ai from your code
|
|
223
|
+
- **[CLI Coder](https://github.com/muddyholdings/free-code)** — `pip install freeai-code` — AI coding in your terminal
|
|
224
|
+
- **[iOS App](https://free.ai/ios/)** — Native iPhone/iPad app
|
|
225
|
+
- **[Android App](https://free.ai/android/)** — Native Android app
|
|
226
|
+
- **[API Docs](https://free.ai/api/)** — Build on top of Free.ai
|
|
227
|
+
- **[Web IDE](https://free.ai/coder/)** — Code in your browser
|
|
228
|
+
|
|
147
229
|
## License
|
|
148
230
|
|
|
149
231
|
MIT
|
|
@@ -30,6 +30,9 @@ free-code ask "How does the auth system work?"
|
|
|
30
30
|
# Execute a task
|
|
31
31
|
free-code run "Add unit tests for the User model"
|
|
32
32
|
|
|
33
|
+
# Run a task in the Free.ai cloud (codex-style) and watch it
|
|
34
|
+
free-code cloud "Fix the failing CI on main" --repo https://github.com/you/project
|
|
35
|
+
|
|
33
36
|
# Initialize and scan codebase
|
|
34
37
|
free-code init
|
|
35
38
|
```
|
|
@@ -41,6 +44,8 @@ free-code init
|
|
|
41
44
|
| `free-code` | Interactive coding session (alias: `free-code chat`) |
|
|
42
45
|
| `free-code ask "question"` | One-shot question about the codebase |
|
|
43
46
|
| `free-code run "task"` | Execute a coding task |
|
|
47
|
+
| `free-code cloud "task"` | Run a coding task in the Free.ai cloud (`--repo URL`, `--model`, `--no-watch`, `--download DIR`) |
|
|
48
|
+
| `free-code tasks` | List your recent cloud tasks |
|
|
44
49
|
| `free-code init` | Initialize config, scan codebase |
|
|
45
50
|
| `free-code config` | Show current configuration |
|
|
46
51
|
| `free-code config set key value` | Set a config value |
|
|
@@ -56,6 +61,28 @@ free-code init
|
|
|
56
61
|
- Context window optimization and repo map generation
|
|
57
62
|
- .gitignore-aware file discovery
|
|
58
63
|
- Session sync — continue conversations from [web](https://free.ai/coder/) to CLI and back
|
|
64
|
+
- Cloud tasks — run long coding tasks on Free.ai's GPUs and pick up the result later
|
|
65
|
+
|
|
66
|
+
## Cloud Tasks
|
|
67
|
+
|
|
68
|
+
Run a coding task on Free.ai's infrastructure instead of your machine — like a codex agent from the terminal. Requires an API key: run `free-code login` and paste a key from [free.ai/developer](https://free.ai/developer/) (free tier works).
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Submit and watch (polls until done, prints the markdown report)
|
|
72
|
+
free-code cloud "Add rate limiting to the API" --repo https://github.com/you/project
|
|
73
|
+
|
|
74
|
+
# Pick the cloud model
|
|
75
|
+
free-code cloud "Refactor the auth module" --model deepseek-coder
|
|
76
|
+
|
|
77
|
+
# Fire and forget (you get an email when it finishes)
|
|
78
|
+
free-code cloud "Write integration tests" --no-watch
|
|
79
|
+
|
|
80
|
+
# Download the resulting code as a zip, unpacked into ./result
|
|
81
|
+
free-code cloud "Fix the flaky test suite" --download ./result
|
|
82
|
+
|
|
83
|
+
# List recent tasks
|
|
84
|
+
free-code tasks
|
|
85
|
+
```
|
|
59
86
|
|
|
60
87
|
## Configuration
|
|
61
88
|
|
|
@@ -70,7 +97,7 @@ free-code config set provider openai
|
|
|
70
97
|
free-code config set api_key sk-xxx
|
|
71
98
|
|
|
72
99
|
# Choose a model
|
|
73
|
-
free-code config set model
|
|
100
|
+
free-code config set model qwen7b
|
|
74
101
|
|
|
75
102
|
# Enable safe mode (confirm before file writes)
|
|
76
103
|
free-code config set safe_mode true
|
|
@@ -80,7 +107,7 @@ free-code config set safe_mode true
|
|
|
80
107
|
|
|
81
108
|
| Provider | Default Model | Free Tier |
|
|
82
109
|
|----------|--------------|-----------|
|
|
83
|
-
| **free.ai** (default) | Qwen
|
|
110
|
+
| **free.ai** (default) | Qwen 7B | 50K tokens/day |
|
|
84
111
|
| **openai** | GPT-4o | BYOK — no markup |
|
|
85
112
|
| **anthropic** | Claude Sonnet 4 | BYOK — no markup |
|
|
86
113
|
| **google** | Gemini 2.5 Pro | BYOK — no markup |
|
|
@@ -111,6 +138,61 @@ All file operations happen locally on your machine. The AI sees only what it nee
|
|
|
111
138
|
- [Compare vs Claude Code](https://free.ai/compare/coder-vs-claude-code/)
|
|
112
139
|
- [Compare vs Cursor](https://free.ai/compare/coder-vs-cursor/)
|
|
113
140
|
|
|
141
|
+
## vs Competitors
|
|
142
|
+
|
|
143
|
+
| Feature | Free.ai Coder | Claude Code | OpenAI Codex | Cursor | GitHub Copilot |
|
|
144
|
+
|---------|--------------|-------------|--------------|--------|----------------|
|
|
145
|
+
| Free tier | 50K tokens/day | None ($20/mo) | None ($200/mo) | None ($20/mo) | None ($10/mo) |
|
|
146
|
+
| Self-hosted models | Yes (Qwen, DeepSeek) | No | No | No | No |
|
|
147
|
+
| BYOK (bring your own key) | Yes — $0 markup | No | No | Partial | No |
|
|
148
|
+
| Open source CLI | Yes (MIT) | No | No | No | No |
|
|
149
|
+
| Web IDE | Yes (free.ai/coder/) | No | Yes | Yes | No |
|
|
150
|
+
| Terminal access | Yes | Yes | Yes | Yes | No |
|
|
151
|
+
| 346+ models | Yes | Claude only | GPT only | Multiple | GPT only |
|
|
152
|
+
| Session sync (CLI ↔ web) | Yes | No | No | No | No |
|
|
153
|
+
|
|
154
|
+
## BYOK (Bring Your Own Key)
|
|
155
|
+
|
|
156
|
+
Use your own API keys from any provider — zero markup, zero fees. Free.ai just proxies the request.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# OpenAI
|
|
160
|
+
free-code config set provider openai
|
|
161
|
+
free-code config set api_key sk-proj-xxx
|
|
162
|
+
|
|
163
|
+
# Anthropic
|
|
164
|
+
free-code config set provider anthropic
|
|
165
|
+
free-code config set api_key sk-ant-xxx
|
|
166
|
+
|
|
167
|
+
# Google
|
|
168
|
+
free-code config set provider google
|
|
169
|
+
free-code config set api_key AIzaSyxxx
|
|
170
|
+
|
|
171
|
+
# OpenRouter (access 346+ models)
|
|
172
|
+
free-code config set provider openrouter
|
|
173
|
+
free-code config set api_key sk-or-xxx
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
When using BYOK, requests go directly to the provider. No markup. No logging. Your key, your usage, your bill.
|
|
177
|
+
|
|
178
|
+
You can also set keys via environment variables:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
export FREEAI_PROVIDER=openai
|
|
182
|
+
export FREEAI_API_KEY=sk-proj-xxx
|
|
183
|
+
free-code
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Free.ai Ecosystem
|
|
187
|
+
|
|
188
|
+
- **[Free.ai](https://free.ai)** — 400+ free AI tools on the web
|
|
189
|
+
- **[Python SDK](https://github.com/muddyholdings/free-sdk)** — `pip install free-dot-ai` — use Free.ai from your code
|
|
190
|
+
- **[CLI Coder](https://github.com/muddyholdings/free-code)** — `pip install freeai-code` — AI coding in your terminal
|
|
191
|
+
- **[iOS App](https://free.ai/ios/)** — Native iPhone/iPad app
|
|
192
|
+
- **[Android App](https://free.ai/android/)** — Native Android app
|
|
193
|
+
- **[API Docs](https://free.ai/api/)** — Build on top of Free.ai
|
|
194
|
+
- **[Web IDE](https://free.ai/coder/)** — Code in your browser
|
|
195
|
+
|
|
114
196
|
## License
|
|
115
197
|
|
|
116
198
|
MIT
|
|
@@ -211,6 +211,148 @@ def run(task: tuple) -> None:
|
|
|
211
211
|
sys.exit(1)
|
|
212
212
|
|
|
213
213
|
|
|
214
|
+
@main.command()
|
|
215
|
+
@click.argument("prompt", nargs=-1, required=True)
|
|
216
|
+
@click.option("--repo", "repo_url", default=None, metavar="URL",
|
|
217
|
+
help="Git repository URL to run the task against.")
|
|
218
|
+
@click.option("--model", "model",
|
|
219
|
+
type=click.Choice(["qwen-coder-32b", "deepseek-coder"]),
|
|
220
|
+
default="qwen-coder-32b", show_default=True,
|
|
221
|
+
help="Cloud model to run the task with.")
|
|
222
|
+
@click.option("--no-watch", is_flag=True,
|
|
223
|
+
help="Submit and exit without polling for the result.")
|
|
224
|
+
@click.option("--download", "download_dir", metavar="DIR",
|
|
225
|
+
type=click.Path(file_okay=False), default=None,
|
|
226
|
+
help="Download and unzip the task output into DIR on completion.")
|
|
227
|
+
def cloud(prompt: tuple, repo_url: Optional[str], model: str,
|
|
228
|
+
no_watch: bool, download_dir: Optional[str]) -> None:
|
|
229
|
+
"""Run a coding task in the Free.ai cloud and stream its progress."""
|
|
230
|
+
import time
|
|
231
|
+
|
|
232
|
+
from free_code.cloud import (
|
|
233
|
+
AuthRequired,
|
|
234
|
+
CloudClient,
|
|
235
|
+
CloudError,
|
|
236
|
+
POLL_INTERVAL,
|
|
237
|
+
queue_position_of,
|
|
238
|
+
task_id_of,
|
|
239
|
+
)
|
|
240
|
+
from free_code.ui.terminal import print_error, print_info, print_markdown, print_success
|
|
241
|
+
|
|
242
|
+
client = CloudClient()
|
|
243
|
+
prompt_str = " ".join(prompt)
|
|
244
|
+
|
|
245
|
+
try:
|
|
246
|
+
task = client.submit(prompt_str, repo_url=repo_url, model=model)
|
|
247
|
+
except AuthRequired as e:
|
|
248
|
+
console.print(str(e))
|
|
249
|
+
sys.exit(1)
|
|
250
|
+
except CloudError as e:
|
|
251
|
+
print_error(str(e))
|
|
252
|
+
sys.exit(1)
|
|
253
|
+
|
|
254
|
+
task_id = task_id_of(task)
|
|
255
|
+
if not task_id:
|
|
256
|
+
print_error(f"Unexpected API response: {task}")
|
|
257
|
+
sys.exit(1)
|
|
258
|
+
|
|
259
|
+
position = queue_position_of(task)
|
|
260
|
+
if position is not None:
|
|
261
|
+
print_success(f"Task submitted: {task_id} (queue position {position})")
|
|
262
|
+
else:
|
|
263
|
+
print_success(f"Task submitted: {task_id}")
|
|
264
|
+
|
|
265
|
+
if no_watch and not download_dir:
|
|
266
|
+
print_info("Check progress with: free-code tasks")
|
|
267
|
+
return
|
|
268
|
+
if no_watch and download_dir:
|
|
269
|
+
print_info("--download requires watching the task; polling anyway.")
|
|
270
|
+
|
|
271
|
+
last_printed = None
|
|
272
|
+
try:
|
|
273
|
+
while True:
|
|
274
|
+
try:
|
|
275
|
+
task = client.get(task_id)
|
|
276
|
+
except CloudError as e:
|
|
277
|
+
print_error(str(e))
|
|
278
|
+
sys.exit(1)
|
|
279
|
+
|
|
280
|
+
status = str(task.get("status", "")).lower()
|
|
281
|
+
position = queue_position_of(task)
|
|
282
|
+
line = f"queued (position {position})" if status == "queued" and position is not None else status
|
|
283
|
+
if line != last_printed:
|
|
284
|
+
print_info(f"Status: {line}")
|
|
285
|
+
last_printed = line
|
|
286
|
+
|
|
287
|
+
if status in ("completed", "failed", "cancelled", "error"):
|
|
288
|
+
break
|
|
289
|
+
time.sleep(POLL_INTERVAL)
|
|
290
|
+
except KeyboardInterrupt:
|
|
291
|
+
console.print(f"\n[dim]Stopped watching. Task {task_id} keeps running; "
|
|
292
|
+
f"check it with: free-code tasks[/dim]")
|
|
293
|
+
return
|
|
294
|
+
|
|
295
|
+
if status == "completed":
|
|
296
|
+
result_text = task.get("result_text") or task.get("result") or ""
|
|
297
|
+
if result_text:
|
|
298
|
+
console.print()
|
|
299
|
+
print_markdown(str(result_text))
|
|
300
|
+
output_url = task.get("output_url")
|
|
301
|
+
if output_url:
|
|
302
|
+
print_info(f"Output: {output_url}")
|
|
303
|
+
if download_dir:
|
|
304
|
+
try:
|
|
305
|
+
dest = client.download_output(str(output_url), download_dir)
|
|
306
|
+
print_success(f"Output downloaded and extracted to {dest}")
|
|
307
|
+
except CloudError as e:
|
|
308
|
+
print_error(str(e))
|
|
309
|
+
sys.exit(1)
|
|
310
|
+
elif download_dir:
|
|
311
|
+
print_info("Task completed but has no downloadable output.")
|
|
312
|
+
else:
|
|
313
|
+
error = task.get("error") or task.get("result_text") or "no details"
|
|
314
|
+
print_error(f"Task {status}: {error}")
|
|
315
|
+
sys.exit(1)
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
@main.command()
|
|
319
|
+
def tasks() -> None:
|
|
320
|
+
"""List your recent cloud tasks."""
|
|
321
|
+
from free_code.cloud import AuthRequired, CloudClient, CloudError, task_id_of
|
|
322
|
+
from free_code.ui.terminal import print_error
|
|
323
|
+
|
|
324
|
+
client = CloudClient()
|
|
325
|
+
try:
|
|
326
|
+
items = client.list()
|
|
327
|
+
except AuthRequired as e:
|
|
328
|
+
console.print(str(e))
|
|
329
|
+
sys.exit(1)
|
|
330
|
+
except CloudError as e:
|
|
331
|
+
print_error(str(e))
|
|
332
|
+
sys.exit(1)
|
|
333
|
+
|
|
334
|
+
if not items:
|
|
335
|
+
console.print("[dim]No cloud tasks yet. Start one with: "
|
|
336
|
+
"free-code cloud \"task description\"[/dim]")
|
|
337
|
+
return
|
|
338
|
+
|
|
339
|
+
table = Table(title="Cloud Tasks", show_header=True, header_style="bold")
|
|
340
|
+
table.add_column("ID", style="cyan")
|
|
341
|
+
table.add_column("Status")
|
|
342
|
+
table.add_column("Created")
|
|
343
|
+
table.add_column("Task")
|
|
344
|
+
|
|
345
|
+
for item in items:
|
|
346
|
+
task_id = task_id_of(item)
|
|
347
|
+
preview = str(item.get("prompt") or item.get("preview") or "").replace("\n", " ")
|
|
348
|
+
if len(preview) > 60:
|
|
349
|
+
preview = preview[:57] + "..."
|
|
350
|
+
created = str(item.get("created_at") or item.get("created") or "")[:19].replace("T", " ")
|
|
351
|
+
table.add_row(task_id[:8], str(item.get("status", "")), created, preview)
|
|
352
|
+
|
|
353
|
+
console.print(table)
|
|
354
|
+
|
|
355
|
+
|
|
214
356
|
@main.command()
|
|
215
357
|
def init() -> None:
|
|
216
358
|
"""Initialize free-code in the current project."""
|
|
@@ -8,6 +8,7 @@ from typing import Any, AsyncIterator, Dict, List, Optional
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
+
from free_code import __version__
|
|
11
12
|
from free_code.config import (
|
|
12
13
|
get_api_url,
|
|
13
14
|
get_auth_header,
|
|
@@ -29,7 +30,7 @@ class CoderClient:
|
|
|
29
30
|
self.api_url = get_api_url(self.config)
|
|
30
31
|
self.headers = get_auth_header(self.config)
|
|
31
32
|
self.headers["Content-Type"] = "application/json"
|
|
32
|
-
self.headers["User-Agent"] = "free-code/
|
|
33
|
+
self.headers["User-Agent"] = f"free-code/{__version__}"
|
|
33
34
|
|
|
34
35
|
async def chat_stream(
|
|
35
36
|
self,
|
|
@@ -38,73 +39,15 @@ class CoderClient:
|
|
|
38
39
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
39
40
|
) -> AsyncIterator[Dict[str, Any]]:
|
|
40
41
|
"""Stream a chat completion, yielding parsed events."""
|
|
41
|
-
if self.provider == "
|
|
42
|
-
async for event in self._stream_free_ai(messages, system, tools):
|
|
43
|
-
yield event
|
|
44
|
-
elif self.provider == "anthropic":
|
|
42
|
+
if self.provider == "anthropic":
|
|
45
43
|
async for event in self._stream_anthropic(messages, system, tools):
|
|
46
44
|
yield event
|
|
47
45
|
else:
|
|
48
|
-
# OpenAI-compatible (
|
|
46
|
+
# OpenAI-compatible (Free.ai /v1/chat/completions, OpenAI,
|
|
47
|
+
# OpenRouter, Google via compat)
|
|
49
48
|
async for event in self._stream_openai_compat(messages, system, tools):
|
|
50
49
|
yield event
|
|
51
50
|
|
|
52
|
-
async def _stream_free_ai(
|
|
53
|
-
self,
|
|
54
|
-
messages: List[Dict[str, str]],
|
|
55
|
-
system: Optional[str] = None,
|
|
56
|
-
tools: Optional[List[Dict[str, Any]]] = None,
|
|
57
|
-
) -> AsyncIterator[Dict[str, Any]]:
|
|
58
|
-
"""Stream from the Free.ai coder agent endpoint."""
|
|
59
|
-
payload: Dict[str, Any] = {
|
|
60
|
-
"messages": messages,
|
|
61
|
-
"model": self.model,
|
|
62
|
-
"stream": True,
|
|
63
|
-
}
|
|
64
|
-
if system:
|
|
65
|
-
payload["system"] = system
|
|
66
|
-
if tools:
|
|
67
|
-
payload["tools"] = tools
|
|
68
|
-
|
|
69
|
-
try:
|
|
70
|
-
async with httpx.AsyncClient(timeout=DEFAULT_TIMEOUT) as client:
|
|
71
|
-
async with client.stream(
|
|
72
|
-
"POST",
|
|
73
|
-
self.api_url,
|
|
74
|
-
json=payload,
|
|
75
|
-
headers=self.headers,
|
|
76
|
-
) as response:
|
|
77
|
-
if response.status_code != 200:
|
|
78
|
-
body = await response.aread()
|
|
79
|
-
yield {
|
|
80
|
-
"type": "error",
|
|
81
|
-
"content": f"API error {response.status_code}: {body.decode(errors='replace')}",
|
|
82
|
-
}
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
buffer = ""
|
|
86
|
-
async for chunk in response.aiter_text():
|
|
87
|
-
buffer += chunk
|
|
88
|
-
while "\n\n" in buffer:
|
|
89
|
-
event_str, buffer = buffer.split("\n\n", 1)
|
|
90
|
-
for line in event_str.strip().split("\n"):
|
|
91
|
-
if line.startswith("data: "):
|
|
92
|
-
data_str = line[6:]
|
|
93
|
-
if data_str == "[DONE]":
|
|
94
|
-
yield {"type": "done"}
|
|
95
|
-
return
|
|
96
|
-
try:
|
|
97
|
-
yield json.loads(data_str)
|
|
98
|
-
except json.JSONDecodeError:
|
|
99
|
-
yield {"type": "text", "content": data_str}
|
|
100
|
-
except httpx.ConnectError:
|
|
101
|
-
yield {
|
|
102
|
-
"type": "error",
|
|
103
|
-
"content": "Cannot connect to Free.ai API. Check your internet connection.",
|
|
104
|
-
}
|
|
105
|
-
except httpx.TimeoutException:
|
|
106
|
-
yield {"type": "error", "content": "Request timed out."}
|
|
107
|
-
|
|
108
51
|
async def _stream_openai_compat(
|
|
109
52
|
self,
|
|
110
53
|
messages: List[Dict[str, str]],
|
|
@@ -122,6 +65,8 @@ class CoderClient:
|
|
|
122
65
|
"messages": all_messages,
|
|
123
66
|
"stream": True,
|
|
124
67
|
}
|
|
68
|
+
if tools:
|
|
69
|
+
payload["tools"] = tools
|
|
125
70
|
|
|
126
71
|
try:
|
|
127
72
|
async with httpx.AsyncClient(timeout=DEFAULT_TIMEOUT) as client:
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"""Cloud tasks — submit coding tasks to Free.ai's GPU fleet from the terminal.
|
|
2
|
+
|
|
3
|
+
API: https://free.ai/api/v1/tasks/code/ (Bearer auth with a Free.ai API key
|
|
4
|
+
from https://free.ai/developer/ — the free tier works).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import zipfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any, Dict, List, Optional
|
|
12
|
+
from urllib.parse import urljoin
|
|
13
|
+
|
|
14
|
+
import httpx
|
|
15
|
+
|
|
16
|
+
from free_code import __version__
|
|
17
|
+
from free_code.config import load_config
|
|
18
|
+
|
|
19
|
+
DEFAULT_TIMEOUT = 30.0
|
|
20
|
+
DOWNLOAD_TIMEOUT = 300.0
|
|
21
|
+
POLL_INTERVAL = 5.0
|
|
22
|
+
|
|
23
|
+
LOGIN_HINT = (
|
|
24
|
+
"No Free.ai API key configured.\n"
|
|
25
|
+
"Run [bold]free-code login[/bold] and paste an API key from "
|
|
26
|
+
"[link=https://free.ai/developer/]https://free.ai/developer/[/link] "
|
|
27
|
+
"(the free tier works)."
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CloudError(Exception):
|
|
32
|
+
"""A cloud task API call failed."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AuthRequired(CloudError):
|
|
36
|
+
"""No token configured, or the server rejected it (401)."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _error_message(resp: httpx.Response) -> str:
|
|
40
|
+
"""Extract a human-readable error message from an API response."""
|
|
41
|
+
try:
|
|
42
|
+
data = resp.json()
|
|
43
|
+
if isinstance(data, dict):
|
|
44
|
+
for key in ("error", "detail", "message"):
|
|
45
|
+
if data.get(key):
|
|
46
|
+
return str(data[key])
|
|
47
|
+
except Exception:
|
|
48
|
+
pass
|
|
49
|
+
body = resp.text.strip()
|
|
50
|
+
return body[:300] if body else f"HTTP {resp.status_code}"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class CloudClient:
|
|
54
|
+
"""Synchronous client for the Free.ai cloud task API."""
|
|
55
|
+
|
|
56
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
|
|
57
|
+
self.config = config or load_config()
|
|
58
|
+
base = self.config.get("sync_url") or "https://free.ai/api"
|
|
59
|
+
self.base = str(base).rstrip("/")
|
|
60
|
+
self.token = self.config.get("token")
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def headers(self) -> Dict[str, str]:
|
|
64
|
+
headers = {
|
|
65
|
+
"User-Agent": f"free-code/{__version__}",
|
|
66
|
+
"Content-Type": "application/json",
|
|
67
|
+
}
|
|
68
|
+
if self.token:
|
|
69
|
+
headers["Authorization"] = f"Bearer {self.token}"
|
|
70
|
+
return headers
|
|
71
|
+
|
|
72
|
+
def _url(self, path: str = "") -> str:
|
|
73
|
+
return f"{self.base}/v1/tasks/code/{path}"
|
|
74
|
+
|
|
75
|
+
def _check_auth(self) -> None:
|
|
76
|
+
if not self.token:
|
|
77
|
+
raise AuthRequired(LOGIN_HINT)
|
|
78
|
+
|
|
79
|
+
def _check_response(self, resp: httpx.Response) -> None:
|
|
80
|
+
if resp.status_code == 401:
|
|
81
|
+
raise AuthRequired(LOGIN_HINT)
|
|
82
|
+
if resp.status_code == 429:
|
|
83
|
+
raise CloudError(_error_message(resp))
|
|
84
|
+
|
|
85
|
+
def submit(
|
|
86
|
+
self,
|
|
87
|
+
prompt: str,
|
|
88
|
+
repo_url: Optional[str] = None,
|
|
89
|
+
model: str = "qwen-coder-32b",
|
|
90
|
+
) -> Dict[str, Any]:
|
|
91
|
+
"""Submit a cloud task. Returns the created task dict (id, queue position)."""
|
|
92
|
+
self._check_auth()
|
|
93
|
+
payload: Dict[str, Any] = {
|
|
94
|
+
"prompt": prompt,
|
|
95
|
+
"repo_url": repo_url,
|
|
96
|
+
"model": model,
|
|
97
|
+
"notify_email": True,
|
|
98
|
+
}
|
|
99
|
+
try:
|
|
100
|
+
resp = httpx.post(
|
|
101
|
+
self._url(),
|
|
102
|
+
json=payload,
|
|
103
|
+
headers=self.headers,
|
|
104
|
+
timeout=DEFAULT_TIMEOUT,
|
|
105
|
+
)
|
|
106
|
+
except httpx.HTTPError as e:
|
|
107
|
+
raise CloudError(f"Cannot reach Free.ai: {e}") from e
|
|
108
|
+
self._check_response(resp)
|
|
109
|
+
if resp.status_code not in (200, 201, 202):
|
|
110
|
+
raise CloudError(f"API error {resp.status_code}: {_error_message(resp)}")
|
|
111
|
+
data = resp.json()
|
|
112
|
+
return _unwrap_task(data)
|
|
113
|
+
|
|
114
|
+
def get(self, task_id: str) -> Dict[str, Any]:
|
|
115
|
+
"""Fetch a single task's current state."""
|
|
116
|
+
self._check_auth()
|
|
117
|
+
try:
|
|
118
|
+
resp = httpx.get(
|
|
119
|
+
self._url(f"{task_id}/"),
|
|
120
|
+
headers=self.headers,
|
|
121
|
+
timeout=DEFAULT_TIMEOUT,
|
|
122
|
+
)
|
|
123
|
+
except httpx.HTTPError as e:
|
|
124
|
+
raise CloudError(f"Cannot reach Free.ai: {e}") from e
|
|
125
|
+
self._check_response(resp)
|
|
126
|
+
if resp.status_code != 200:
|
|
127
|
+
raise CloudError(f"API error {resp.status_code}: {_error_message(resp)}")
|
|
128
|
+
data = resp.json()
|
|
129
|
+
return _unwrap_task(data)
|
|
130
|
+
|
|
131
|
+
def list(self) -> List[Dict[str, Any]]:
|
|
132
|
+
"""List recent cloud tasks."""
|
|
133
|
+
self._check_auth()
|
|
134
|
+
try:
|
|
135
|
+
resp = httpx.get(
|
|
136
|
+
self._url(),
|
|
137
|
+
headers=self.headers,
|
|
138
|
+
timeout=DEFAULT_TIMEOUT,
|
|
139
|
+
)
|
|
140
|
+
except httpx.HTTPError as e:
|
|
141
|
+
raise CloudError(f"Cannot reach Free.ai: {e}") from e
|
|
142
|
+
self._check_response(resp)
|
|
143
|
+
if resp.status_code != 200:
|
|
144
|
+
raise CloudError(f"API error {resp.status_code}: {_error_message(resp)}")
|
|
145
|
+
data = resp.json()
|
|
146
|
+
if isinstance(data, list):
|
|
147
|
+
return data
|
|
148
|
+
if isinstance(data, dict):
|
|
149
|
+
for key in ("tasks", "results", "data"):
|
|
150
|
+
if isinstance(data.get(key), list):
|
|
151
|
+
return data[key]
|
|
152
|
+
return []
|
|
153
|
+
|
|
154
|
+
def download_output(self, output_url: str, dest_dir: str) -> Path:
|
|
155
|
+
"""Download the task's output zip into dest_dir and unzip it there.
|
|
156
|
+
|
|
157
|
+
Returns the directory the archive was extracted into.
|
|
158
|
+
"""
|
|
159
|
+
url = urljoin("https://free.ai/", output_url)
|
|
160
|
+
dest = Path(dest_dir).expanduser()
|
|
161
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
162
|
+
zip_path = dest / "free-code-task-output.zip"
|
|
163
|
+
try:
|
|
164
|
+
with httpx.stream(
|
|
165
|
+
"GET",
|
|
166
|
+
url,
|
|
167
|
+
headers=self.headers,
|
|
168
|
+
timeout=DOWNLOAD_TIMEOUT,
|
|
169
|
+
follow_redirects=True,
|
|
170
|
+
) as resp:
|
|
171
|
+
if resp.status_code != 200:
|
|
172
|
+
raise CloudError(f"Download failed: HTTP {resp.status_code}")
|
|
173
|
+
with open(zip_path, "wb") as f:
|
|
174
|
+
for chunk in resp.iter_bytes():
|
|
175
|
+
f.write(chunk)
|
|
176
|
+
except httpx.HTTPError as e:
|
|
177
|
+
raise CloudError(f"Download failed: {e}") from e
|
|
178
|
+
try:
|
|
179
|
+
with zipfile.ZipFile(zip_path) as zf:
|
|
180
|
+
zf.extractall(dest)
|
|
181
|
+
except zipfile.BadZipFile as e:
|
|
182
|
+
raise CloudError(f"Output is not a valid zip archive: {zip_path}") from e
|
|
183
|
+
zip_path.unlink(missing_ok=True)
|
|
184
|
+
return dest
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def task_id_of(task: Dict[str, Any]) -> str:
|
|
188
|
+
"""Best-effort task id from an API response."""
|
|
189
|
+
return str(task.get("id") or task.get("task_id") or "")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _unwrap_task(data: Any) -> Dict[str, Any]:
|
|
193
|
+
"""Both endpoints wrap the task: submit returns {"task": {...},
|
|
194
|
+
"poll_url": ...} and detail returns {"ok": true, "task": {...}}."""
|
|
195
|
+
if not isinstance(data, dict):
|
|
196
|
+
return {}
|
|
197
|
+
inner = data.get("task")
|
|
198
|
+
return inner if isinstance(inner, dict) else data
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def queue_position_of(task: Dict[str, Any]) -> Optional[int]:
|
|
202
|
+
"""Best-effort queue position from an API response."""
|
|
203
|
+
for key in ("queue_position", "position"):
|
|
204
|
+
value = task.get(key)
|
|
205
|
+
if value is not None:
|
|
206
|
+
try:
|
|
207
|
+
return int(value)
|
|
208
|
+
except (TypeError, ValueError):
|
|
209
|
+
return None
|
|
210
|
+
return None
|
|
@@ -14,8 +14,8 @@ HISTORY_FILE = CONFIG_DIR / "history"
|
|
|
14
14
|
|
|
15
15
|
DEFAULTS: Dict[str, Any] = {
|
|
16
16
|
"provider": "free.ai",
|
|
17
|
-
"model":
|
|
18
|
-
"api_url": "https://api.free.ai/
|
|
17
|
+
"model": None, # resolved per-provider via models.get_model / PROVIDER_MODELS
|
|
18
|
+
"api_url": "https://api.free.ai/v1/chat/completions",
|
|
19
19
|
"token": None,
|
|
20
20
|
"api_key": None,
|
|
21
21
|
"safe_mode": True,
|
|
@@ -26,7 +26,7 @@ DEFAULTS: Dict[str, Any] = {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
PROVIDER_ENDPOINTS = {
|
|
29
|
-
"free.ai": "https://api.free.ai/
|
|
29
|
+
"free.ai": "https://api.free.ai/v1/chat/completions",
|
|
30
30
|
"openai": "https://api.openai.com/v1/chat/completions",
|
|
31
31
|
"anthropic": "https://api.anthropic.com/v1/messages",
|
|
32
32
|
"google": "https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent",
|
|
@@ -34,7 +34,7 @@ PROVIDER_ENDPOINTS = {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
PROVIDER_MODELS = {
|
|
37
|
-
"free.ai": "
|
|
37
|
+
"free.ai": "qwen7b",
|
|
38
38
|
"openai": "gpt-4o",
|
|
39
39
|
"anthropic": "claude-sonnet-4-20250514",
|
|
40
40
|
"google": "gemini-2.0-flash",
|
|
@@ -6,14 +6,11 @@ from typing import Any, Dict, List, Optional
|
|
|
6
6
|
|
|
7
7
|
from free_code.config import PROVIDER_MODELS, load_config
|
|
8
8
|
|
|
9
|
-
# Models available on Free.ai
|
|
9
|
+
# Models available on Free.ai's OpenAI-compatible endpoint
|
|
10
|
+
# (https://api.free.ai/v1/chat/completions — ids are whitelisted server-side)
|
|
10
11
|
FREE_AI_MODELS = [
|
|
11
|
-
{"id": "
|
|
12
|
-
{"id": "
|
|
13
|
-
{"id": "qwen2.5-7b", "name": "Qwen 2.5 7B", "context": 32768, "free": True},
|
|
14
|
-
{"id": "deepseek-coder-v2-lite", "name": "DeepSeek Coder V2 Lite", "context": 16384, "free": True},
|
|
15
|
-
{"id": "mistral-7b", "name": "Mistral 7B", "context": 32768, "free": True},
|
|
16
|
-
{"id": "phi-3", "name": "Phi-3", "context": 4096, "free": True},
|
|
12
|
+
{"id": "qwen7b", "name": "Qwen 7B (fast)", "context": 32768, "free": True},
|
|
13
|
+
{"id": "qwen3-8b", "name": "Qwen3 8B", "context": 32768, "free": True},
|
|
17
14
|
]
|
|
18
15
|
|
|
19
16
|
|
|
@@ -25,7 +22,7 @@ def get_model(config: Optional[Dict[str, Any]] = None) -> str:
|
|
|
25
22
|
if model:
|
|
26
23
|
return model
|
|
27
24
|
provider = config.get("provider", "free.ai")
|
|
28
|
-
return PROVIDER_MODELS.get(provider, "
|
|
25
|
+
return PROVIDER_MODELS.get(provider, "qwen7b")
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
def list_models(provider: Optional[str] = None) -> List[Dict[str, Any]]:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: freeai-code
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Free AI coding assistant — open-source Claude Code alternative. pip install freeai-code
|
|
5
5
|
Author-email: "Free.ai" <hello@free.ai>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://free.ai/coder/
|
|
8
8
|
Project-URL: Documentation, https://free.ai/api/
|
|
9
|
-
Project-URL: Repository, https://github.com/
|
|
10
|
-
Project-URL: Bug Tracker, https://github.com/
|
|
9
|
+
Project-URL: Repository, https://github.com/muddyholdings/free-code
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/muddyholdings/free-code/issues
|
|
11
11
|
Project-URL: Changelog, https://free.ai/changelog/
|
|
12
12
|
Keywords: ai,coding,assistant,cli,free,claude-code,cursor,copilot
|
|
13
13
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -63,6 +63,9 @@ free-code ask "How does the auth system work?"
|
|
|
63
63
|
# Execute a task
|
|
64
64
|
free-code run "Add unit tests for the User model"
|
|
65
65
|
|
|
66
|
+
# Run a task in the Free.ai cloud (codex-style) and watch it
|
|
67
|
+
free-code cloud "Fix the failing CI on main" --repo https://github.com/you/project
|
|
68
|
+
|
|
66
69
|
# Initialize and scan codebase
|
|
67
70
|
free-code init
|
|
68
71
|
```
|
|
@@ -74,6 +77,8 @@ free-code init
|
|
|
74
77
|
| `free-code` | Interactive coding session (alias: `free-code chat`) |
|
|
75
78
|
| `free-code ask "question"` | One-shot question about the codebase |
|
|
76
79
|
| `free-code run "task"` | Execute a coding task |
|
|
80
|
+
| `free-code cloud "task"` | Run a coding task in the Free.ai cloud (`--repo URL`, `--model`, `--no-watch`, `--download DIR`) |
|
|
81
|
+
| `free-code tasks` | List your recent cloud tasks |
|
|
77
82
|
| `free-code init` | Initialize config, scan codebase |
|
|
78
83
|
| `free-code config` | Show current configuration |
|
|
79
84
|
| `free-code config set key value` | Set a config value |
|
|
@@ -89,6 +94,28 @@ free-code init
|
|
|
89
94
|
- Context window optimization and repo map generation
|
|
90
95
|
- .gitignore-aware file discovery
|
|
91
96
|
- Session sync — continue conversations from [web](https://free.ai/coder/) to CLI and back
|
|
97
|
+
- Cloud tasks — run long coding tasks on Free.ai's GPUs and pick up the result later
|
|
98
|
+
|
|
99
|
+
## Cloud Tasks
|
|
100
|
+
|
|
101
|
+
Run a coding task on Free.ai's infrastructure instead of your machine — like a codex agent from the terminal. Requires an API key: run `free-code login` and paste a key from [free.ai/developer](https://free.ai/developer/) (free tier works).
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Submit and watch (polls until done, prints the markdown report)
|
|
105
|
+
free-code cloud "Add rate limiting to the API" --repo https://github.com/you/project
|
|
106
|
+
|
|
107
|
+
# Pick the cloud model
|
|
108
|
+
free-code cloud "Refactor the auth module" --model deepseek-coder
|
|
109
|
+
|
|
110
|
+
# Fire and forget (you get an email when it finishes)
|
|
111
|
+
free-code cloud "Write integration tests" --no-watch
|
|
112
|
+
|
|
113
|
+
# Download the resulting code as a zip, unpacked into ./result
|
|
114
|
+
free-code cloud "Fix the flaky test suite" --download ./result
|
|
115
|
+
|
|
116
|
+
# List recent tasks
|
|
117
|
+
free-code tasks
|
|
118
|
+
```
|
|
92
119
|
|
|
93
120
|
## Configuration
|
|
94
121
|
|
|
@@ -103,7 +130,7 @@ free-code config set provider openai
|
|
|
103
130
|
free-code config set api_key sk-xxx
|
|
104
131
|
|
|
105
132
|
# Choose a model
|
|
106
|
-
free-code config set model
|
|
133
|
+
free-code config set model qwen7b
|
|
107
134
|
|
|
108
135
|
# Enable safe mode (confirm before file writes)
|
|
109
136
|
free-code config set safe_mode true
|
|
@@ -113,7 +140,7 @@ free-code config set safe_mode true
|
|
|
113
140
|
|
|
114
141
|
| Provider | Default Model | Free Tier |
|
|
115
142
|
|----------|--------------|-----------|
|
|
116
|
-
| **free.ai** (default) | Qwen
|
|
143
|
+
| **free.ai** (default) | Qwen 7B | 50K tokens/day |
|
|
117
144
|
| **openai** | GPT-4o | BYOK — no markup |
|
|
118
145
|
| **anthropic** | Claude Sonnet 4 | BYOK — no markup |
|
|
119
146
|
| **google** | Gemini 2.5 Pro | BYOK — no markup |
|
|
@@ -144,6 +171,61 @@ All file operations happen locally on your machine. The AI sees only what it nee
|
|
|
144
171
|
- [Compare vs Claude Code](https://free.ai/compare/coder-vs-claude-code/)
|
|
145
172
|
- [Compare vs Cursor](https://free.ai/compare/coder-vs-cursor/)
|
|
146
173
|
|
|
174
|
+
## vs Competitors
|
|
175
|
+
|
|
176
|
+
| Feature | Free.ai Coder | Claude Code | OpenAI Codex | Cursor | GitHub Copilot |
|
|
177
|
+
|---------|--------------|-------------|--------------|--------|----------------|
|
|
178
|
+
| Free tier | 50K tokens/day | None ($20/mo) | None ($200/mo) | None ($20/mo) | None ($10/mo) |
|
|
179
|
+
| Self-hosted models | Yes (Qwen, DeepSeek) | No | No | No | No |
|
|
180
|
+
| BYOK (bring your own key) | Yes — $0 markup | No | No | Partial | No |
|
|
181
|
+
| Open source CLI | Yes (MIT) | No | No | No | No |
|
|
182
|
+
| Web IDE | Yes (free.ai/coder/) | No | Yes | Yes | No |
|
|
183
|
+
| Terminal access | Yes | Yes | Yes | Yes | No |
|
|
184
|
+
| 346+ models | Yes | Claude only | GPT only | Multiple | GPT only |
|
|
185
|
+
| Session sync (CLI ↔ web) | Yes | No | No | No | No |
|
|
186
|
+
|
|
187
|
+
## BYOK (Bring Your Own Key)
|
|
188
|
+
|
|
189
|
+
Use your own API keys from any provider — zero markup, zero fees. Free.ai just proxies the request.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# OpenAI
|
|
193
|
+
free-code config set provider openai
|
|
194
|
+
free-code config set api_key sk-proj-xxx
|
|
195
|
+
|
|
196
|
+
# Anthropic
|
|
197
|
+
free-code config set provider anthropic
|
|
198
|
+
free-code config set api_key sk-ant-xxx
|
|
199
|
+
|
|
200
|
+
# Google
|
|
201
|
+
free-code config set provider google
|
|
202
|
+
free-code config set api_key AIzaSyxxx
|
|
203
|
+
|
|
204
|
+
# OpenRouter (access 346+ models)
|
|
205
|
+
free-code config set provider openrouter
|
|
206
|
+
free-code config set api_key sk-or-xxx
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
When using BYOK, requests go directly to the provider. No markup. No logging. Your key, your usage, your bill.
|
|
210
|
+
|
|
211
|
+
You can also set keys via environment variables:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
export FREEAI_PROVIDER=openai
|
|
215
|
+
export FREEAI_API_KEY=sk-proj-xxx
|
|
216
|
+
free-code
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Free.ai Ecosystem
|
|
220
|
+
|
|
221
|
+
- **[Free.ai](https://free.ai)** — 400+ free AI tools on the web
|
|
222
|
+
- **[Python SDK](https://github.com/muddyholdings/free-sdk)** — `pip install free-dot-ai` — use Free.ai from your code
|
|
223
|
+
- **[CLI Coder](https://github.com/muddyholdings/free-code)** — `pip install freeai-code` — AI coding in your terminal
|
|
224
|
+
- **[iOS App](https://free.ai/ios/)** — Native iPhone/iPad app
|
|
225
|
+
- **[Android App](https://free.ai/android/)** — Native Android app
|
|
226
|
+
- **[API Docs](https://free.ai/api/)** — Build on top of Free.ai
|
|
227
|
+
- **[Web IDE](https://free.ai/coder/)** — Code in your browser
|
|
228
|
+
|
|
147
229
|
## License
|
|
148
230
|
|
|
149
231
|
MIT
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "freeai-code"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "Free AI coding assistant — open-source Claude Code alternative. pip install freeai-code"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
@@ -34,8 +34,8 @@ free-code = "free_code.cli:main"
|
|
|
34
34
|
[project.urls]
|
|
35
35
|
Homepage = "https://free.ai/coder/"
|
|
36
36
|
Documentation = "https://free.ai/api/"
|
|
37
|
-
Repository = "https://github.com/
|
|
38
|
-
"Bug Tracker" = "https://github.com/
|
|
37
|
+
Repository = "https://github.com/muddyholdings/free-code"
|
|
38
|
+
"Bug Tracker" = "https://github.com/muddyholdings/free-code/issues"
|
|
39
39
|
Changelog = "https://free.ai/changelog/"
|
|
40
40
|
|
|
41
41
|
[build-system]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|