YlanAI Analysis API Integration Guide

Access methods, available models, request specification, billing rules, and calling examples for the YlanAI Analysis API
Mar 25, 2026

This page explains the standard integration method for the YlanAI Analysis API.

The current interface follows an OpenAI-compatible protocol and works with clients that support chat/completions and completions.

The API output follows the same analysis standards as the in-product service. It is provided only for learning, research, communication, and entertainment reference, is not a guaranteed conclusion about future outcomes, and does not replace professional advice for medical, legal, compliance, or major financial matters.

1. Access Information

Base URL, request method, and standard endpoints
ItemDescription
Preferred base URLhttps://ylan.ai/api/openai
Compatible base URLhttps://ylan.ai/api/openai/v1
Default request methodPOST
Model list endpointGET /models
Model detail endpointGET /models/{id}
Chat endpointPOST /chat/completions
Legacy completion-compatible endpointPOST /completions

For third-party clients that automatically append /v1, use https://ylan.ai/api/openai as the base URL when possible.

Authentication

All requests must include:

Authorization: Bearer sk-...

The API key belongs to the current user account, and usage is deducted from that account's paid analysis allowance balance.

For third-party clients that cannot set Authorization, the service also accepts api-key: sk-... and x-api-key: sk-....

Multi-turn conversation

The interface supports multi-turn conversation. Callers can send prior messages in the messages array to preserve continuous context.

2. Scope And Models

Available scope
ScopeDescription
Open capabilityStructured analysis API only
General chatPlain casual chat is not open
Supported scenariosSingle-person analysis and two-person relationship or collaboration analysis
Output standardFollows the same structured analysis standard as the in-product service
Currently available models

The live GET /models response is the source of truth for currently available models. The platform may update the list over time.

ModelDescription
openai/gpt-5.4Best for high-quality structured analysis
openai/gpt-5.3-chatGood for standard analysis and multi-turn dialogue
deepseek/deepseek-v3.2Good for varied analysis and multi-turn dialogue

3. Request Specification

Response format
ScenarioResponse format
stream=trueOpenAI-compatible SSE stream with chat.completion.chunk blocks and data: [DONE] as the end marker
stream=falseStandard chat.completion JSON response
POST /completionsOpenAI-compatible text_completion JSON or SSE stream
Successful non-stream headersReturns x-ylan-charged-credits and x-ylan-remaining-paid-credits for the current deduction amount and remaining paid analysis allowance
Request parameters
ParameterTypeDescription
modelstringModel name returned by GET /models
messagesarrayOpenAI-compatible messages array with at least one user message
promptstringCompatible with legacy completions; can be used for a single-turn text request when messages is omitted
inputstringCompatible with some third-party client input fields; can be used as the user question when messages is omitted
streambooleanWhether to use streaming responses, default false
localestringResponse language, such as zh, en, or ja
topicstringAnalysis topic, such as wealth_pattern or marriage_status
subject_modestringAnalysis mode, either single or pair
methodstringAnalysis method resolved by the current analysis chain
birth_profileobjectSingle-person analysis input for optional structured background information
chart_inputobjectExisting structured input for scenarios where processing has already been done externally
pair_stateobjectTwo-person analysis input for relationship or collaboration scenarios
metadataobjectExtra metadata, such as topic, locale, birthProfile, or pairState
Example: single-person streaming request
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": "en",
    "topic": "career_path",
    "subject_mode": "single",
    "birth_profile": {
      "calendar": "solar",
      "birthDate": "1992-08-15",
      "birthTime": "09:30",
      "gender": "male",
      "location": "Shenzhen"
    },
    "messages": [
      {
        "role": "user",
        "content": "Please analyze my current career adjustment priorities and action pace for the next six months based on my background."
      }
    ]
  }'
Example: two-person streaming request
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": "en",
    "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": "Please analyze the communication priorities and long-term coexisting suggestions in this relationship based on both backgrounds."
      }
    ]
  }'

4. Billing And Error Handling

Billing rules and deduction timing
ScenarioRule
Single-person analysis100 analysis allowance per successful reply
Two-person relationship or collaboration analysis200 analysis allowance per successful reply
need_inputNo charge
Allowance scopeOnly paid analysis allowance is consumed. Signup allowance and gifted allowance are excluded
stream=trueThe deduction is confirmed after the first visible content chunk is returned
stream=falseThe deduction is confirmed after the full successful response is returned
Timeout, failure, or empty responseNo deduction is confirmed, or the amount is returned under the current rule
Common error codes
HTTP StatusError codeDescription
400invalid_messagesThe request is missing valid messages, or at least one user message
400invalid_promptThe request is missing messages, prompt, and input at the same time
400invalid_modelThe requested model is not in the current open list
401invalid_api_keyThe API key is invalid or missing
402insufficient_paid_creditsThe current account does not have enough paid analysis allowance
500request_timeoutThe request timed out
500request_failedThe request failed
500internal_errorInternal server error
502empty_responseThe model returned no visible content
Supplemental input response

When background information, topic information, or two-person information is insufficient, the API may return a need_input response asking for the missing conditions required for analysis. This type of response is not currently billed.