Xuanlin Q&A Xuanlin Q&A EN

Developer Docs

Xuanlin Q&A offers an OpenAI-compatible endpoint for scholarly Yijing and Bazi answers grounded in an extensive classical library.

Endpoint

POST https://api.xuanlinyi.com/v1/chat/completions

OpenAI-compatible. Ask in Chinese, English, German, Spanish, Japanese, Korean or Russian — answered in your language.

Authentication

Send your API key as a bearer token:

Authorization: Bearer sk-xl-xxxxxxxxxxxxxxxx

Create keys under Developer Features in My Account.

Example

curl -X POST https://api.xuanlinyi.com/v1/chat/completions \
  -H "Authorization: Bearer sk-xl-xxxx" \
  -H "Content-Type: application/json" \
  -d '{"model":"xuanlin-qa","messages":[{"role":"user","content":"How to use the Jianlu structure?"}]}'

Parameters

ParamDescription
messagesRequired. Last user message is the question.
max_tokensOptional, default 1800, max 4096. Funds are reserved to this ceiling and unused credit is released at settlement.
temperatureOptional, default 0.15, range 0-1.5.
streamStreaming not supported yet.

Response

Standard OpenAI format, plus a xuanlin field with the answer language, domain, source count, calendar-calculation status, cost and remaining balance. Retrieved library excerpts are not exposed by the API.

Errors

HTTPcodeMeaning
401invalid_api_keyMissing or invalid key
402insufficient_balanceBalance too low
429rate_limitedRate limited (60 req/min/key)
502upstream_errorGeneration service unavailable

Billing

ItemRate
Anonymous web Q&AFree. 5 queries per browser visitor per day; the network address has only a higher anti-abuse safety ceiling.
Signup credit¥10 free credit on registration, for web Q&A and API calls.
Web Q&A (signed-in)¥0.015 / 1K input and ¥0.060 / 1K output; capped at ¥0.30 for Standard or ¥0.60 for Deep.
API callsSame token rates, without the web tier cap; deducted by actual usage.
Out of balanceWeb Q&A falls back to the free daily quota; API returns HTTP 402.
Top-upSecure Stripe payment, minimum ¥10. All permissions restore automatically after top-up.

Formula: raw cost (CNY) = input_tokens / 1000 × 0.015 + output_tokens / 1000 × 0.060. Web Q&A then applies the selected tier cap; API calls use the raw cost.

Example: a typical Q&A (~4,000 input + 800 output tokens) costs about ¥0.11. The ¥10 signup credit covers roughly 25–30 queries.

Balance: check your balance, usage and spending in My Account. More questions — see the FAQ.

Copyright

Answers are compiled from publicly available sources. To request takedown, use the Copyright & Takedown page.