WAI API
Use WAI from your own apps. Prepaid only: calls are paid from your W$ balance, never from free credit.
Quick start
- Top up W$ in My Credit → Instant Top-Up.
- Create a key in My Credit → WAI API. It is shown once - copy it.
- Call the API:
curl -X POST "https://wht-ai.com/wai-api.php?e=ask" \
-H "Authorization: Bearer wai_live_..." \
-H "Content-Type: application/json" \
-d '{"prompt":"Explain LCOE in two sentences","task_type":"simple"}'
Every response is JSON with ok (true/false). Successful calls include usage: charged_usd, balance_usd, daily_remaining_usd.
Authentication
Send Authorization: Bearer wai_live_... on every request over HTTPS. Keep keys secret; never put them in browser code or public repositories. You can hold up to 5 active keys and revoke any key instantly. Lost key? Revoke it and create a new one.
Pricing & billing
| Endpoint | Price (W$ = USD) |
|---|---|
ask | engine cost × 1.8, minimum 0.01 per call |
report | engine cost × 1.8, minimum 0.04 per requested page |
legal | engine cost × 1.8, minimum 0.25 per call |
tool (calculators) | flat 0.005 per call |
balance, tools | free |
Any call with "byok": true | flat 0.005 platform fee (your own provider key pays the engine) |
No subsidy, no surprises. Only your paid balance is used. If it is too low, or the key's daily cap (default 10 W$) is reached, the call returns HTTP 402 and nothing runs. Failed engine calls are not charged. Each key allows 30 requests per minute.
Balance
GET https://wht-ai.com/wai-api.php?e=balance
→ {"ok":true,"balance_usd":4.25,"daily_cap_usd":10,"daily_remaining_usd":9.8,"per_minute_limit":30}Ask
POST?e=ask
| Field | Notes |
|---|---|
| prompt | required, max 8,000 characters |
| task_type | simple (default), engineering, business, project, market, personal_life, shopping, hr_career |
| tier | basic (default) or pro |
| byok | optional boolean, see BYOK |
→ {"ok":true,"text":"...","usage":{"charged_usd":0.012,"balance_usd":4.238,"daily_remaining_usd":9.988}}Reports
POST?e=report - a structured written report in Markdown.
{"topic":"Battery storage market in Romania","pages":3,"language":"English"}
pages 1-10 (about 400 words each). Output is AI-generated; verify important facts. Larger, designed documents (PDF/Word/slides) are available inside the WAI app.
W Legal
POST?e=legal - analyse contract or legal text you supply.
{"text":"...contract text...","question":"List termination rights and liability caps","jurisdiction":"Romania"}
text max 60,000 characters. The response includes a notice: this is informational analysis, not legal advice. Do not use it as a substitute for a qualified lawyer.
Calculators
GET?e=tools lists available deterministic calculators (energy, finance, engineering). Run one:
POST https://wht-ai.com/wai-api.php?e=tool
{"tool":"<id from e=tools>","input":{ ... }}
Invalid inputs return HTTP 422 with a message and are not charged. Fortune/entertainment, photo and CAD-file tools are not available through the API.
BYOK (bring your own key)
If you saved your own provider key in your WAI account (Settings), add "byok": true to ask, report or legal. Your provider bills you for the engine; WAI charges only the 0.005 W$ platform fee. If no key is saved you get HTTP 400. WAI never returns your stored key.
Errors & limits
| HTTP | Meaning |
|---|---|
| 400 | Bad request or missing field |
| 401 | Missing, invalid or revoked key |
| 402 | Insufficient prepaid balance or daily cap reached - top up or wait |
| 403 | Account unavailable |
| 404 | Unknown endpoint or tool |
| 405 | Use POST |
| 422 | Tool input rejected |
| 429 | 30 requests per minute exceeded |
| 502 | AI engine unavailable - not charged, retry later |
API Terms of Use
- Prepaid, no credit. API usage is paid only from purchased W$ balance. Top-ups follow the Refund Policy; consumed W$ is not refundable.
- Your key, your responsibility. You are responsible for all calls made with your keys. Revoke compromised keys immediately.
- Informational output. Results are AI-generated and may contain errors. They are not professional, legal, medical, financial or engineering advice. Verify before relying on them.
- Acceptable use. No unlawful, harmful, deceptive or abusive use; no attempts to bypass limits, billing or security; no reselling raw access without written agreement; no uploading data you have no right to process.
- Limits. We may rate-limit, throttle, suspend or revoke keys that threaten service stability or violate these terms. Prices and limits may change with notice on this page; prices in force at call time apply.
- Availability. The API is provided as-is, without uptime guarantee. Upstream AI providers may change or fail; failed calls are not charged.
- Data. Request content is sent to the AI providers needed to answer it. Do not send secrets or personal data you are not permitted to share. See the Privacy Policy.
- Liability. To the extent permitted by law, WAI's liability is limited to the amount you paid for the affected calls.