# aiand.com Auto-Registration ## Platform Overview - **Site:** aiand.com (Japanese AI inference platform) - **API:** `https://api.aiand.com` (OpenAI-compatible) - **Console:** `https://console.aiand.com` - **Docs:** `https://docs.aiand.com` - **Auth:** Magic-link email (no password, no captcha on API) - **Promo:** `UNITABETAI` — $50 free credits (Stripe UI only, 100% discount, no card needed) ## Available Models (8 configured, 7 on API, 1 working on $0 balance) | Model ID | Status | Notes | |----------|--------|-------| | `qwen/qwen3.6-27b` | ✅ Works ($0) | **Reasoning model** — output in `reasoning` field, `content` is null. Free tier. | | `deepseek-ai/deepseek-v4-pro` | ❌ Needs credits | Returns `insufficient_credits` | | `deepseek-ai/deepseek-v4-flash` | ❌ Needs credits | Returns `insufficient_credits` | | `zai-org/glm-5.2` | ❌ Not on host | Returns `does not exist` | | `moonshotai/kimi-k2.7-code` | ❌ Not on host | Returns `does not exist` | | `moonshotai/kimi-k2.6` | ❌ Not on API | Missing from `GET /v1/models` response | | `google/gemma-4-31b-it` | ❌ Not on host | Returns `does not exist` | | `openai/gpt-oss-120b` | ❌ Not on host | Returns `does not exist` | Note: `GET /v1/models` returns only 7 models. Many are listed but not actually deployed on the host. ## Registration Flow (API-only, no browser needed) ``` 1. POST /auth/request-magic-link {"email": "user+alias@gmail.com"} 2. IMAP: read magic link from email, extract token from URL 3. POST /auth/verify {"token": "..."} → returns access_token + refresh_token cookies 4. POST /api/v1/onboarding {"first_name":"...", "self_description":"individual_developer", ...} 5. POST /api/v1/organizations {"name":"Default", "currency":"usd"} 6. POST /api/v1/keys {"display_name":"Auto Key"} (X-Org-ID header required) → returns plain_key (show once!) ``` ## Key API Endpoints - `POST /auth/request-magic-link` — send magic link - `POST /auth/verify` — exchange token for session cookies - `POST /api/v1/onboarding` — complete onboarding - `GET /auth/me` — get user info (default_org_id) - `POST /api/v1/organizations` — create org - `POST /api/v1/keys` — create API key (needs X-Org-ID header) - `GET /api/v1/keys` — list keys (needs X-Org-ID) - `DELETE /api/v1/keys/{id}` — delete key - `GET /billing/account` — get balance (needs X-Org-ID) - `GET /v1/models` — list models (Bearer auth) - `POST /v1/chat/completions` — chat (Bearer auth) ## Gmail +aliasing - Use `[REDACTED-NAME]+aiandN@gmail.com` — all go to same inbox - IMAP: `imap.gmail.com:993`, app password `IMAP_APP_PASSWORD` - Magic link token regex: `token=[REDACTED]]+)` in HTML body - CRITICAL: call `mail.noop()` before each `mail.search()` in polling loops ## Promo Code (UNITABETAI — $50 free) — STATUS: STRIPE-LEVEL REJECTED (2026-07-10) - **Stripe rejects `UNITABETAI`**: Returns `Код недействителен.` ("Code invalid") on aiand `Platform Credits` $50 USD checkout. - **Checkout session itself is valid**: observed Stripe Checkout has `allow_promotion_codes=true`, currency `usd`, $50 amount, merchant in JP, live checkout. The failure happens in Stripe's promotion-code validation path, not in aiand's UI. - **NOT automatable via aiand API** — promo entry is Stripe Checkout UI / Stripe apply endpoint only. - **Full browser flow:** 1. `console.aiand.com` → login via magic link 2. Go directly to `https://console.aiand.com/settings/billing` if possible 3. Click **Credits: $0.00**, **Add Credits**, or **Purchase Credits** (all open the credit dialog) 4. Select **$50** preset → click **Purchase** 5. Redirected to `checkout.stripe.com/g/pay/cs_live_...` 6. Promo code input: `textbox "Ввести промокод"` / Stripe promotion-code field 7. Apply button: `.Button.omtkhhcF__PromotionCodeEntry-applyButton` (click via JS or press Enter) 8. Result appears as alert text: "Код недействителен." or discount applied - Confirmed on multiple existing and fresh accounts: code is rejected for this checkout/product/currency in automated browser sessions. - **Also tested:** `WELCOME10` (from official docs), `UNITABET`, `unitabetai` — all return "Код недействителен." - **Country switching:** Changed Stripe billing country from Ukraine to Japan — no effect, code still invalid. - **Session timeout:** aiand console sessions expire in ~5-10 min. If Stripe redirect shows "Verification Failed: 401", request fresh magic link via IMAP+execute_code, navigate to verify-magic URL, and redo the flow from Credits. - **When user says the code works elsewhere:** do not argue from the UI text. Capture the exact Stripe network request/response for the promo-code apply endpoint and inspect the machine reason (`promotion_code_invalid`, `coupon_expired`, `max_redemptions_reached`, `customer_ineligible`, `minimum_amount_not_met`, etc.). UI text alone is insufficient for final diagnosis. - **IP/browser-fingerprint hypothesis:** possible, but datacenter/server IP is often lower-trust for Stripe Checkout than the user's normal local browser. For legitimate reproduction, prefer a visible local Chrome/persistent profile or residential/trusted browser session before trying a VPS/datacenter server. - Possible causes: expired, disabled, region/currency-restricted, first-payment-only, product/price mismatch, max redemptions reached, or customer/email-specific coupon. - **Do not** mass-retry promo across accounts as a workaround — if Stripe rejects the apply endpoint, diagnose the Stripe reason first instead of burning fresh accounts. ## Script - `C:\Users\User\Desktop\aiand_autoreg.py` — auto-registration script - Output: `C:\Users\User\Desktop\aiand_keys.txt` (email|key|org_id) ## Hermes Config ```yaml custom_providers: - api_key: [REDACTED] base_url: https://api.aiand.com/v1 discover_models: false max_retries: 2 models: deepseek-ai/deepseek-v4-pro: {ctx: 256000} deepseek-ai/deepseek-v4-flash: {ctx: 256000} zai-org/glm-5.2: {ctx: 200000} moonshotai/kimi-k2.7-code: {ctx: 256000} moonshotai/kimi-k2.6: {ctx: 256000} qwen/qwen3.6-27b: {ctx: 131072} google/gemma-4-31b-it: {ctx: 131072} openai/gpt-oss-120b: {ctx: 131072} name: aiand provider: openai timeout: 180 verify_ssl: true ``` ## Pitfalls 1. **Token one-time use** — each magic link token can only be verified once. If verify fails, request new magic link. 2. **X-Org-ID required** — key creation and billing endpoints need `X-Org-ID` header, not `orgId` query param. 3. **No organization auto-created** — `default_org_id` is null after onboarding. Must create org explicitly. 4. **Balance $0 after registration** — new accounts have $0. Promo code UNITABETAI is invalid as of 2026-07-09. 5. **Model names** — use full `provider/model` format, not short names. `deepseek-v4-pro` → 400 error. 6. **IMAP noop** — Gmail IMAP caches state. Always `mail.noop()` before polling for new emails. 7. **No rate limit observed** — magic link requests have no visible rate limit. ~15 accounts in 5 minutes from single IP works. 8. **⚠️ TRUNCATED KEYS — verify before claiming success** — The `plain_key` from `POST /api/v1/keys` may be truncated or malformed in the output file (e.g., `sk-1f3...841d` instead of full key). Always verify at least one key from the output file with a real API call. Full keys are 67 characters. Terminal truncates display but files contain full keys. If keys are truncated, re-run the script — the `plain_key` field in the API response contains the full key; the truncation is a write artifact. 9. **Cloudflare blocks Python HTTP** — `requests`, `aiohttp`, `urllib` all hit `Error 1010: browser signature`. Use system `curl` via `subprocess.run(["curl", ...])` for any Python tool that needs to talk to aiand API. 10. **qwen/qwen3.6-27b is a reasoning model** — output is in `choices[0].message.reasoning`, NOT `content` (which is null). Always check both fields. `finish_reason: "length"` when `max_tokens` is too low. 12. **Session timeout** — aiand console sessions via magic link expire in ~5-10 minutes. After expiry, `console.aiand.com/*` redirects to `/login`. For browser-based flows (promo code, credit check), complete the entire flow within one session window. If session dies: fetch fresh magic link via IMAP (`execute_code` is fastest), navigate to `verify-magic?token=`, and continue.