OPENAI COMPATIBLE
使用 SDK 进行代码接入
继续使用熟悉的 OpenAI SDK 与兼容客户端,只需将 Base URL 和 API Key 指向 LLMRouter。
配置接口地址与密钥
export OPENAI_BASE_URL=https://api.llmrouter.pro/v1
export OPENAI_API_KEY=sk-lr-your-key选择你常用的开发语言
提供 JavaScript、Python、Go、Java、C#、Ruby 和 PHP 接入示例。
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-lr-your-key",
baseURL: "https://api.llmrouter.pro/v1",
});
const response = await client.chat.completions.create({
model: "your-model",
messages: [{ role: "user", content: "你好" }],
});
console.log(response.choices[0].message.content);可用端点
GET /v1/modelsPOST /v1/chat/completionsPOST /v1/responses
具体模型 ID 与端点能力以模型详情页和控制台为准。