API 文件:uncensored Chat Completions
接入您的 OpenAI 相容客戶端,立即使用我們的無審查模型生成文字。我們提供專用端點,接受標準參數,並移除對合法成人主題的內容拒絕。
驗證與 Base URL
每次請求都需要在 Authorization header。我們的基礎網址為 https://api.deepseekopenaicompatibleapi.com/v1. 您會在透過 Google 或電子郵件註冊後立即獲得此金鑰。不需要電話號碼。此金鑰用於標識您的帳戶並追蹤預付額度使用情況。錯誤和拒絕不會消耗 token,因此您只需為成功的補全付費。
聊天完成端點
發送訊息至 POST /v1/chat/completions 生成文字回應。模型 ID 始終為 uncensored. 此端點處理具有 system、user 和 assistant 角色的標準聊天格式。它不支援嵌入、圖片或微調。使用所需的模型參數和內容配置您的請求。回應會返回生成的文字以及 token 使用統計數據。
串流回應 (SSE)
在請求主體中將 stream: true 在你的請求主體中。伺服器為即時 token 傳輸回傳伺服器發送的事件 (SSE)。Token 使用數據僅出現在串流的最後一個區塊。此方法可降低長輸出的感知延遲。在客戶端緩衝接收到的事件,以重建完整訊息。
cURL
curl https://api.deepseekopenaicompatibleapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Summarize the release notes of the last stable build"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.deepseekopenaicompatibleapi.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.deepseekopenaicompatibleapi.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)