Reference & FAQ / Cloud REST API

Cloud REST API

The LingXizhi cloud services expose a REST API used by the IDE core, website and integrations, prefixed with /api/v1. The domain below is an example; use your deployment's configured address. Availability depends on deployment, account permissions, payment channels and resource configuration, not an always-online public-cloud guarantee. Model requests send selected context through the gateway to providers.

✦

Who this is for: developers connecting directly to the server (CI integrations, custom tooling). The client and core call relevant endpoints according to configuration during IDE use; they do not necessarily cover every server API. For the local core, see the Kernel API.

Authentication

Protected user endpoints require a JWT Bearer token. Registration, login, email codes and password resets do not require a user JWT; MFA verification uses a login ticket. Payment callbacks are called by payment platforms and signature-verified server-side, without a user JWT:

curl -H "Authorization: Bearer <access_token>" https://www.lingxizhiai.com/api/v1/membership/current

Obtain the token via /auth/login and renew it with /auth/refresh before it expires. When MFA is enabled and server prerequisites are configured, login returns mfa_required + mfa_ticket; complete the second factor via /auth/mfa/verify to obtain the token. MFA endpoint registration depends on deployment prerequisites.

Auth endpoints

MethodPathDescription
POST/auth/registerRegister (email + username + password + code)
POST/auth/loginSign in; MFA accounts get an intermediate ticket
POST/auth/mfa/verifyMFA second factor (ticket + TOTP/recovery code)
POST/auth/send-codeSend an email verification code
POST/auth/reset-passwordReset password
POST/auth/refreshRefresh the access token (protected, using the refresh token as Bearer)

Membership and subscriptions

MethodPathDescription
GET/membership/plansPlan catalog (public — powers dynamic pricing on the website)
GET/membership/currentCurrent membership status (incl. credit balance)
POST/membership/subscribeCreate a subscription order (pending payment)
POST/membership/upgradeUpgrade to a higher tier (remaining credits carry over in full)
POST/membership/cancelCancel the subscription (downgrades to Free at period end)
GET/membership/quotaQuota check
GET/membership/usage?days=30Subscription usage by day
GET/membership/ordersOrder history
POST/membership/orders/:order_no/cancelCancel one of your pending orders

Creating a subscription or upgrade order does not activate benefits. Payment confirmation and entitlement updates are required. Contact support when payment channels are unavailable; cloud resources also require deployed services.

Credits

MethodPathDescription
GET/credits/balancePurchased-credit balance and plan credit remaining
GET/credits/ledger?limit&offsetCredit ledger (recharge / consume / carry-over)
POST/credits/rechargeCreate a credit top-up order (WeChat / Alipay)
GET/credits/orders/:order_noCredit order status
GET/credits/ordersCredit order history

Usage statistics

MethodPathDescription
GET/usage/logs?limit&offsetCall log details
GET/usage/stats?days=7Usage summary (requests, tokens, cache savings)
GET/usage/daily?days=30Daily usage
GET/usage/models?days=30Per-model statistics
GET/usage/cost?days=30Cost statistics
GET/usage/completionsCompletion acceptance rate, last 30 days

Online payments

MethodPathDescription
GET/payment/configPayment channel switches (public)
POST/payment/ordersCreate a payment order (subscription or upgrade; credit top-ups use /credits/recharge)
GET/payment/orders/:order_noPoll order status
POST/payment/notify/:channelAsync channel callback (server-to-server, signature verified)

Hosted LLM gateway (OpenAI-compatible)

The hosted pool exposes an OpenAI-compatible chat endpoint — no BYOK required, billed in credits. Use the user access token as Bearer:

curl https://www.lingxizhiai.com/api/v1/llm/gateway/v1/chat/completions \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-id-from-catalog>", "messages": [{"role": "user", "content": "Hello"}], "stream": true}'

Replace <model-id-from-catalog> with an ID from the current account's model catalog; do not assume a fixed model or permission.

stream enables SSE pass-through. Purchased credits are consumed first, then plan credits; insufficient balance returns 402. The model catalog and retail prices are managed server-side, and available models and minimum plan requirements depend on the current catalog and account permissions (see Plans & quotas).

Cloud tasks and sandboxes

MethodPathDescription
POST/tasks/submitSubmit a cloud task
GET/tasks · /tasks/:idTask list / status
POST/tasks/:id/cancelCancel a task
GET/cloud/vms · /cloud/quotasCloud sandbox instances and quotas

Rate limits

Rate-limit windows and verification requirements depend on deployment configuration and endpoint responses. Limits may return 429, and some endpoints require a CAPTCHA. Use exponential backoff in integrations and avoid tight polling — poll order status at 3-5 second intervals.

Next steps

v1.0.0 · web-2026