無限制/OpenAI-Compatible API 文件
OpenAI-Compatible API 文件
幾分鐘內即可開始使用我們的無審查 LLM API。向基礎 URL 發送請求,接收原始文本,並在無訂閱費用的情況下擴展。
https://api.unrestrictedaichatgpt.com/v1uncensored
驗證與 Base URL
使用提供的基礎 URL 和 API 金鑰訪問該服務。您的金鑰對所有請求進行身份驗證。
- 基礎 URL:
https://api.unrestrictedaichatgpt.com/v1 - 標頭:
Authorization: Bearer YOUR_API_KEY
立即從儀表板取得金鑰。
curl https://api.unrestrictedaichatgpt.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Run python script to sum column in csv file"}]
}'
聊天完成端點
發送訊息至 /v1/chat/completions 端點。模型 ID 為 uncensored.
請求回傳文字回應。您可以透過 max_tokens.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictedaichatgpt.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. 透過伺服器發送的事件即時接收 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)
參數:溫度、Top P 與 JSON 模式
調整 temperature 和 top_p 控制創造力。使用 response_format: {"type": "json_object"} 用於結構化輸出。
設定 max_tokens 以限制回應長度。
函式呼叫 & 工具
在請求中定義工具。模型會回傳結構化的工具呼叫。
使用 tool_choice 用於強制執行特定行為。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unrestrictedaichatgpt.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);
速率限制與限制條件
限制:每分鐘 300 次請求,8 個同時請求。最大主體:8 MB。上下文視窗:100,000 個 token。錯誤免費。不發還退款。
常見問題
上下文視窗的大小是多少?
該模型支援結合輸入與輸出的 100,000 個 token 上下文視窗。您可以為每次請求的輸出指定最多 16,000 個 token。
如何處理錯誤?
常見錯誤包括 401(無效金鑰)、402(無餘額)和 429(速率限制)。錯誤不會消耗您的預付餘額。
這是官方的 OpenAI API 嗎?
否。這是相容於 OpenAI 的 API,使用不同的無審查模型。使用相同的 SDK,但需更改基礎 URL 和金鑰。
生成您的金鑰
註冊、取得你的金鑰,更新端點。完成。