快速入门:无审查 API
将此无审查的 LLM 集成到您的现有 OpenAI 兼容架构中,立即开始生成文本。我们提供直接 API 端点和透明的令牌计算,让您确切知道支付的费用。
认证和基础 URL
首先将客户端指向我们的特定基础 URL 并使用您的唯一 API 密钥。我们采用简单的认证模型,您的密钥授予对无审查端点的访问权限。您可以通过密钥页面的 Google 登录或电子邮件即时生成此密钥。基础 URL 为 https://api.pricingopenrouter.com/v1. 此结构确保与标准 OpenAI SDK 兼容,无需自定义包装器。您无需管理多个供应商密钥或处理复杂的路由逻辑。只需设置环境变量,然后开始发送请求。系统在处理任何令牌之前会验证您的凭据。如果您的密钥无效,API 将立即返回 401 错误。这种直接方法消除了通常使标准聚合器复杂化的代理标记层。
发送您的第一个聊天补全请求
发送标准聊天补全请求以从 uncensored 模型接收文本回复。模型 id 仅为 uncensored. 该开源模型运行在我们的服务器上,不会拒绝合法的成人或争议性话题。您可以发送单个提示或对话历史。API 接受带有 messages 数组。请确保包含 model field set to uncensored系统处理您的输入并返回生成的文本。这种直接交互允许对生成过程进行精确控制。您可以使用简单的 curl 命令测试此功能以验证连接。响应将包含 token 使用统计信息以实现透明。
cURL
curl https://api.pricingopenrouter.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set the budget limit to five dollars for this week."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.pricingopenrouter.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.pricingopenrouter.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);流式传输
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)生成您的 API 密钥
注册,复制密钥,更新您的基础 URL。这就是全部配置。