Pengguna baharuPelan DNS dan CDN percuma untuk setiap akaun baharu.Cipta akaun anda

Quickstart

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

4 minit bacaan Dikemas kini 20 Okt 2026

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 details 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 Top up with redemption 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 tokens (/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 "New 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 & pricing (/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 → Request 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.
Adakah halaman ini membantu?