Files
honen-toolkit/README.md
T

98 lines
5.2 KiB
Markdown

# Honen Toolkit
Reverse-engineered toolkit for [honen.com](https://honen.com) — AI course-builder platform running Claude behind an AI-SDK stream.
Zero dependencies (Python 3.11+ stdlib only). Three parts:
| File | Purpose |
|------|---------|
| `honen_api.py` | Full API client: signup/login, workspaces, onboarding, billing, assistant chat (SSE), MCP |
| `honen_oauth.py` | OAuth 2.0 + PKCE flow → MCP access token with `workspace-assistant` scope (sandbox) |
| `honen_farm.py` | Mass account provisioning → `accounts.jsonl` (~2.7s/account) |
| `gateway.py` | **OpenAI-compatible gateway** over the account pool + web dashboard |
## What you get
Two models via a single OpenAI-compatible endpoint:
- **`honen-assistant`** — Claude-backed workspace assistant (chat, course building, tool calls). Free tier: 15 AI messages/month per account; Pro trial: 999,999/month.
- **`honen-sandbox`** — raw bash/python execution in Honen's cloud sandbox via MCP. **Quota-free** (separate path, does not spend AI messages). Prompt = script, response = stdout/stderr.
## Quick start
```bash
# 1. Farm accounts (Gmail +alias works)
python honen_farm.py 5 # -> accounts.jsonl (email, password, cookie, workspace_id, mcp_token)
# 2. Start the gateway
python gateway.py --port 8601 --key your-local-key
# 3. Use it like any OpenAI endpoint
curl http://127.0.0.1:8601/v1/chat/completions \
-H "Authorization: Bearer your-local-key" \
-H "Content-Type: application/json" \
-d '{"model":"honen-assistant","messages":[{"role":"user","content":"hello"}]}'
# Sandbox (free code execution)
curl http://127.0.0.1:8601/v1/chat/completions \
-H "Authorization: Bearer your-local-key" \
-d '{"model":"honen-sandbox","messages":[{"role":"user","content":"uname -a; python3 -c \"print(6*7)\""}]}'
```
## Dashboard
Open `http://127.0.0.1:8601/` — pool state, per-account usage, quarantine reasons. Paste your accounts into `accounts.jsonl` (hot-reload every 60s, one JSON per line — see `accounts.jsonl.example`).
Pool logic:
- Pro accounts (field `"pro": true`) are picked first and exempt from the 15-msg quarantine.
- Dead sessions auto-relogin via email/password; exhausted accounts get quarantined automatically.
- Failover: one retry on a different account before 502.
## Pro trial (7 days, $0 today)
Honen Pro = 7-day free trial, then $20/mo. Checkout is Stripe-hosted, **card required** (no SEPA/ACH, no valid public coupons). UA-issued cards hit a 3DS wall (`setup_intent.status = requires_action`) — automated submits die with "Please try again". The working path: generate a checkout URL via the API, open it in a real browser, pay manually, complete 3DS in your bank app.
```python
from honen_api import Honen, provision_account
acc = provision_account("you+tag@gmail.com", "StrongPass1!", "Your Name")
h = Honen(cookie=acc["cookie"])
r = h.post("/api/billing/subscription/checkout", {
"planId": "<pro-plan-id>", "interval": "MONTHLY",
"stripePriceId": "<pro-price-id>", "workspaceId": acc.get("workspaceId"),
})
print(r["checkoutUrl"]) # open in browser, pay manually
```
Plan/price IDs rotate — pull live ones from `POST /api/billing/plans/list`. After payment, verify server-side: `POST /api/billing/subscription/get` → `status: TRIALING`.
## API surface (reverse-engineered)
Auth is a `courses_session` cookie (`POST /api/auth/signup {email,password,name}`). Notable endpoints:
- `POST /api/workspaces/create-personal`, `/api/workspaces/get`
- `POST /api/user/onboarding` (profileData: ageRange, education, howDidYouHear, useCase, complete)
- `POST /api/billing/plans/list | subscription/checkout | subscription/get | usage/get | coupon/validate`
- `POST /api/workspace-assistant/chat` — AI-SDK v5 SSE stream (tool events included — the gateway surfaces them as `[tool name] input -> output`)
- `POST /api/courses/draft/create`, `/api/courses/editor-chat`
- MCP: full **OAuth 2.0 + PKCE** server — `/api/oauth/register` (dynamic client registration), `/api/oauth/authorize` (consent POST needs `Origin`/`Referer` of the consent page or it returns `access_denied`), `/api/oauth/token`. Scopes: `honen:mcp workspace-assistant course:edit site:edit knowledgebase.read knowledgebase.write`. Access token lives 90 days, refresh 365.
- ⚠️ `POST /api/mcp/token` still issues a bearer, but it no longer carries the `workspace-assistant` scope → sandbox calls return `Forbidden: missing MCP scope`. Use `honen_oauth.py` instead.
- `GET /openapi.json` — their own public spec
## Sandbox (honen-sandbox model)
Cloud micro-VM ("just-bash"): `python3` (no ssl/pip/network), persistent `/data` (7.6MB), 23 skill guides at `/skills/*.md`, and platform commands `fetch-*` / `do-*` / `navigate-*` (workspace data, courses, invites, analytics...). It is NOT a general PC agent — no outbound internet, no local machine access.
```bash
python honen_oauth.py you+tag@gmail.com YourPass # -> oauth_token_*.json (full PKCE flow)
```
Put `"oauth_token"` into the account's `accounts.jsonl` line and the gateway picks it up (auto re-issues via the OAuth flow on expiry).
## Disclaimer
Research/interop toolkit. Respect honen.com ToS and rate limits.
---
[**t.me/AlStack**](https://t.me/AlStack) — AI tools, gateways, farming pipelines