認証
すべてのリクエストに header を含めるx-lala-key: <あなたの API key>(または標準Authorization: Bearer <key>)。
申請 key:メール[email protected]または WhatsApp 経由でお問い合わせください。
モデルリスト
curl https://lala.buddylala.ai/v1/models -H "x-lala-key: $LALA_KEY"
| モデル | タイプ | Endpoint | 説明 |
|---|---|---|---|
lala-6 | chat | /chat/completions | 高効率マルチモーダル対話(1M context) |
lala-6-pro | chat | /chat/completions | フラッグシップマルチモーダル対話(1M context) |
lala-ultrafast | chat | /chat/completions | 超高速推論対話(1M context) |
lala-super | chat | /chat/completions | トップティアフラッグシップ推論 |
lala-rag | embedding | /embeddings | テキストベクトル化(RAG 検索) |
lala-image | image | /images/generations | 画像生成(品質優先) |
lala-video | video | /responses | ビデオ生成(タスク型、4–30 秒) |
lala-video-get | video | /responses | ビデオタスク結果を照会 |
lala-speech | tts | /responses | 高品質音声合成 |
lala-music | music | /responses | 音楽生成 |
lala-lyric | lyric | /responses | 歌詞生成 |
lala-decision | decision | /typesafe/systemone | 構造化判研(テキスト生成なし) |
対話 Chat Completions
OpenAI-compatible。サポート stream: trueストリーミング出力。
curl
curl https://lala.buddylala.ai/v1/chat/completions \
-H "x-lala-key: $LALA_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lala-6",
"messages": [{"role": "user", "content": "你好,介紹下自己"}],
"max_tokens": 500
}'
Python(openai SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://lala.buddylala.ai/v1",
api_key="***", # 你的 lala key
)
resp = client.chat.completions.create(
model="lala-super",
messages=[{"role": "user", "content": "寫一首關於秋天的詩"}],
)
print(resp.choices[0].message.content)
Node.js
const res = await fetch("https://lala.buddylala.ai/v1/chat/completions", {
method: "POST",
headers: {
"x-lala-key": process.env.LALA_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
model: "lala-ultrafast",
messages: [{ role: "user", content: "1+1=?" }],
stream: false,
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);
ベクトル Embeddings
curl https://lala.buddylala.ai/v1/embeddings \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{"model": "lala-rag", "input": "寵物食品零售自動化"}'
回傳標準 OpenAI embeddings 形式(data[].embeddingベクトル配列)、ベクトルデータベースに直接入力して RAG を実行できます。
画像生成 Image
curl https://lala.buddylala.ai/v1/images/generations \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{"model": "lala-image", "prompt": "a cute corgi puppy, studio photo", "n": 1}'
回傳 data[].url(画像 CDN リンク)。課金:1枚あたり固定価格、詳細は価格ページ。
ビデオ生成 Video(タスク型)
ビデオ生成係2段階式:先提交任務攞 task id,再輪詢攞結果。
ステップ 1:タスクを送信
curl https://lala.buddylala.ai/v1/responses \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{
"model": "lala-video",
"input": [{"type": "text", "text": "a cat yawning in sunlight"}],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true
}'
# → {"id": "cgt-xxxx", ...} ← 保存此任務識別碼!
パラメータ:duration4–30 秒(または -1 スマート選択)、resolution 480p/720p/1080p、ratio 16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive、generate_audioデフォルト true(自動で人声/効果音/背景音楽を配置)。
ステップ 2:ポーリング結果
curl https://lala.buddylala.ai/v1/responses \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{"model": "lala-video-get", "input": "cgt-xxxx"}'
# status: succeeded 時 output[].content[].text = 視頻下載 URL
音声合成 Speech (TTS)
curl https://lala.buddylala.ai/v1/responses \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{
"model": "lala-speech",
"input": "你好,歡迎致電 Buddylala",
"output_format": "hex",
"voice_setting": {"voice_id": "male-qn-qingse", "speed": 1, "vol": 1, "pitch": 0}
}'
# → {"data": {"audio": "<hex 編碼音頻>"}}
hex を mp3 に変換:python3 -c "import binascii,sys; open('out.mp3','wb').write(binascii.unhexlify(sys.argv[1]))" "<hex>"。80+ プリセット音色、9 種類の感情。
音楽生成 Music
curl https://lala.buddylala.ai/v1/responses \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{
"model": "lala-music",
"input": "upbeat jingle for a pet shop",
"lyrics": "la la la happy day with you"
}'
# → {"data": {"audio": "<hex>"}}
lyrics必須(事前に lala-lyric生成)。
歌詞生成 Lyric
curl https://lala.buddylala.ai/v1/responses \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{
"model": "lala-lyric",
"mode": "write_full_song",
"input": "一首關於貓的輕快廣東歌"
}'
# → {"song_title": "...", "style_tags": "...", "lyrics": "[Verse]..."}
mode:write_full_song(完全な楽曲)またはedit(続き書き/修正、必要な場合は lyrics既存コンテンツ)。
構造化判研 Decision(非テキスト生成)
lala-decisionテキストを生成せず、のみ実行構造化判断:1 つの状態(ワークオーダー/会話/ログ)+1 組の質問を並行して返し、Choice / Score / Noul 3 種類の回答を校準確率付きで返します。画像判断をサポート:最大 4 枚の画像(PNG/JPEG/WebP、各 ≤4MiB、base64 内埋め込み、リモート URL は不可)を一緒に分析できます。典型的な応答時間 1~5 秒で、ワークオーダー配分、意図識別、コンテンツリスク管理に適しています。
curl https://lala.buddylala.ai/typesafe/systemone \
-H "x-lala-key: $LALA_KEY" -H "Content-Type: application/json" \
-d '{
"model": "lala-decision",
"state": "Customer: my order is 5 days late and I want a refund!",
"questions": {
"urgency": {
"type": "choice",
"instructions": "ワークオーダーの緊急度を判定する",
"criteria": {"低": "語気が穏やか", "中": "不満があるが期限なし", "高": "感情的または返金要求"}
},
"refund_requested": {
"type": "noul",
"instructions": "顧客が明確に返金をリクエストしているか?"
}
}
}'
# → {"answers": {"refund_requested": {"noul": 0.99, "type": "noul"}}, "model": "lala-decision", ...}
問題タイプ:choice(criteria は object:オプション名→判定基準)、score(criteria は array:低から高グレード)、noul(true/false 判断、criteria 不要)。
画像判断(オプション):body に追加"images": ["<base64 画像>"](最大 4 枚;各ファイル ≤4MiB、16 megapixels;リクエスト本体全体 ≤13MiB;base64 埋め込みのみ対応、URL は非対応)。例:
{
"model": "lala-decision",
"images": ["iVBORw0KGgo...(base64 PNG)"],
"state": "顧客がレシート写真を送信し、確認を要求しています",
"questions": {
"is_valid_receipt": {"type": "noul", "instructions": "画像は有効なレシートですか?"}
}
}
エラー処理
| HTTP | 含義 | 処理 |
|---|---|---|
| 401 | API key が無効または不足しています | 確認 x-lala-key header |
| 400 | model 名が存在しない / body 形式が誤っています | 対照モデルリストと各 endpoint サンプルを参照 |
| 5xx | アップストリーム一時的なエラー | 指数バックオフ再試行(推奨最大 3 回) |
Response テキストは brand normalization を経由(サプライヤー関連の表現は lala/buddylala ブランド名に統一されます)、JSON 構造およびフィールドは完全に標準化されており、解析に影響しません。