Reference & FAQ / Cloud REST API

Cloud REST API

The LingXizhi cloud services expose a REST API used by the IDE core, the website, and third-party integrations. All endpoints are prefixed with /api/v1. This guide uses https://www.lingxizhiai.com as an example base URL — use the address of your own deployment.

Who this is for: developers connecting directly to the server (CI integrations, custom tooling). Everyday IDE usage never touches these endpoints — the core handles them for you. For the local core (port 3721), see the Kernel API.

Authentication

All endpoints require a JWT Bearer token unless marked public:

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. Accounts with MFA enabled receive mfa_required + mfa_ticket from the login endpoint — complete the second factor via /auth/mfa/verify to obtain the token.

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 (public, with refresh token)

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

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 credit top-up)
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": "glm-5.2", "messages": [{"role": "user", "content": "Hello"}], "stream": true}'

stream enables SSE pass-through. Plan credits are consumed first, then purchased credits; insufficient balance returns 402. The model catalog and retail prices are managed server-side, and flagship models require a minimum plan tier (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

Sensitive endpoints (login, verification codes, payment callbacks) are rate limited per hour. Exceeding the limit returns 429, and some endpoints then require a CAPTCHA. Use exponential backoff in integrations and avoid tight polling — poll order status at 3-5 second intervals.

Next steps