Skip to content

Yixia API User Guide

Official Website: https://api.yixia.ai

1. Create an Account

  1. Visit the Official Website
  2. Click the "Register" button in the upper right corner to create a new account
  3. Fill in the necessary registration information to complete the registration

注册账户

2. Create a token

  1. After successful login, click "Token Management" in the left menu bar to enter the token management page
  2. Click the "Add Token" button 创建令牌
  3. Enter the token name, select the default group, check for unlimited limit, and click the "Submit" button 创建新的令牌
  4. Generate and copy your API key 创建新的令牌

At this point, you will have the following token and address:

text
API Key: sk-xxxxxx
Base URL: https://api.yixia.ai

3、Use the token

3.1 Use Chery Studio

  • Use Chery Studio:

cs

text
官网: https://www.cherry-ai.com/
Github: https://github.com/CherryHQ/cherry-studio
Gitee: https://gitcode.com/CherryHQ/cherry-studio
Docs: https://docs.cherry-ai.com/

Cherry Studio is a comprehensive AI assistant platform that integrates multiple model conversations, knowledge base management, AI 绘画, translation, and other functions. With its highly customizable design, powerful extension capabilities, and user-friendly experience, Cherry Studio is the ideal choice for professional users and AI enthusiasts. Whether you are a beginner or a developer, you can find suitable AI functions in Cherry Studio to enhance your work efficiency and creativity.

  1. Download the installation package for your system, follow the prompts to complete the installation.
  2. Usage: In Cherry Studio, click the "⚙️" button in the lower left corner, select the "Model Services" tab, choose the "OpenAI" provider, paste the API key, enter the API address, click the "Test" button, and then click the "Manage" button at the bottom. Check the desired models in the box. chery studio

chery studio

3.2 Using chatbox

cb

text
官网: https://chatboxai.app/zh
Github: https://github.com/chatboxai/chatbox
Docs: https://docs.chatboxai.app/

Chatbox AI is an AI client application and smart assistant that supports numerous advanced AI models and APIs, available on Windows, MacOS, Android, iOS, Linux, and web versions.

  1. Download the appropriate installation package for your system, follow the prompts to complete the installation.
  2. Usage method: In Chatbox, click the "Settings" button in the lower left corner, select the "Model Provider" tab, click the "OpenAI" button, paste the API key, enter the API host, click the "Get" button, and check the models you need. chatbox
  3. Usage examples: chatbox
  4. Detailed usage instructions, please refer to the Chatbox AI User Guide

3.3 Using curl

Replace sk-xxxxxxxxxxxxxxxxxxxxxxx with your actual API key.

bash
curl https://api.yixia.ai/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
    "model": "gpt-5-mini",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "你是谁?"
        }
    ],
    "stream": false
}'

3.4 Using python

  1. Install Python【truncated】

  2. Install openai SDK:

    bash
    pip install openai
  3. Write Python code: main.py

    python
    from openai import OpenAI
    
    client = OpenAI(
        # 从环境变量获取
        # api_key=os.environ.get("OPENAI_API_KEY"),
        # base_url=os.environ.get("OPENAI_BASE_URL"), # 官方默认:https://api.openai.com/v1"
    
        # 直接填写, 将sk-xxxxxxxxxxxxxxxxxxxxxxx 替换为实际的API密钥。
        api_key="sk-xxxxxxxxxxxxxxxxxxxxxxxxxx",
        base_url="https://api.yixia.ai/v1",
        timeout=60,
        max_retries=3,
    )
    
    message = [
            {
                "role": "user",
                "content": "你好"
            },
        ]
    
    completion = client.chat.completions.create(
        model="gpt-5-mini",
        messages=message,
    )
    
    print(completion)
    
    print('-'.center(50, '-'))
    
    print(completion.choices[0].message.content)
  4. Run Python code:

    bash
    python main.py

3.5 Using JavaScript/TypeScript

  1. Install Node.js【omitted】

  2. Install openai sdk:

    bash
    npm install openai
  3. Create a file named main.js and add the following code:

    javascript
    import OpenAI from "openai";
    
    const client = new OpenAI({
        baseURL: "https://api.yixia.ai/v1",
        apiKey: "sk-xxxxxxxxxxxxxxxxxxxxxxxxxx",
        timeout: 60000,
        maxRetries: 3
    })
    
    const resp = await client.responses.create({
        model: "gpt-5-mini",
        input: '你好'
    })
    
    console.log(resp)
  4. Run JavaScript code:

bash
node main.js

4 Credit Recharge

When the credit is insufficient, the API cannot be used. At this point, you need to recharge.

  1. Click "Wallet" in the left menu bar to enter the wallet page.
  2. Choose the recharge amount, then click WeChat to proceed with the recharge. 充值
  3. On the pop-up confirmation page, click Confirm to proceed to the recharge page. 确认
  4. Use WeChat Scan to complete the recharge. 微信
  5. After a successful recharge, return to the wallet page to see the recharged amount.

5、Use Cases

  • Claude Code integrates Yixia API for magic-free domestic use, see details

6、Common Issues

  • 6.1 How do I get notified when my quota is insufficient?

    Log in to your account, click on Personal Settings, then Other Settings, Notification Settings, Email Notifications, enter the credit alert threshold, and save, as shown below:

    通知

  • 6.2 Group default model XXX no available channels?

    The model name is entered incorrectly. Please check the available models in the system: https://api.yixia.ai/pricing, then modify it to the correct model name.

Released under the MIT License.