th ▾

API LLM ไร้การเซ็นเซอร์แบบเน้นโค้ด

คู่มือเริ่มต้นใช้งาน API AI ไม่เซ็นเซอร์

ผสานรวม API AI uncensored ของเราด้วยไวยากรณ์ที่เข้ากันได้กับ OpenAI มาตรฐานเพื่อสร้างข้อความโดยไม่มีการปฏิเสธเนื้อหา คู่มือเริ่มต้นอย่างรวดเร็วนี้ครอบคลุมการตรวจสอบสิทธิ์ คำขอ streaming และผลลัพธ์ที่มีโครงสร้างสำหรับแอปพลิเคชันของคุณ

ข้อกำหนดเบื้องต้นและการตรวจสอบสิทธิ์

เริ่มต้นด้วยการสร้างบัญชีและสร้างคีย์ API ใช้ ดำเนินการต่อด้วย Google หรือป้อนอีเมลและรหัสผ่านบน รับ API key หน้าเว็บ คีย์จะปรากฏทันที ไม่ต้องใช้หมายเลขโทรศัพท์ ตั้งค่า OPENAI_API_KEY ตัวแปรสภาพแวดล้อมเป็นค่านี้ ใช้ URL พื้นฐานนี้สำหรับการร้องขอทั้งหมด: https://api.uncensoredaiplatform.com/v1.

curl https://api.uncensoredaiplatform.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "set max tokens to 2048 and temperature to 0.7"}]
  }'

การส่งคำขอครั้งแรกของคุณ

ส่งคำขอ POST ไปยัง /v1/chat/completions ด้วยรหัสโมเดล uncensored. รวมอาร์เรย์ข้อความของคุณใน body API จะส่งการตอบกลับเป็นข้อความ ใช้ได้กับไคลเอนต์ที่เข้ากันได้กับ OpenAI เปลี่ยน URL ฐานและคีย์ API ในการกำหนดค่าของคุณ ใช้โครงสร้างง่ายๆ นี้เพื่อทดสอบการเชื่อมต่อ

from openai import OpenAI

client = OpenAI(base_url="https://api.uncensoredaiplatform.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.uncensoredaiplatform.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)

รับคีย์ API ของคุณ

สมัคร คัดลอกคีย์ เปลี่ยน URL พื้นฐาน นั่นแหละ

รับคีย์ทดลองใช้