认证和基础 URL
通过更新客户端配置(包含正确的基础 URL 和有效的 API 密钥)连接到 API。每个请求都需要使用您的唯一密钥的标准 Authorization 头。
使用 Google 或邮箱注册,即可即时获取您的密钥。该密钥授予访问 uncensored 模型的权限,用于生成合法的成人内容。
curl https://api.nsfwminimax.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set my user role to moderator in the config file"}]
}'
Chat Completions 端点
向 chat/completions 用于接收生成响应的端点。此端点接受标准的 OpenAI 兼容负载。
将模型 ID 指定为 uncensored 确保模型在没有拒绝的情况下回答成人主题。API 高效处理文本输入并返回文本输出。
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwminimax.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.nsfwminimax.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)