驗證與 Base URL
您的 API 金鑰用於驗證每一次請求。您可透過儀表板使用 Google 或電子郵件產生金鑰;無需電話號碼。請在 Authorization 標頭。所有請求的基礎網址為 HTTPS://api.modelsnsfw.com/v1. 此端點可透過僅更改基礎 URL 並提供金鑰的方式,與任何 OpenAI 相容客戶端搭配使用。
curl https://api.modelsnsfw.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List all available nsfw model tiers and their monthly costs."}]
}'
聊天完成端點
透過 POST /v1/chat/completions. 模型 ID 為 uncensored. 它是針對合法成人內容無拒絕調整的開放權重模型。它不是 GPT、Claude 或其他任何供應商模型。輸入 token 每百萬成本為 $0.15;輸出 token 每百萬成本為 $0.50。錯誤免費。
from openai import OpenAI
client = OpenAI(base_url="https://api.modelsnsfw.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)
串流回應 (SSE)
在請求主體中將 stream: true. API 返回伺服器發送的事件 (SSE),其中 token 使用量包含在最後一個區塊中。這非常適合即時聊天介面。您會立即收到部分 token。這顯著降低了用戶的感知延遲。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.modelsnsfw.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);
函式呼叫 & JSON 模式
使用 response_format: {"type": "json_object"} 用於結構化輸出。您也可以為函式呼叫定義工具。模型支援 temperature, top_p, stop,以及 seed 參數。這確保了在需要時獲得確定性結果。JSON 模式強制輸出為有效的 JSON 格式。
速率限制與限制條件
每支金鑰每分鐘限 300 次請求。最多只能同時運行 8 個請求。請求主體不得超過 8 MB。若發送過多請求,您將收到 429 錯誤。無效金鑰返回 401。信用額度不足返回 402。處理過程中的錯誤不會消耗您的預付信用額度。
Token 使用與計費
提示與補全的總上下文視窗為 100,000 tokens。每次請求的最大輸出為 16,000 tokens。若 max_tokens 未設定),預設值為 2,048。信用額度為預付制且永不過期。充值僅限加密貨幣(USDT/TRC20 或 USDC/Base)。較大額的充值可獲得額外信用額度。無需訂閱。
串流
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)