Metadata-Version: 2.5
Name: autooptm
Version: 0.5.0
Summary: Client, CLI and MCP server for AutoOptm: measured GPU speedups for your training and inference code
License: MIT
Requires-Python: >=3.9
Provides-Extra: mcp
Requires-Dist: mcp>=1.0; extra == 'mcp'
Description-Content-Type: text/markdown

# autooptm

Measured GPU speedups for your training and inference code, from the
terminal, an agent, or Python. Diagnosis and measurement are free; credits
move only when you unlock the patch.

```bash
pip install autooptm
autooptm login                 # opens the browser to approve this machine (30-day token)
autooptm run https://github.com/you/repo --entrypoint train.py
autooptm unlock <jobId>        # asks before spending credits
git apply autooptm.patch
```

`run` first gets the **free estimate** and shows it (expected speedup, the
range, a lossless line, and the reviewer's note if something in the
submission would stop the run); it then asks before taking the analysis
deposit. `--yes` continues without asking, `--no-estimate` skips the
estimate (the deposit is taken at submit). A job left at the estimate can be
answered later:

```bash
autooptm estimate <jobId>            # the numbers again
autooptm decide <jobId> continue     # takes the deposit, credited against the unlock
autooptm decide <jobId> stop         # free
```

`autooptm login --email you@example.com` is the no-browser door (a mailed
code) for servers and CI shells; `--no-browser` prints the approval link
instead of opening it.

Python:

```python
from autooptm import AutoOptm
ao = AutoOptm()
job = ao.submit(".", entrypoint="bench.py", workload="inference")
done = ao.wait(job["jobId"])
print(done["speedup"], done["unlock_credits"])
```

MCP (Claude Code, Cursor, any MCP client), `pip install 'autooptm[mcp]'`:

```json
{ "mcpServers": { "autooptm": { "command": "autooptm-mcp" } } }
```

Tools: `optimize_submit`, `optimize_status`, `optimize_wait`,
`unlock_patch` (requires explicit user confirmation), `download_patch`,
`account_balance`.

## API keys (CI and scripts)

`autooptm login` saves a 30-day token that slides on use, which is the right
credential for a laptop and the wrong one for a build machine: it expires
while the pipeline is idle, it needs a mailbox to renew, and it can spend
credits. A key fixes all three.

```bash
autooptm login                      # a key is minted from a session
autooptm keys create "CI pipeline"  # printed once, never again
autooptm keys list
autooptm keys revoke aok_1a2b3c4d5e6f
```

Put it in CI as `AUTOOPTM_TOKEN` and it works everywhere a login token does.

Keys carry scopes, and the default is `read,submit`. **`unlock` is opt-in**,
so a build machine can submit work and read the result without being able to
spend a credit, whatever the build does. Add `--scopes read,submit,unlock`
only if you mean it, and `--expires-in-days N` to make it die on its own.
