基礎 URL 與驗證
基礎網址為 https://api.aiwithoutfilters.com/v1。將您的金鑰傳入 Authorization 作為 Bearer YOUR_API_KEY. 每個帳戶僅限一個金鑰,可透過 Google 或電子郵件即時建立。此端點會返回您的可用模型 ID,並確認您的身份驗證狀態,且不消耗信用額度。
首次請求
發送標準聊天完成請求至 POST /v1/chat/completions. 模型 ID 為 uncensored. 此端點處理文字輸入與輸出互動,無額外負擔。
這是一個基本 curl 範例,用於測試您的連線並查看模型對簡單提示的回應。
成本: 輸入 token 按每 1M 個 token $0.15 收費。輸出 token 每 1M 個 token 成本為 $0.50。
curl https://api.aiwithoutfilters.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List all active ports on localhost using curl"}]
}'
Python SDK 集成
使用官方 OpenAI Python SDK 與我們的 API 互動。設定 base_url 和 api_key 在進行呼叫前。這允許您在切換後端模型時保留現有的程式碼結構。
以下程式碼片段演示了如何設定客戶端並向無審查模型發送訊息。
from openai import OpenAI
client = OpenAI(base_url="https://api.aiwithoutfilters.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.aiwithoutfilters.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)