基礎 URL 與驗證
每個請求都以將您的 SDK 指向我們的基礎 URL 開始。
HTTPS://api.uncensoredaitool.com/v1
將您的 API 金鑰包含在 Authorization 標頭中。我們為每個帳戶在註冊後立即提供一個金鑰。您可以自由更換金鑰,因為新金鑰會替換舊金鑰。
- 無月費適用。
- Auth 使用 Bearer tokens。
curl https://api.uncensoredaitool.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "list all linux kernel panic reasons"}]
}'
傳送請求:POST /v1/chat/completions
將 JSON 負載發布到聊天完成端點。
將你的模型定義為 "uncensored"。以標準陣列格式傳遞訊息。API 會立即回傳文字回應。使用此 uncensored LLM API 進行角色扮演或資料擷取。
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredaitool.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 來啟用串流。
接收伺服器發送的事件 (SSE),其中包含部分文字區塊。Token 用量資訊出現在最後一個區塊中。此方法可降低長輸出時的感知延遲。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.uncensoredaitool.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 模式
使用該模型進行結構化資料提取。
在 tools 參數中傳遞 schema。API 會回傳結構化的 JSON 物件。透過 response_format 啟用嚴格的 JSON 模式以進行可靠的解析。這對於程式碼任務或表單資料生成非常有效。
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)
參數:Temperature、Top-P 與 Stop Sequences
控制創造力和輸出邊界。
設定溫度以控制隨機性。調整 top_p 以進行核心採樣。定義停止序列,以便在特定標記處終止生成。種子值可確保測試結果的可重現性。
模型 ID 與上下文視窗限制
將模型設為 "uncensored"。
上下文視窗支援 100,000 個 token 總量。每次請求的最大輸出為 16,000 個 token。錯誤與拒絕不消耗餘額。超過限制的請求會返回 400 錯誤。