th ▾
สร้างคีย์

API Uncensored, ตามที่คุณต้องการ

https://api.mistralapikeys.com/v1

คู่มือการผสานรวมสำหรับนักพัฒนา

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

Authentication & Base URL

เริ่มต้นด้วยการสร้างคีย์บนแดชบอร์ด บริการของเราต้องการ base URL เป็น HTTPS://api.mistralapikeys.com/v1 ส่งคีย์ของคุณใน header Authorization เป็น Bearer token เรารองรับการสมัครด้วย Google หรืออีเมลโดยไม่ต้องยืนยันหมายเลขโทรศัพท์

curl https://api.mistralapikeys.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Convert the python loop to rust syntax"}]
  }'

Chat Completions Endpoint

ส่งคำขอ POST ไปยัง /v1/chat/completions ใช้ model id "uncensored" สำหรับการสร้างข้อความ ระบบรองรับ arrays ข้อความมาตรฐานพร้อม role และ content fields input tokens มีราคา $0.15 ต่อ 1M ในขณะที่ output tokens มีราคา $0.50 ต่อ 1M

from openai import OpenAI

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

การตอบกลับแบบสตรีมมิ่ง & จำนวนโทเค็น

เปิดใช้งานการสตรีมโดยตั้งค่า stream เป็น true API จะส่งคืน Server-Sent Events ที่ประกอบด้วยชิ้นส่วนบางส่วน ชิ้นส่วนสุดท้ายประกอบด้วยสถิติการใช้โทเค็นเต็มรูปแบบสำหรับการเรียกเก็บเงินที่แม่นยำ วิธีนี้ช่วยลดความล่าช้าที่รับรู้สำหรับการส่งออกที่ยาวนาน

import OpenAI from "openai";

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

รับคีย์ของคุณภายในไม่กี่วินาที

สมัคร คัดลอกคีย์ อัปเดต URL พื้นฐาน เสร็จแล้ว

สร้างคีย์ดูเอกสาร