Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

快速开始

1. 创建 API Key

登录 Lazu 控制台,进入 API Keys,点击 Create key。复制生成的 key,它通常以 sk-lazu- 开头。

2. 选择 Base URL

https://api.lazu.ai

自部署 Lazu 时,把这个地址替换成你自己的 API 域名。

3. 发起请求

cURL

curl https://api.lazu.ai/v1/chat/completions \
  -H "Authorization: Bearer $LAZU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "user", "content": "Say hello from Lazu"}
    ]
  }'

Python

from openai import OpenAI
 
client = OpenAI(
    base_url="https://api.lazu.ai/v1",
    api_key="YOUR_LAZU_KEY",
)
 
resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Say hello from Lazu"}],
)
print(resp.choices[0].message.content)

TypeScript

import OpenAI from "openai";
 
const client = new OpenAI({
  baseURL: "https://api.lazu.ai/v1",
  apiKey: process.env.LAZU_API_KEY,
});
 
const resp = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Say hello from Lazu" }],
});
console.log(resp.choices[0].message.content);

4. 下一步