新用戶新用戶即享 DNS 與 CDN 免費方案。建立帳號

Quickstart

Activate the LLM API, add quota, create a key and send your first request with curl, Python and Node.js.

4 分鐘閱讀 更新於 2026年10月6日

This guide walks you through your first LLM API call: activate the service, add quota, create a key, then send requests with curl, Python and Node.js.

Connection details

ItemValue
Base URLhttps://llm.yeap.cloud/v1
AuthenticationHeader Authorization: Bearer <your key>
Key formatA string starting with sk-
API formatOpenAI-compatible

The API 信息 (API Info) panel on the LLM API → 账户概览 (Account Overview) page lists the common endpoints, each with a copy button:

EndpointPurpose
/v1/chat/completionsChat
/v1/completionsText completion
/v1/embeddingsEmbeddings
/v1/images/generationsImage generation
/v1/audio/transcriptionsSpeech to text
/v1/modelsList available models

Step 1: Activate the service

  1. Sign in to the console and open LLM API → 账户概览 (Account Overview) (/llm/account).
  2. On your first visit the page says the service is not activated (服务未开通). Click 立即开通 (Activate now).
  3. Once it is activated, the page shows your account data, usage statistics, charts and API info.

Step 2: Add quota

Model calls draw on the quota in your LLM account. You can add quota in two ways:

  • Transfer from your main account balance: on the 当前余额 (Current balance) card on Account Overview, click 划转 (Transfer), enter an amount and click 确认划转 (Confirm transfer). The minimum transfer is 1, and the dialog shows how much quota you will get.
  • Redemption code: if you have a code, enter it in the 兑换码充值 (Redeem code) card and click 兑换 (Redeem).

To top up your main balance first, click 充值 (Top up) on the Current balance card. This opens 财务管理 → 账户余额 (Billing → Balance) (/billing/balance).

Warning

Quota you transfer to the LLM API cannot be moved back to your main balance. Transfer only what you need.

Step 3: Create an API key

  1. Open LLM API → 密钥管理 (API Keys) (/llm/tokens).
  2. Click 创建密钥 (Create key) in the top-right corner.
  3. Enter a 名称 (Name). This is required. You can leave everything else at the defaults: default group, no model limits, no IP limits and no expiry. See API keys, quota and usage for what each option does.
  4. Click 创建 (Create). When the "新密钥已创建 (Key created)" dialog opens, copy the full key that starts with sk-.
Tip

Never put keys in front-end code or commit them to a repository. Pass them in through environment variables instead, for example export YEAP_LLM_API_KEY=sk-....

Step 4: Choose a model

Look up model names and prices on LLM API → 模型列表 (Models) (/llm/models), or query the API:

bash
curl https://llm.yeap.cloud/v1/models \
  -H "Authorization: Bearer $YEAP_LLM_API_KEY"

The examples below use gpt-4o-mini. Whether a model is available depends on your key's group and on what the platform currently offers. Check the Models page and replace the model name with the one you want.

Step 5: Send a request

curl

bash
curl https://llm.yeap.cloud/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $YEAP_LLM_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Introduce yourself in one sentence."}
    ]
  }'

To stream the response, add "stream": true to the request body. The response then arrives in chunks as Server-Sent Events (SSE).

Python (openai SDK)

Install the SDK first: pip install openai.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["YEAP_LLM_API_KEY"],
    base_url="https://llm.yeap.cloud/v1",
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Introduce yourself in one sentence."}],
)
print(resp.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Write a four-line poem."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Node.js (openai SDK)

Install the SDK first: npm install openai.

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.YEAP_LLM_API_KEY,
  baseURL: "https://llm.yeap.cloud/v1",
});

const resp = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Introduce yourself in one sentence." }],
});
console.log(resp.choices[0].message.content);

Embeddings example

bash
curl https://llm.yeap.cloud/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $YEAP_LLM_API_KEY" \
  -d '{"model": "text-embedding-3-small", "input": "Yeap Cloud"}'

Step 6: Check usage

After a call completes, open LLM API → 使用日志 (Usage Logs) to see its model, input and output token counts and cost. See API keys, quota and usage for more.

Troubleshooting

  • 401 with a "no token provided" message: check that the header is exactly Authorization: Bearer sk-..., with one space after Bearer.
  • Insufficient quota: either your account quota or the key's quota cap has run out. For the account, transfer or redeem more quota. For the key, raise its cap or turn on unlimited quota under API Keys.
  • Model not available: the model is not in your key's group, or the key's model limits exclude it. Check the Models page, or switch to another group or model.
  • Request rejected and the key has an IP limit: make sure your server's outbound IP is on the allowlist.
  • Third-party clients: pick the "OpenAI-compatible" provider type, set the address to https://llm.yeap.cloud/v1 and paste your sk-... key. Some clients expect only https://llm.yeap.cloud and add /v1 themselves.
這個頁面對你有幫助嗎?