URL ฐานและการตรวจสอบสิทธิ์
URL ฐานคือ https://api.aiwithoutfilters.com/v1. ส่งคีย์ของคุณใน Authorization header as Bearer YOUR_API_KEY. คุณได้รับคีย์ 1 คีย์ต่อบัญชี สร้างได้ทันทีผ่าน Google หรืออีเมล จุดปลายนี้ (endpoint) จะคืน ID โมเดลที่พร้อมใช้งานของคุณและยืนยันสถานะการตรวจสอบสิทธิ์ของคุณโดยไม่ใช้เครดิต
คำขอครั้งแรก
ส่งคำขอ chat completion มาตรฐานไปยัง POST /v1/chat/completions. รหัสโมเดลคือ uncensored. เอนด์พอยต์นี้จัดการการโต้ตอบข้อความเข้า-ข้อความออกโดยไม่มีภาระเพิ่มเติม
นี่คือตัวอย่าง curl พื้นฐานเพื่อทดสอบการเชื่อมต่อของคุณและดูโมเดลตอบสนองต่อคำของ่ายๆ
ต้นทุน: โทเค็นอินพุตคิดอัตรา $0.15 ต่อ 1M โทเค็น โทเค็นเอาท์พุตราคา $0.50 ต่อ 1M โทเค็น
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"}]
}'
การผสานรวม SDK Python
ใช้ Python SDK ทางการของ OpenAI เพื่อโต้ตอบกับ API ของคุณ ตั้งค่า base_url และ api_key ก่อนทำการเรียกใช้ สิ่งนี้ทำให้คุณสามารถรักษาโครงสร้างโค้ดที่มีอยู่ของคุณได้ขณะเปลี่ยนโมเดลแบ็กเอนด์
โค้ดด้านล่างนี้แสดงวิธีการตั้งค่าไคลเอนต์และส่งข้อความไปยังโมเดล uncensored
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)