繁中 ▾

無限制角色 AI API 文件

使用標準 OpenAI SDK 在幾分鐘內部署無審查 LLM API。取得您的金鑰,設定 base URL,即可發送文字且無內容篩選。

基礎 URL 與驗證

API 金鑰對您的請求進行身份驗證。使用 Continue with Google 或電子郵件註冊以立即產生金鑰。將基礎 URL 設定為 https://api.unrestrictedcharacterai.com/v1 在您的客戶端配置中。這適用於任何 OpenAI 相容的 SDK。

curl https://api.unrestrictedcharacterai.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Set the temperature to 0.7 for stable replies."}]
  }'

聊天完成端點

發送訊息至 POST /v1/chat/completions. 模型 ID 為 uncensored. 它對合法的成人、虛構或具爭議性的主題進行回應,且無審查。文本輸入,文本輸出。沒有額外的服務干擾請求。

from openai import OpenAI

client = OpenAI(base_url="https://api.unrestrictedcharacterai.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 SDK 整合

使用官方 Node SDK 實現無縫整合。傳遞基礎 URL 和金鑰。客戶端處理 HTTP 層。您會收到結構化的 JSON 回應。錯誤處理是標準的。檢查狀態碼。

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.unrestrictedcharacterai.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);

串流回應與 SSE

在請求主體中將 stream: true. 您將收到 Server-Sent Events (SSE)。Token 使用情況出現在最後一個區塊。這可降低長輸出內容的感知延遲。該模型會逐 token 生成文字。

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)

JSON 模式與函式呼叫

使用 response_format: {"type": "json_object"} 用於嚴格的 JSON。函式呼叫支援工具和 tool_choice。在您的訊息中定義 schema。該模型遵循結構。以程式化方式解析輸出。

Limits and Errors

速率限制為每分鐘 300 次請求。上下文視窗為 100,000 tokens。錯誤 401 表示金鑰無效,錯誤 402 表示無餘額,錯誤 429 表示超出速率限制。請求主體最大為 8 MB。利用這些代碼可快速除錯。

常見問題

無限制角色 AI API 兼容 OpenAI 嗎?

是的。它使用與 OpenAI 相同的端點和 SDK。只需更改 base URL 和 API 金鑰即可。您的現有程式碼無需任何更改即可運作。

上下文視窗的大小是多少?

上下文視窗為 100,000 個 token。這包含提示詞與補全內容。您可以傳送長文件或對話歷史。

如何處理錯誤?

使用標準的 HTTP 狀態碼。401 表示身份驗證失敗。402 表示信用額度不足。429 表示限流。請查看回應主體以獲取詳細資訊。

立即取得金鑰

註冊,複製權杖,並更新端點。就是這樣。

取得您的金鑰