Uwierzytelnianie i URL bazowy
Połącz się z API, aktualizując konfigurację klienta poprawnym bazowym URL i ważnym kluczem API. Każde żądanie wymaga standardowego nagłówka Authorization z użyciem Twojego unikalnego klucza.
Zarejestruj się za pomocą Google lub e-maila, aby natychmiast otrzymać swój klucz. Klucz daje dostęp do modelu uncensored do generowania legalnej treści dla dorosłych.
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"}]
}'
Endpoint Chat Completions
Wyślij prompty tekstowe do chat/completions endpoint do otrzymywania wygenerowanych odpowiedzi. Endpoint ten akceptuje standardowe ładunki zgodne z OpenAI.
Specify the model ID as uncensored do zapewnienia, że model odpowiada bez odrzuceń dla tematów dla dorosłych. API przetwarza wejście tekstowe i zwraca wyjście tekstowe wydajnie.
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);Strumieniowanie
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)