यह पेज YlanAI Fortune API के मानक इंटीग्रेशन तरीके को समझाता है।
वर्तमान इंटरफेस OpenAI-compatible प्रोटोकॉल का पालन करता है और chat/completions तथा completions को सपोर्ट करने वाले clients के लिए उपयुक्त है।
| आइटम | विवरण |
|---|---|
| Recommended Base URL | https://ylan.ai/api/openai |
| Compatibility Base URL | https://ylan.ai/api/openai/v1 |
| डिफ़ॉल्ट request method | POST |
| Model list endpoint | GET /models |
| Model detail endpoint | GET /models/{id} |
| Chat endpoint | POST /chat/completions |
Legacy completions endpoint | POST /completions |
जिन third-party clients में /v1 अपने-आप जुड़ता है, उनमें Base URL के रूप में https://ylan.ai/api/openai का उपयोग करें।
हर request में यह header अनिवार्य है:
Authorization: Bearer sk-...
API Key वर्तमान user account से जुड़ी होती है, और उपयोग उसी account के paid credit pool से काटा जाता है।
जिन clients में Authorization header सेट नहीं हो सकता, उनके लिए api-key: sk-... और x-api-key: sk-... भी समर्थित हैं।
Multi-turn conversation समर्थित है। कॉल करने वाला messages array के माध्यम से पिछला context भेज सकता है।
| दायरा | विवरण |
|---|---|
| उपलब्ध क्षमता | अभी केवल Fortune analysis API खुली है |
| सामान्य chat | उपलब्ध नहीं है |
| समर्थित परिदृश्य | Single-subject analysis और pair analysis दोनों समर्थित हैं |
| Output standard | साइट के अंदर वाले अनुभव के अनुरूप |
अधिकृत सूची GET /models के real-time परिणाम पर आधारित है। प्लेटफ़ॉर्म क्षमता बढ़ने पर उपलब्ध मॉडल बदल सकते हैं।
| मॉडल | विवरण |
|---|---|
openai/gpt-5.4 | उच्च-गुणवत्ता वाले fortune analysis परिदृश्यों के लिए उपयुक्त |
openai/gpt-5.3-chat | सामान्य व्याख्या और multi-turn dialogue के लिए उपयुक्त |
deepseek/deepseek-v3.2 | विविध analysis और multi-turn dialogue के लिए उपयुक्त |
| परिदृश्य | Response format |
|---|---|
stream=true | API OpenAI-compatible SSE stream लौटाती है, जिसका payload chat.completion.chunk होता है और अंत data: [DONE] से होता है |
stream=false | API standard chat.completion JSON लौटाती है |
POST /completions | API OpenAI-compatible text_completion JSON या SSE stream लौटाती है |
| सफल non-stream headers | x-ylan-charged-credits और x-ylan-remaining-paid-credits शामिल होते हैं |
| पैरामीटर | प्रकार | विवरण |
|---|---|---|
model | string | GET /models से प्राप्त मॉडल नाम |
messages | array | OpenAI-compatible message array; कम से कम एक user message आवश्यक है |
prompt | string | Legacy completions input; messages न होने पर उपयोग किया जा सकता है |
input | string | कुछ third-party clients के लिए compatibility input field; messages न होने पर उपयोग किया जा सकता है |
stream | boolean | Streaming response चाहिए या नहीं। Default false है |
locale | string | Output भाषा, जैसे hi, zh, en |
topic | string | Fortune topic, जैसे wealth_pattern या marriage_status |
subject_mode | string | Analysis mode: single या pair |
method | string | वर्तमान fortune pipeline द्वारा व्याख्यायित analysis method |
birth_profile | object | Single-subject analysis के लिए जन्म विवरण |
chart_input | object | पहले से तैयार structured chart input |
pair_state | object | Pair analysis के लिए input object |
metadata | object | अतिरिक्त metadata, जिसमें topic, locale, birthProfile, pairState आदि शामिल हो सकते हैं |
curl -N https://ylan.ai/api/openai/chat/completions \
-H 'Authorization: Bearer sk-your-api-key' \
-H 'Content-Type: application/json' \
-d '{
"model": "openai/gpt-5.4",
"stream": true,
"locale": "hi",
"topic": "wealth_pattern",
"subject_mode": "single",
"birth_profile": {
"calendar": "solar",
"birthDate": "1992-08-15",
"birthTime": "09:30",
"gender": "male",
"location": "Shenzhen"
},
"messages": [
{
"role": "user",
"content": "कृपया इस वर्ष मेरी वित्तीय स्थिति का विश्लेषण करें।"
}
]
}'curl -N https://ylan.ai/api/openai/chat/completions \
-H 'Authorization: Bearer sk-your-api-key' \
-H 'Content-Type: application/json' \
-d '{
"model": "deepseek/deepseek-v3.2",
"stream": true,
"locale": "hi",
"topic": "marriage_status",
"subject_mode": "pair",
"pair_state": {
"subjects": [
{
"birthProfile": {
"calendar": "solar",
"birthDate": "1992-08-15",
"birthTime": "09:30",
"gender": "male",
"location": "Shenzhen"
}
},
{
"birthProfile": {
"calendar": "solar",
"birthDate": "1995-03-08",
"birthTime": "22:15",
"gender": "female",
"location": "Guangzhou"
}
}
]
},
"messages": [
{
"role": "user",
"content": "कृपया इस संबंध की दीर्घकालिक दिशा और अनुकूलता के मुख्य बिंदुओं का विश्लेषण करें।"
}
]
}'| परिदृश्य | नियम |
|---|---|
| Single-subject analysis | प्रत्येक सफल उत्तर पर 100 क्रेडिट |
| Pair analysis | प्रत्येक सफल उत्तर पर 200 क्रेडिट |
need_input | कोई शुल्क नहीं |
| Credit scope | केवल paid credits का उपयोग किया जाता है; signup bonus और gifted credits स्वीकार नहीं किए जाते |
stream=true | पहला वैध और दिखाई देने वाला content chunk लौटते ही शुल्क पुष्टि होती है |
stream=false | पूरी response सफलतापूर्वक लौटने के बाद शुल्क पुष्टि होती है |
| Timeout, failure, empty response | शुल्क पुष्टि नहीं होती या वर्तमान नियम के अनुसार वापस की जाती है |
| HTTP Status | Error Code | विवरण |
|---|---|---|
400 | invalid_messages | Request में valid messages नहीं हैं या user message अनुपस्थित है |
400 | invalid_prompt | Request में messages, prompt और input तीनों अनुपस्थित हैं |
400 | invalid_model | Requested model वर्तमान allowlist में नहीं है |
401 | invalid_api_key | API Key ग़ैर-मान्य है या गायब है |
402 | insufficient_paid_credits | Account में पर्याप्त paid credits नहीं हैं |
500 | request_timeout | Request timeout हो गया |
500 | request_failed | Request विफल रही |
500 | internal_error | Server internal error |
502 | empty_response | Model ने कोई valid visible content नहीं लौटाया |
जब जन्म विवरण, विषय जानकारी, या pair analysis इनपुट अधूरे होते हैं, तो API need_input प्रकार की response लौटा सकती है। यह response विश्लेषण के लिए आवश्यक पूर्व-शर्तों को पूरा करने हेतु होती है और इस पर कोई शुल्क नहीं लगता।