Fortune API इंटीग्रेशन गाइड

YlanAI Fortune API के एक्सेस तरीके, उपलब्ध मॉडल, अनुरोध विनिर्देश, क्रेडिट नियम और कॉल उदाहरण
मार्च २५, २०२६

यह पेज YlanAI Fortune API के मानक इंटीग्रेशन तरीके को समझाता है।

वर्तमान इंटरफेस OpenAI-compatible प्रोटोकॉल का पालन करता है और chat/completions तथा completions को सपोर्ट करने वाले clients के लिए उपयुक्त है।

1. एक्सेस जानकारी

पता, request method और standard endpoints
आइटमविवरण
Recommended Base URLhttps://ylan.ai/api/openai
Compatibility Base URLhttps://ylan.ai/api/openai/v1
डिफ़ॉल्ट request methodPOST
Model list endpointGET /models
Model detail endpointGET /models/{id}
Chat endpointPOST /chat/completions
Legacy completions endpointPOST /completions

जिन third-party clients में /v1 अपने-आप जुड़ता है, उनमें Base URL के रूप में https://ylan.ai/api/openai का उपयोग करें।

Authentication

हर 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

Multi-turn conversation समर्थित है। कॉल करने वाला messages array के माध्यम से पिछला context भेज सकता है।

2. सेवा दायरा और मॉडल

सेवा दायरा
दायराविवरण
उपलब्ध क्षमताअभी केवल 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 के लिए उपयुक्त

3. अनुरोध विनिर्देश

Response format
परिदृश्यResponse format
stream=trueAPI OpenAI-compatible SSE stream लौटाती है, जिसका payload chat.completion.chunk होता है और अंत data: [DONE] से होता है
stream=falseAPI standard chat.completion JSON लौटाती है
POST /completionsAPI OpenAI-compatible text_completion JSON या SSE stream लौटाती है
सफल non-stream headersx-ylan-charged-credits और x-ylan-remaining-paid-credits शामिल होते हैं
Request parameters
पैरामीटरप्रकारविवरण
modelstringGET /models से प्राप्त मॉडल नाम
messagesarrayOpenAI-compatible message array; कम से कम एक user message आवश्यक है
promptstringLegacy completions input; messages न होने पर उपयोग किया जा सकता है
inputstringकुछ third-party clients के लिए compatibility input field; messages न होने पर उपयोग किया जा सकता है
streambooleanStreaming response चाहिए या नहीं। Default false है
localestringOutput भाषा, जैसे hi, zh, en
topicstringFortune topic, जैसे wealth_pattern या marriage_status
subject_modestringAnalysis mode: single या pair
methodstringवर्तमान fortune pipeline द्वारा व्याख्यायित analysis method
birth_profileobjectSingle-subject analysis के लिए जन्म विवरण
chart_inputobjectपहले से तैयार structured chart input
pair_stateobjectPair analysis के लिए input object
metadataobjectअतिरिक्त metadata, जिसमें topic, locale, birthProfile, pairState आदि शामिल हो सकते हैं
Single-subject streaming example
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": "कृपया इस वर्ष मेरी वित्तीय स्थिति का विश्लेषण करें।"
      }
    ]
  }'
Pair-analysis streaming example
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": "कृपया इस संबंध की दीर्घकालिक दिशा और अनुकूलता के मुख्य बिंदुओं का विश्लेषण करें।"
      }
    ]
  }'

4. बिलिंग और त्रुटि प्रबंधन

क्रेडिट नियम और शुल्क पुष्टि का समय
परिदृश्यनियम
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शुल्क पुष्टि नहीं होती या वर्तमान नियम के अनुसार वापस की जाती है
सामान्य error codes
HTTP StatusError Codeविवरण
400invalid_messagesRequest में valid messages नहीं हैं या user message अनुपस्थित है
400invalid_promptRequest में messages, prompt और input तीनों अनुपस्थित हैं
400invalid_modelRequested model वर्तमान allowlist में नहीं है
401invalid_api_keyAPI Key ग़ैर-मान्य है या गायब है
402insufficient_paid_creditsAccount में पर्याप्त paid credits नहीं हैं
500request_timeoutRequest timeout हो गया
500request_failedRequest विफल रही
500internal_errorServer internal error
502empty_responseModel ने कोई valid visible content नहीं लौटाया
need_input response

जब जन्म विवरण, विषय जानकारी, या pair analysis इनपुट अधूरे होते हैं, तो API need_input प्रकार की response लौटा सकती है। यह response विश्लेषण के लिए आवश्यक पूर्व-शर्तों को पूरा करने हेतु होती है और इस पर कोई शुल्क नहीं लगता।