身份驗證與基礎 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)