Pengesahan dan URL Asas
Sambungkan ke API dengan mengemas kini konfigurasi klien anda dengan URL asas yang betul dan kunci API yang sah. Setiap permintaan memerlukan header Authorization piawai menggunakan kunci unik anda.
Daftar dengan Google atau e-mel untuk menerima kunci anda serta-merta. Kunci ini memberikan akses kepada model uncensored untuk penjanaan kandungan dewasa yang sah.
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"}]
}'
Penamat Chat Completions
Hantar prompt teks ke chat/completions endpoint untuk menerima respons yang dijana. Endpoint ini menerima payload serasi OpenAI standard.
Nyatakan ID model sebagai uncensored untuk memastikan model menjawab tanpa penolakan untuk topik dewasa. API memproses input teks dan mengembalikan output teks dengan cekap.
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);Aliran
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)