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

เอกสารประกอบและเริ่มต้นอย่างรวดเร็วสำหรับ API ของ Cursor

LLM แบบไม่เซ็นเซอร์นี้ทำงานผ่าน API ที่เข้ากันได้กับ OpenAI ทำให้คุณสามารถใช้ API key ของ cursor ของคุณเองหรือสร้างใหม่สำหรับการผสานรวมโดยตรง

Authentication and Base URL Setup

เริ่มต้นโดยชี้ client ของคุณไปยัง base URL https://api.cursorapi.cc/v1 โดยการส่งคีย์ของคุณในหัวข้อความยินยอม ระบบใช้การตรวจสอบสิทธิ์โทเค็นแบร์เกอร์มาตรฐาน ดังนั้น SDK ของ OpenAI ใดๆ จึงใช้งานได้ทันทีหลังจากที่คุณอัปเดตจุดเชื่อมต่อ

ส่งคำขอไปยัง /v1/chat/completions

ส่ง prompt แรกไปยัง POST /v1/chat/completions endpoint พร้อมตั้งค่ารหัสโมเดลเป็น uncensored. โมเดลนี้ตอบกลับโดยไม่ปฏิเสธเนื้อหาผู้ใหญ่หรือหัวข้อที่ถกเถียงที่ถูกต้องตามกฎหมาย ทำให้คุณควบคุมผลลัพธ์ได้อย่างเต็มที่ คุณจ่ายเฉพาะการใช้งานโทเค็นจริง โดยข้อผิดพลาดเป็นฟรี ทำให้คุณไม่เสียเครดิตกับการล้มเหลวแบบเงียบ

cURL

curl https://api.cursorapi.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Summarize the key differences between the two models."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.cursorapi.cc/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.cursorapi.cc/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 พื้นฐานของคุณ การตั้งค่าเรียบง่าย

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