Cursor API 文件與快速入門
此無審查 LLM 採用 OpenAI 相容 API,讓您能替換自己的 Cursor API 金鑰,或產生新的金鑰以進行直接整合。
驗證與 Base URL 設定
首先將您的客戶端指向基礎 URL https://api.cursorapi.cc/v1 並將您的金鑰傳遞至授權標頭。該系統使用標準的 Bearer token 驗證,因此一旦更新端點,任何 OpenAI SDK 都能立即使用。
傳送請求至 /v1/chat/completions
向 POST /v1/chat/completions 端點,將模型 ID 設為 uncensored. 該模型針對合法成人內容無審查地回答,讓您完全控制輸出。您僅為實際 token 使用付費,錯誤是免費的,確保您不會因靜默失敗而浪費信用額度。
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)