AllAIKey OpenAI 兼容 API 快速接入指南
3 步完成第一次 Chat Completions 调用。
- 通过 企业咨询 申请测试,或登录控制台创建 API Key。
- 设置 Base URL 为
https://allaikey.com/v1。 - 发起调用并核对响应与账单中的模型名:
curl https://allaikey.com/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.4","messages":[{"role":"user","content":"hello"}]}'
from openai import OpenAI
client = OpenAI(base_url="https://allaikey.com/v1", api_key="sk-YOUR_KEY")
print(client.chat.completions.create(
model="gpt-5.4",
messages=[{"role":"user","content":"hello"}],
))
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://allaikey.com/v1", apiKey: "sk-YOUR_KEY" });
const r = await client.chat.completions.create({
model: "gpt-5.4",
messages: [{ role: "user", content: "hello" }],
});
console.log(r);
如何确认成功
- HTTP 200 且返回 choices
- 控制台用量出现对应模型与 request
常见错误见 错误码。密钥请用环境变量,勿写入前端仓库。
更新日期:2026-07-20