Quickstart
Activate the LLM API, add quota, create a key and send your first request with curl, Python and Node.js.
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
| Item | Value |
|---|---|
| Base URL | https://llm.yeap.cloud/v1 |
| Authentication | Header Authorization: Bearer <your key> |
| Key format | A string starting with sk- |
| API format | OpenAI-compatible |
The API 信息 (API Info) panel on the LLM API → 账户概览 (Account Overview) page lists the common endpoints, each with a copy button:
| Endpoint | Purpose |
|---|---|
/v1/chat/completions | Chat |
/v1/completions | Text completion |
/v1/embeddings | Embeddings |
/v1/images/generations | Image generation |
/v1/audio/transcriptions | Speech to text |
/v1/models | List available models |
Step 1: Activate the service
- Sign in to the console and open LLM API → 账户概览 (Account Overview) (
/llm/account). - On your first visit the page says the service is not activated (服务未开通). Click 立即开通 (Activate now).
- 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).
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
- Open LLM API → 密钥管理 (API Keys) (
/llm/tokens). - Click 创建密钥 (Create key) in the top-right corner.
- 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.
- Click 创建 (Create). When the "新密钥已创建 (Key created)" dialog opens, copy the full key that starts with
sk-.
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:
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
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.
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.
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
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 afterBearer. - 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/v1and paste yoursk-...key. Some clients expect onlyhttps://llm.yeap.cloudand add/v1themselves.