基础 URL 和认证
基础 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)