基礎 URL 與驗證
每個請求都以將您的客戶端指向 https://api.nofilteraichatbot.com/v1 並將您的 API 金鑰包含在授權標頭中。
透過儀表板使用 Google 或電子郵件憑證產生金鑰,然後將其作為 Bearer YOUR_API_KEY 用於每次調用的身份驗證。
首次請求
向聊天補全端點發送第一個提示詞以驗證連線能力和模型行為。
此範例使用 uncensored 模型。
curl https://api.nofilteraichatbot.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Get the temperature in Tokyo"}]
}'
Python 集成
使用官方的 OpenAI Python 函式庫與我們的 API 互動,無需修改核心邏輯。
將基礎 URL 配置為將請求路由至我們的 uncensored 推理引擎。
from openai import OpenAI
client = OpenAI(base_url="https://api.nofilteraichatbot.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 集成
在您的 JavaScript 環境中初始化 SDK,以無縫處理文字生成。
請確保覆寫預設的基礎 URL,以將流量導向我們特定的端點。
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nofilteraichatbot.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: true 即時接收部分回應。
最後一個區塊包含 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)
速率限制與限制條件
每個 API 金鑰支援每分鐘 300 次請求,並允許同時進行 8 個請求。
上下文窗口為 100,000 個 token,請求主體必須保持在 8 MB 以下。