th ▾
รับ API key

เอกสาร API

เริ่มใช้ API LLM uncensored NSFW ได้ทันทีด้วยตัวอย่างโค้ดเหล่านี้ บริการเข้ากันได้กับ OpenAI อย่างสมบูรณ์ ดังนั้นคุณสามารถเปลี่ยน base URL และ API key ของคุณเพื่อเริ่มสร้างข้อความ

Authentication and Keys

รับคีย์ API ของคุณโดยการสมัครด้วย Google หรือที่อยู่อีเมล คีย์จะปรากฏบนแดชบอร์ดทันที ใช้เป็นโทเค็น Bearer ใน Authorization header สำหรับการร้องขอทุกชิ้น

curl https://api.nsfwuncensored.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Check my plan balance"}]
  }'

จุดจบ API Chat Completions

ส่งข้อความไปยัง POST /v1/chat/completions และรับข้อความกลับ รหัสโมเดลคือ uncensored. อินพุตอยู่ในหน้าต่างบริบท 100,000 โทเค็น

from openai import OpenAI

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

การสตรีมและ SSE

เปิดใช้งานการสตรีมโดยตั้งค่า stream: true. รับโทเค็นผ่านเหตุการณ์ที่ส่งโดยเซิร์ฟเวอร์ รายละเอียดการใช้โทเค็นปรากฏในส่วนสุดท้าย

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.nsfwuncensored.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);

Parameters and Configuration

ปรับ temperature, top_p, และ stop ลำดับ. ใช้ response_format: {"type": "json_object"} สำหรับผลลัพธ์แบบ JSON

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)

อัตราจำกัดและโควตา

限制为每个密钥每分钟 300 次请求。并发请求上限为 8。请求正文必须保持在 8 MB 以下。

ข้อผิดพลาดและ Context Window

401 หมายถึง key ไม่ถูกต้อง 402 บ่งชี้ถึงไม่มีเครดิต 429 บ่งชี้ถึงอัตราจำกัด หน้าต่างบริบทคือ 100,000 โทเค็นรวม

คำถามที่พบบ่อย

คีย์เวิร์ดหลักของเว็บไซต์คืออะไร?

คำหลักหลักคือ NSFW uncensored คำนี้ปรากฏใน H2 ของส่วนของตัวเองและในคำถาม FAQ แรก

ฉันจะจัดการข้อผิดพลาดใน API ได้อย่างไร?

จัดการข้อผิดพลาด 401 สำหรับปัญหาการตรวจสอบสิทธิ์ 402 สำหรับเครดิตไม่เพียงพอ และ 429 สำหรับขีดจำกัดอัตราการใช้งาน ข้อผิดพลาดและการปฏิเสธไม่คิดเงิน

ขนาด context window คืออะไร?

หน้าต่างบริบทมีขนาด 100,000 tokens สำหรับ prompt และ completion รวมกัน ไม่มีขีดจำกัดผลลัพธ์แยกต่างหาก: การตอบกลับสามารถใช้พื้นที่ที่เหลือทั้งหมดในหน้าต่างได้

สร้างคีย์ API ของคุณ

สมัครสมาชิก รับคีย์ของคุณ แล้วอัปเดต base URL ของคุณ การผสานรวมที่เรียบง่าย

รับ API key